Package: fping
Owner: Marton Balint <[EMAIL PROTECTED]>
Tags: patch

Date: 2008-05-09 12:54

Add support for command line select timeout setting

This patch adds a command line option (-S) to set the timeout of the
select() call, which was a compile time constant (10 secs) until now.

--- fping.c.old 2006-02-26 16:17:47.000000000 +0100
+++ fping.c     2006-02-26 16:29:06.000000000 +0100
@@ -491,7 +491,7 @@
 
        /* get command line options */
 
-       while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:" 
) ) != EOF )
+       while( ( c = getopt( argc, argv, 
"gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:S:" ) ) != EOF )
        {
                switch( c )
                {
@@ -502,7 +502,7 @@
                        break;
                
                case 'r':
-                       if( !( retry = ( u_int )atoi( optarg ) ) )
+                       if( ( retry = ( u_int )atoi( optarg ) ) < 0 )
                                usage();
 
                        break;
@@ -518,6 +518,12 @@
                                usage();
 
                        break;
+                       
+               case 'S':
+                       if( !( select_time = ( u_int )atoi( optarg ) * 100 ) )
+                               usage();
+
+                       break;
 
                case 'c':
                        if( !( count = ( u_int )atoi( optarg ) ) )
@@ -2732,6 +2738,7 @@
        fprintf( stderr, "   -Q n       same as -q, but show summary every n 
seconds\n" );
        fprintf( stderr, "   -r n       number of retries (default %d)\n", 
retry );
        fprintf( stderr, "   -s         print final stats\n" );
+       fprintf( stderr, "   -S         set select timeout (default %d)\n", 
select_time / 100 );
        fprintf( stderr, "   -t n       individual target initial timeout (in 
millisec) (default %d)\n", timeout / 100 );
        fprintf( stderr, "   -u         show targets that are unreachable\n" );
        fprintf( stderr, "   -v         show version\n" );

Attachment: signature.asc
Description: Digital signature

Reply via email to