From 8aa436111820e07ec06034e0c37cbe7ad4a7d500 Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Sun, 30 Sep 2018 14:05:39 -0700 Subject: [PATCH] allow passing hex or decimal arguments to -z (debug) flag Signed-off-by: Steven Noonan --- src/fping.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fping.c b/src/fping.c index 7905c58..a499422 100644 --- a/src/fping.c +++ b/src/fping.c @@ -635,8 +635,9 @@ int main(int argc, char** argv) #if defined(DEBUG) || defined(_DEBUG) case 'z': - if (!(debugging = (unsigned int)atoi(optparse_state.optarg))) - usage(1); + if (sscanf(optparse_state.optarg, "0x%x", &debugging) != 1) + if (sscanf(optparse_state.optarg, "%u", &debugging) != 1) + usage(1); break; #endif /* DEBUG || _DEBUG */