Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/fssconfig Update command line parsing to match real...
details: https://anonhg.NetBSD.org/src/rev/7024e918ad47
branches: trunk
changeset: 346730:7024e918ad47
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sat Jul 30 12:33:27 2016 +0000
description:
Update command line parsing to match reality. Only one of -c, -u, or
-l can be specified, and the -x option is available only for -c.
diffstat:
usr.sbin/fssconfig/fssconfig.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diffs (68 lines):
diff -r 2d4f54d1b4b6 -r 7024e918ad47 usr.sbin/fssconfig/fssconfig.c
--- a/usr.sbin/fssconfig/fssconfig.c Sat Jul 30 11:31:00 2016 +0000
+++ b/usr.sbin/fssconfig/fssconfig.c Sat Jul 30 12:33:27 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fssconfig.c,v 1.10 2012/11/04 22:21:11 christos Exp $ */
+/* $NetBSD: fssconfig.c,v 1.11 2016/07/30 12:33:27 pgoyette Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -60,18 +60,27 @@
int ch;
void (*action)(int, char **);
- action = config;
+ action = NULL;
while ((ch = getopt(argc, argv, "cluvx")) != -1) {
switch (ch) {
case 'c':
- action = config;
+ if (action)
+ usage();
+ else
+ action = config;
break;
case 'l':
- action = list;
+ if (action)
+ usage();
+ else
+ action = list;
break;
case 'u':
- action = unconfig;
+ if (action)
+ usage();
+ else
+ action = unconfig;
break;
case 'v':
vflag++;
@@ -85,6 +94,8 @@
/* NOTREACHED */
}
}
+ if (action == NULL)
+ action = config;
argc -= optind;
argv += optind;
@@ -189,7 +200,7 @@
int fd;
char full[64];
- if (argc != 1)
+ if (argc != 1 || xflag)
usage();
if (vflag)
@@ -211,7 +222,7 @@
time_t t;
struct fss_get fsg;
- if (argc > 1)
+ if (argc > 1 || xflag)
usage();
if (argc > 0)
Home |
Main Index |
Thread Index |
Old Index