Commit 42458336 authored by Mark Andrews's avatar Mark Andrews
Browse files

error out if there are extra command line options

(cherry picked from commit f73816ff)
parent 1080af1d
Pipeline #9638 passed with stages
in 24 minutes and 27 seconds
5157. [bug] Nslookup now errors out if there are extra command
line arguments. [GL #207]
5154. [bug] dig: process_opt could be called twice on the same
message leading to a assertion failure. [GL #860]
......
......@@ -879,6 +879,23 @@ get_next_command(void) {
isc_mem_free(mctx, buf);
}
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
fprintf(stderr, "Usage:\n");
fprintf(stderr,
" nslookup [-opt ...] # interactive mode using default server\n");
fprintf(stderr,
" nslookup [-opt ...] - server # interactive mode using 'server'\n");
fprintf(stderr,
" nslookup [-opt ...] host # just look up 'host' using default server\n");
fprintf(stderr,
" nslookup [-opt ...] host server # just look up 'host' using 'server'\n");
exit(1);
}
static void
parse_args(int argc, char **argv) {
bool have_lookup = false;
......@@ -900,6 +917,9 @@ parse_args(int argc, char **argv) {
in_use = true;
addlookup(argv[0]);
} else {
if (argv[1] != NULL) {
usage();
}
set_nameserver(argv[0]);
check_ra = false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment