]> git.gsnw.org Git - fping.git/commitdiff
more tests
authorDavid Schweikert <david@schweikert.ch>
Fri, 2 May 2014 21:39:39 +0000 (23:39 +0200)
committerDavid Schweikert <david@schweikert.ch>
Fri, 2 May 2014 21:39:39 +0000 (23:39 +0200)
ci/test-11-nopriv.pl [changed mode: 0644->0755]
ci/test-12-option-type.pl [new file with mode: 0755]
src/fping.c

old mode 100644 (file)
new mode 100755 (executable)
diff --git a/ci/test-12-option-type.pl b/ci/test-12-option-type.pl
new file mode 100755 (executable)
index 0000000..d6e3211
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/perl -w
+
+use Test::Command tests => 33;
+
+for my $arg (qw(i B c C H i O p Q r t)) {
+    my $cmd = Test::Command->new(cmd => "fping -$arg xxx");
+    $cmd->exit_is_num(1);
+    $cmd->stdout_is_eq("");
+    $cmd->stderr_like(qr{Usage:});
+}
index 62370900e02dbf9c370d4bd20ccc279f817955d5..b62983cb9e587128ddfa46167e3c444f4a6c6b92 100644 (file)
@@ -392,7 +392,8 @@ int main( int argc, char **argv )
             break;
         
         case 'r':
-            retry = ( unsigned int )atoi( optarg );
+            if(!(retry = ( unsigned int )atoi( optarg )))
+                usage(1);
             break;
         
         case 'i':
@@ -550,6 +551,9 @@ int main( int argc, char **argv )
                     perror("setting type of service octet IP_TOS");
                 }
             }
+            else {
+                usage(1);
+            }
             break;
         default:
             fprintf(stderr, "see 'fping -h' for usage information\n");