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 |
|
|
|
static size_t |
|
|
ping_cvt_number (const char *optarg, size_t maxval, int allow_zero) |
|
|
{ |
|
|
char *p; |
|
|
size_t n; |
|
|
|
|
|
n = strtoul (optarg, &p, 0); |
|
|
if (*p) |
|
|
{ |
|
|
fprintf (stderr, "Invalid value (`%s' near `%s')\n", optarg, p); |
|
|
exit (1); |
|
|
} |
|
|
if (n == 0 && !allow_zero) |
|
|
{ |
|
|
fprintf (stderr, "Option value too small: %s\n", optarg); |
|
|
exit (1); |
|
|
} |
|
|
if (maxval && n > maxval) |
|
|
{ |
|
|
fprintf (stderr, "Option value too big: %s\n", optarg); |
|
|
exit (1); |
|
|
} |
|
|
return n; |
|
|
} |
|
|
|
|
102 |
int |
int |
103 |
main (int argc, char **argv) |
main (int argc, char **argv) |
104 |
{ |
{ |