From 6a648d46c0fcf28d76e80c4d7eb6509373f3e024 Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Wed, 8 Jun 2016 09:18:35 -0400 Subject: nfsidmap: added the -h option Use the correct exit code when an invalid option use or the -h option. Signed-off-by: Steve Dickson --- utils/nfsidmap/nfsidmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'utils/nfsidmap/nfsidmap.c') diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c index 2abefe9..63545fc 100644 --- a/utils/nfsidmap/nfsidmap.c +++ b/utils/nfsidmap/nfsidmap.c @@ -17,7 +17,7 @@ #include "conffile.h" int verbose = 0; -char *usage = "Usage: %s [-v] [-c || [-u|-g|-r key] || -d || -l || [-t timeout] key desc]"; +char *usage = "Usage: %s [-vh] [-c || [-u|-g|-r key] || -d || -l || [-t timeout] key desc]"; #define MAX_ID_LEN 11 #define IDMAP_NAMESZ 128 @@ -369,7 +369,7 @@ int main(int argc, char **argv) xlog_open(progname); - while ((opt = getopt(argc, argv, "du:g:r:ct:vl")) != -1) { + while ((opt = getopt(argc, argv, "hdu:g:r:ct:vl")) != -1) { switch (opt) { case 'd': display++; @@ -398,9 +398,10 @@ int main(int argc, char **argv) case 't': timeout = atoi(optarg); break; + case 'h': default: xlog_warn(usage, progname); - break; + exit(opt == 'h' ? 0 : 1); } } -- cgit