summaryrefslogtreecommitdiff
path: root/usr.bin/dig/nslookup.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-09-13 09:33:40 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-09-13 09:33:40 +0000
commitcb353c2e238251ba8e2e5a0f35eac4d117254c3d (patch)
tree07df3c3d6bb8a5dda30aabfc0fd851d36ee59b02 /usr.bin/dig/nslookup.c
parentf7034f3b899784eb0446d942568f6f9e18dc6787 (diff)
Get rid of isc_parse_uint32() and replace it with strtonum.
While here use the standard strtonum error messages. input & OK beck, OK kn
Diffstat (limited to 'usr.bin/dig/nslookup.c')
-rw-r--r--usr.bin/dig/nslookup.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/usr.bin/dig/nslookup.c b/usr.bin/dig/nslookup.c
index 76b7abfe215..2776fc585ae 100644
--- a/usr.bin/dig/nslookup.c
+++ b/usr.bin/dig/nslookup.c
@@ -522,33 +522,49 @@ testclass(char *typetext) {
static void
set_port(const char *value) {
uint32_t n;
- isc_result_t result = parse_uint(&n, value, 65535, "port");
- if (result == ISC_R_SUCCESS)
+ const char *errstr;
+
+ n = strtonum(value, 0, 65535, &errstr);
+ if (errstr == NULL)
port = (uint16_t) n;
+ else
+ printf("port is %s: '%s'\n", errstr, value);
}
static void
set_timeout(const char *value) {
uint32_t n;
- isc_result_t result = parse_uint(&n, value, UINT_MAX, "timeout");
- if (result == ISC_R_SUCCESS)
+ const char *errstr;
+
+ n = strtonum(value, 0, UINT_MAX, &errstr);
+ if (errstr == NULL)
timeout = n;
+ else
+ printf("timeout is %s: '%s'\n", errstr, value);
}
static void
set_tries(const char *value) {
uint32_t n;
- isc_result_t result = parse_uint(&n, value, INT_MAX, "tries");
- if (result == ISC_R_SUCCESS)
+ const char *errstr;
+
+ n = strtonum(value, 0, INT_MAX, &errstr);
+ if (errstr == NULL)
tries = n;
+ else
+ printf("tries is %s: '%s'\n", errstr, value);
}
static void
set_ndots(const char *value) {
uint32_t n;
- isc_result_t result = parse_uint(&n, value, 128, "ndots");
- if (result == ISC_R_SUCCESS)
+ const char *errstr;
+
+ n = strtonum(value, 0, 128, &errstr);
+ if (errstr == NULL)
ndots = n;
+ else
+ printf("ndots is %s: '%s'\n", errstr, value);
}
static void