Module Name: src Committed By: pho Date: Sat Jan 22 08:05:36 UTC 2022
Modified Files: src/lib/librefuse: fuse_internal.h refuse.c refuse_lowlevel.c Log Message: Support the FUSE option -ho It is supposed to print a help message without the usage line. Although it is deprecated and has been removed as of FUSE 3.0, filesystems in the wild still use it. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/librefuse/fuse_internal.h cvs rdiff -u -r1.111 -r1.112 src/lib/librefuse/refuse.c cvs rdiff -u -r1.2 -r1.3 src/lib/librefuse/refuse_lowlevel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/librefuse/fuse_internal.h diff -u src/lib/librefuse/fuse_internal.h:1.3 src/lib/librefuse/fuse_internal.h:1.4 --- src/lib/librefuse/fuse_internal.h:1.3 Sat Jan 22 08:01:12 2022 +++ src/lib/librefuse/fuse_internal.h Sat Jan 22 08:05:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fuse_internal.h,v 1.3 2022/01/22 08:01:12 pho Exp $ */ +/* $NetBSD: fuse_internal.h,v 1.4 2022/01/22 08:05:35 pho Exp $ */ /* * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -44,6 +44,11 @@ extern "C" { #endif +enum refuse_show_help_variant { + REFUSE_SHOW_HELP_FULL = 1, + REFUSE_SHOW_HELP_NO_HEADER = 2, +}; + /* Internal functions, hidden from users */ __BEGIN_HIDDEN_DECLS int __fuse_set_signal_handlers(struct fuse* fuse); Index: src/lib/librefuse/refuse.c diff -u src/lib/librefuse/refuse.c:1.111 src/lib/librefuse/refuse.c:1.112 --- src/lib/librefuse/refuse.c:1.111 Sat Jan 22 08:03:32 2022 +++ src/lib/librefuse/refuse.c Sat Jan 22 08:05:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: refuse.c,v 1.111 2022/01/22 08:03:32 pho Exp $ */ +/* $NetBSD: refuse.c,v 1.112 2022/01/22 08:05:35 pho Exp $ */ /* * Copyright © 2007 Alistair Crooks. All rights reserved. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: refuse.c,v 1.111 2022/01/22 08:03:32 pho Exp $"); +__RCSID("$NetBSD: refuse.c,v 1.112 2022/01/22 08:05:35 pho Exp $"); #endif /* !lint */ #include <sys/types.h> @@ -1157,11 +1157,17 @@ fuse_main_real(int argc, char **argv, co } if (opts.show_help) { - if (args.argv[0] != NULL && args.argv[0][0] != '\0') { - /* argv[0] being empty means that the application doesn't - * want us to print the usage string. - */ - printf("Usage: %s [options] mountpoint\n\n", args.argv[0]); + switch (opts.show_help) { + case REFUSE_SHOW_HELP_FULL: + if (args.argv[0] != NULL && args.argv[0][0] != '\0') { + /* argv[0] being empty means that the application doesn't + * want us to print the usage string. + */ + printf("Usage: %s [options] mountpoint\n\n", args.argv[0]); + } + break; + case REFUSE_SHOW_HELP_NO_HEADER: + break; } fuse_cmdline_help(); rv = 0; Index: src/lib/librefuse/refuse_lowlevel.c diff -u src/lib/librefuse/refuse_lowlevel.c:1.2 src/lib/librefuse/refuse_lowlevel.c:1.3 --- src/lib/librefuse/refuse_lowlevel.c:1.2 Sat Dec 4 06:42:39 2021 +++ src/lib/librefuse/refuse_lowlevel.c Sat Jan 22 08:05:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: refuse_lowlevel.c,v 1.2 2021/12/04 06:42:39 pho Exp $ */ +/* $NetBSD: refuse_lowlevel.c,v 1.3 2022/01/22 08:05:35 pho Exp $ */ /* * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: refuse_lowlevel.c,v 1.2 2021/12/04 06:42:39 pho Exp $"); +__RCSID("$NetBSD: refuse_lowlevel.c,v 1.3 2022/01/22 08:05:35 pho Exp $"); #endif /* !lint */ #include <fuse_internal.h> @@ -45,8 +45,9 @@ __RCSID("$NetBSD: refuse_lowlevel.c,v 1. { t, offsetof(struct fuse_cmdline_opts, p), v } static struct fuse_opt fuse_lowlevel_opts[] = { - REFUSE_LOWLEVEL_OPT("-h" , show_help , 1), - REFUSE_LOWLEVEL_OPT("--help" , show_help , 1), + REFUSE_LOWLEVEL_OPT("-h" , show_help , REFUSE_SHOW_HELP_FULL), + REFUSE_LOWLEVEL_OPT("--help" , show_help , REFUSE_SHOW_HELP_FULL), + REFUSE_LOWLEVEL_OPT("-ho" , show_help , REFUSE_SHOW_HELP_NO_HEADER), REFUSE_LOWLEVEL_OPT("-V" , show_version , 1), REFUSE_LOWLEVEL_OPT("--version", show_version , 1), REFUSE_LOWLEVEL_OPT("-d" , debug , 1),