diff options
author | David Nugent <davidn@FreeBSD.org> | 2000-06-18 02:39:17 +0000 |
---|---|---|
committer | David Nugent <davidn@FreeBSD.org> | 2000-06-18 02:39:17 +0000 |
commit | c4e667b9d78a80c295a81a434f10d4d19ed96797 (patch) | |
tree | 7a84bf6b955e7d3cf8c78342159419b0abd85cc8 /usr.sbin | |
parent | 25fa020ea53df92492fcac14cdd74a3b56a35340 (diff) | |
download | src-c4e667b9d78a80c295a81a434f10d4d19ed96797.tar.gz src-c4e667b9d78a80c295a81a434f10d4d19ed96797.zip |
Be a little more strict about handling command line args. This allows user and
group names like 'help' 'mod' 'user' 'group' etc. to work correctly without
requiring the -n style invocation.
PR: misc/17069
Notes
Notes:
svn path=/head/; revision=61760
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pw/pw.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index c17775f89a2d..6c070acb2665 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -153,14 +153,16 @@ main(int argc, char *argv[]) } else break; } - else if ((tmp = getindex(Modes, argv[1])) != -1) + else if (mode == -1 && (tmp = getindex(Modes, argv[1])) != -1) mode = tmp; - else if ((tmp = getindex(Which, argv[1])) != -1) + else if (which == -1 && (tmp = getindex(Which, argv[1])) != -1) which = tmp; - else if ((tmp = getindex(Combo1, argv[1])) != -1 || (tmp = getindex(Combo2, argv[1])) != -1) { + else if ((mode == -1 && which == -1) && + ((tmp = getindex(Combo1, argv[1])) != -1 || + (tmp = getindex(Combo2, argv[1])) != -1)) { which = tmp / M_NUM; mode = tmp % M_NUM; - } else if (strcmp(argv[1], "help") == 0) + } else if (strcmp(argv[1], "help") == 0 && argv[2] == NULL) cmdhelp(mode, which); else if (which != -1 && mode != -1) addarg(&arglist, 'n', argv[1]); |