/[inetutils]/inetutils/ping/ping.c
ViewVC logotype

Diff of /inetutils/ping/ping.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by ams, Fri Jul 29 19:06:08 2005 UTC revision 1.25 by gray, Sat Jul 30 17:19:44 2005 UTC
# Line 99  static void show_usage (void); Line 99  static void show_usage (void);
99  static void decode_type (const char *optarg);  static void decode_type (const char *optarg);
100  static int send_echo (PING *ping);  static int send_echo (PING *ping);
101    
102    #define MIN_USER_INTERVAL (200000/PING_PRECISION)
103    
104  int  int
105  main (int argc, char **argv)  main (int argc, char **argv)
106  {  {
# Line 156  main (int argc, char **argv) Line 158  main (int argc, char **argv)
158            break;            break;
159                        
160          case 'i':          case 'i':
161            options |= OPT_INTERVAL;            {
162            interval = ping_cvt_number (optarg, 0, 0);              double v;
163    
164                v = strtod (optarg, &p);
165                if (*p)
166                  {
167                    fprintf (stderr, "Invalid value (`%s' near `%s')\n",
168                             optarg, p);
169                    exit (1);
170                  }
171                
172                options |= OPT_INTERVAL;
173                interval = v * PING_PRECISION;
174                if (!is_root && interval < MIN_USER_INTERVAL)
175                  {
176                    fprintf (stderr, "Option value too small: %s\n", optarg);
177                    exit (1);
178                  }
179              }
180            break;            break;
181                        
182          case 'p':          case 'p':
# Line 186  main (int argc, char **argv) Line 205  main (int argc, char **argv)
205            break;            break;
206                        
207          case 'l':          case 'l':
208            if (is_root == false)            if (!is_root)
209              {              {
210                fprintf (stderr, "ping: option not allowed: --preload\n");                fprintf (stderr, "ping: option not allowed: --preload\n");
211                exit (1);                exit (1);
# Line 332  ping_run (PING *ping, int (*finish)()) Line 351  ping_run (PING *ping, int (*finish)())
351        intvl.tv_usec = 10000;        intvl.tv_usec = 10000;
352      }      }
353    else    else
354      {      PING_SET_INTERVAL(intvl, ping->ping_interval);
       intvl.tv_sec = ping->ping_interval;  
       intvl.tv_usec = 0;  
     }  
355        
356    gettimeofday (&last, NULL);    gettimeofday (&last, NULL);
357    send_echo (ping);    send_echo (ping);

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26