2
0
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:
Evan Hunt
2014-03-03 08:46:50 -08:00
parent 6be12fa63b
commit 67d01dcacb
9 changed files with 97 additions and 10 deletions

View File

@@ -15,8 +15,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nslookup.c,v 1.130 2011/12/16 23:01:16 each Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -581,6 +579,11 @@ set_ndots(const char *value) {
ndots = n;
}
static void
version(void) {
fputs("nslookup " VERSION "\n", stderr);
}
static void
setoption(char *opt) {
if (strncasecmp(opt, "all", 4) == 0) {
@@ -751,6 +754,8 @@ do_next_command(char *input) {
show_settings(ISC_TRUE, ISC_TRUE);
} else if (strcasecmp(ptr, "exit") == 0) {
in_use = ISC_FALSE;
} else if (strncasecmp(ptr, "ver", 3) == 0) {
version();
} else if (strcasecmp(ptr, "help") == 0 ||
strcasecmp(ptr, "?") == 0) {
printf("The '%s' command is not yet implemented.\n", ptr);
@@ -805,9 +810,12 @@ parse_args(int argc, char **argv) {
for (argc--, argv++; argc > 0; argc--, argv++) {
debug("main parsing %s", argv[0]);
if (argv[0][0] == '-') {
if (argv[0][1] != 0)
if (strncasecmp(argv[0], "-ver", 4) == 0) {
version();
exit(0);
} else if (argv[0][1] != 0) {
setoption(&argv[0][1]);
else
} else
have_lookup = ISC_TRUE;
} else {
if (!have_lookup) {