diff options
| author | 2020-09-13 09:33:39 +0000 | |
|---|---|---|
| committer | 2020-09-13 09:33:39 +0000 | |
| commit | c49c5f059d65f913eef426d373aa7816ee25c9b1 (patch) | |
| tree | c6141d850e38ce3049dfba4adf9ec8056a8d7a81 /usr.bin/dig/nslookup.c | |
| parent | remove unused lex states (diff) | |
| download | wireguard-openbsd-c49c5f059d65f913eef426d373aa7816ee25c9b1.tar.xz wireguard-openbsd-c49c5f059d65f913eef426d373aa7816ee25c9b1.zip | |
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.c | 32 |
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 |
