aboutsummaryrefslogtreecommitdiff
path: root/lib/helper.c
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-09 17:08:29 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-09 22:03:07 -0700
commit225c12aebf2d2f27e1d032d6b2149c7bb1d63506 (patch)
treecb975230f69f925fae7c559bdb3d8faa867f537f /lib/helper.c
parent1014e1fc931f3c8191be3767f789160a69b01381 (diff)
fuse_parse_cmdline(): do not print help/version text
The current behavior makes it difficult to add help for additional options. With the change, this becomes a lot easier.
Diffstat (limited to 'lib/helper.c')
-rw-r--r--lib/helper.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/lib/helper.c b/lib/helper.c
index 140de00..da93413 100644
--- a/lib/helper.c
+++ b/lib/helper.c
@@ -48,12 +48,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
FUSE_OPT_END
};
-static void usage(const char *progname)
-{
- printf("usage: %s mountpoint [options]\n\n", progname);
-}
-
-static void helper_help(void)
+void fuse_cmdline_help(void)
{
printf("General options:\n"
" -h --help print help\n"
@@ -64,11 +59,6 @@ static void helper_help(void)
"\n");
}
-static void helper_version(void)
-{
- printf("FUSE library version: %s\n", PACKAGE_VERSION);
-}
-
static int fuse_helper_opt_proc(void *data, const char *arg, int key,
struct fuse_args *outargs)
{
@@ -126,27 +116,6 @@ int fuse_parse_cmdline(struct fuse_args *args,
fuse_helper_opt_proc) == -1)
return -1;
- if (opts->show_version) {
- helper_version();
- fuse_lowlevel_version();
- fuse_mount_version();
- return -1;
- }
-
- if (opts->show_help) {
- usage(args->argv[0]);
- helper_help();
- fuse_lowlevel_help();
- fuse_mount_help();
- return -1;
- }
-
- if (!opts->mountpoint) {
- fprintf(stderr, "error: no mountpoint specified\n");
- usage(args->argv[0]);
- return -1;
- }
-
/* If neither -o subtype nor -o fsname are specified,
set subtype to program's basename */
if (!opts->nodefault_subtype)
@@ -225,7 +194,7 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
return 1;
if (opts.show_version) {
- helper_version();
+ printf("FUSE library version %s\n", PACKAGE_VERSION);
fuse_lowlevel_version();
fuse_mount_version();
res = 0;
@@ -235,7 +204,7 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
/* Re-add --help for later processing by fuse_new()
(that way we also get help for modules options) */
if (opts.show_help) {
- helper_help();
+ fuse_cmdline_help();
if (fuse_opt_add_arg(&args, "--help") == -1) {
res = 1;
goto out1;
@@ -245,7 +214,6 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
if (!opts.show_help &&
!opts.mountpoint) {
fprintf(stderr, "error: no mountpoint specified\n");
- usage(args.argv[0]);
res = 1;
goto out1;
}