mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
[master] add "version" options to host/nslookup/nsupdate
3773. [func] "host", "nslookup" and "nsupdate" now have options and commands to print the version number. [RT #26057]
This commit is contained in:
@@ -962,7 +962,7 @@ get_addresses(char *host, in_port_t port,
|
||||
host, isc_result_totext(result));
|
||||
}
|
||||
|
||||
#define PARSE_ARGS_FMT "dDML:y:ghlovk:p:Pr:R::t:Tu:"
|
||||
#define PARSE_ARGS_FMT "dDML:y:ghlovk:p:Pr:R::t:Tu:V"
|
||||
|
||||
static void
|
||||
pre_parse_args(int argc, char **argv) {
|
||||
@@ -1023,6 +1023,11 @@ pre_parse_args(int argc, char **argv) {
|
||||
isc_commandline_index = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
version(void) {
|
||||
fputs("nsupdate " VERSION "\n", stderr);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_args(int argc, char **argv, isc_mem_t *mctx, isc_entropy_t **ectx) {
|
||||
int ch;
|
||||
@@ -1060,6 +1065,10 @@ parse_args(int argc, char **argv, isc_mem_t *mctx, isc_entropy_t **ectx) {
|
||||
case 'v':
|
||||
usevc = ISC_TRUE;
|
||||
break;
|
||||
case 'V':
|
||||
version();
|
||||
exit(0);
|
||||
break;
|
||||
case 'k':
|
||||
keyfile = isc_commandline_argument;
|
||||
break;
|
||||
@@ -2022,6 +2031,7 @@ do_next_command(char *cmdline) {
|
||||
}
|
||||
if (strcasecmp(word, "help") == 0) {
|
||||
fprintf(stdout,
|
||||
"nsupdate " VERSION ":\n"
|
||||
"local address [port] (set local resolver)\n"
|
||||
"server address [port] (set master server for zone)\n"
|
||||
"send (send the update request)\n"
|
||||
@@ -2042,6 +2052,10 @@ do_next_command(char *cmdline) {
|
||||
"[update] del[ete] .... (remove the given record(s) from the zone)\n");
|
||||
return (STATUS_MORE);
|
||||
}
|
||||
if (strcasecmp(word, "version") == 0) {
|
||||
fprintf(stdout, "nsupdate " VERSION "\n");
|
||||
return (STATUS_MORE);
|
||||
}
|
||||
fprintf(stderr, "incorrect section name: %s\n", word);
|
||||
return (STATUS_SYNTAX);
|
||||
}
|
||||
|
Reference in New Issue
Block a user