]> git.gsnw.org Git - fping.git/commitdiff
allow passing hex or decimal arguments to -z (debug) flag
authorSteven Noonan <steven@uplinklabs.net>
Sun, 30 Sep 2018 21:05:39 +0000 (14:05 -0700)
committerSteven Noonan <steven@uplinklabs.net>
Wed, 10 Jun 2020 00:46:09 +0000 (17:46 -0700)
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
src/fping.c

index 7905c58a0622922b3ce649c5315bb9df8664b994..a4994221754e44dd0dcb22a67e5c07b02cb71f64 100644 (file)
@@ -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 */