summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dvmrpctl
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2007-01-26 09:55:02 +0000
committerclaudio <claudio@openbsd.org>2007-01-26 09:55:02 +0000
commit8af2c3a1a8e242e4acd42a9398f2eab207ca2544 (patch)
tree5b344ca39c761595e552ed80dcf0982d92a6cf3f /usr.sbin/dvmrpctl
parentmodestring can be 18 long (diff)
downloadwireguard-openbsd-8af2c3a1a8e242e4acd42a9398f2eab207ca2544.tar.xz
wireguard-openbsd-8af2c3a1a8e242e4acd42a9398f2eab207ca2544.zip
Sync with ospfctl/bgpctl: correctly detect missing arguments. OK norby@
Diffstat (limited to 'usr.sbin/dvmrpctl')
-rw-r--r--usr.sbin/dvmrpctl/parser.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/dvmrpctl/parser.c b/usr.sbin/dvmrpctl/parser.c
index 50724f0a45f..c12f9364f0d 100644
--- a/usr.sbin/dvmrpctl/parser.c
+++ b/usr.sbin/dvmrpctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.1 2006/06/01 14:21:28 norby Exp $ */
+/* $OpenBSD: parser.c,v 1.2 2007/01/26 09:55:02 claudio Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -108,7 +108,7 @@ parse(int argc, char *argv[])
bzero(&res, sizeof(res));
- while (argc > 0) {
+ while (argc >= 0) {
if ((match = match_token(argv[0], table)) == NULL) {
fprintf(stderr, "valid commands/args:\n");
show_valid_args(table);
@@ -200,9 +200,11 @@ match_token(const char *word, const struct token table[])
}
if (match != 1) {
- if (match > 1)
+ if (word == NULL)
+ fprintf(stderr, "missing argument:\n");
+ else if (match > 1)
fprintf(stderr, "ambiguous argument: %s\n", word);
- if (match < 1)
+ else if (match < 1)
fprintf(stderr, "unknown argument: %s\n", word);
return (NULL);
}