From 2af8d07af6eaf071fcebf5ca58935d743d5077ce Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 25 Aug 2016 12:43:21 +0100 Subject: [PATCH] fuse: Implement --long-options and --short-options in guestunmount. --- fuse/Makefile.am | 3 +++ fuse/guestunmount.c | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fuse/Makefile.am b/fuse/Makefile.am index c70f6498b..b22c78501 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -82,11 +82,14 @@ guestmount_LDADD = \ # guestunmount guestunmount_SOURCES = \ + ../fish/display-options.c \ + ../fish/display-options.h \ guestunmount.c guestunmount_CPPFLAGS = \ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/src -I$(top_builddir)/src \ + -I$(top_srcdir)/fish \ -I$(srcdir)/../gnulib/lib -I../gnulib/lib guestunmount_CFLAGS = \ diff --git a/fuse/guestunmount.c b/fuse/guestunmount.c index c686f4007..fe86706fa 100644 --- a/fuse/guestunmount.c +++ b/fuse/guestunmount.c @@ -39,6 +39,8 @@ #include "ignore-value.h" +#include "display-options.h" + static int do_fusermount (const char *mountpoint, char **error_rtn); static void do_fuser (const char *mountpoint); @@ -81,8 +83,10 @@ main (int argc, char *argv[]) { "fd", 1, 0, 0 }, { "help", 0, 0, HELP_OPTION }, { "quiet", 0, 0, 'q' }, + { "long-options", 0, 0, 0 }, { "no-retry", 0, 0, 0 }, { "retry", 1, 0, 0 }, + { "short-options", 0, 0, 0 }, { "verbose", 0, 0, 'v' }, { "version", 0, 0, 'V' }, { 0, 0, 0, 0 } @@ -106,7 +110,11 @@ main (int argc, char *argv[]) switch (c) { case 0: /* options which are long only */ - if (STREQ (long_options[option_index].name, "fd")) { + if (STREQ (long_options[option_index].name, "long-options")) + display_long_options (long_options); + else if (STREQ (long_options[option_index].name, "short-options")) + display_short_options (options); + else if (STREQ (long_options[option_index].name, "fd")) { if (sscanf (optarg, "%d", &fd) != 1 || fd < 0) error (EXIT_FAILURE, 0, _("cannot parse fd option '%s'"), optarg); } else if (STREQ (long_options[option_index].name, "no-retry")) {