2 * Object oriented C module to send ICMP and ICMPv6 `echo's.
3 * Copyright (C) 2006-2010 Florian octo Forster <octo at verplant.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; only version 2 of the License is
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 # include <inttypes.h>
33 # error "You don't have the standard C99 header files installed"
34 #endif /* STDC_HEADERS */
44 #if TIME_WITH_SYS_TIME
45 # include <sys/time.h>
49 # include <sys/time.h>
56 # include <sys/socket.h>
59 # include <netinet/in.h>
62 # include <netinet/ip.h>
66 # include <netdb.h> /* NI_MAXHOST */
74 #include <sys/types.h>
78 # define NCURSES_OPAQUE 1
81 # define OPING_GREEN 1
82 # define OPING_YELLOW 2
88 #ifndef _POSIX_SAVED_IDS
89 # define _POSIX_SAVED_IDS 0
92 typedef struct ping_context
94 char host[NI_MAXHOST];
95 char addr[NI_MAXHOST];
103 double latency_total;
104 double latency_total_square;
111 static double opt_interval = 1.0;
112 static int opt_addrfamily = PING_DEF_AF;
113 static char *opt_srcaddr = NULL;
114 static char *opt_device = NULL;
115 static char *opt_filename = NULL;
116 static int opt_count = -1;
117 static int opt_send_ttl = 64;
118 static uint8_t opt_send_tos = 0;
120 static int host_num = 0;
123 static WINDOW *main_win = NULL;
126 static void sigint_handler (int signal) /* {{{ */
128 /* Make compiler happy */
132 } /* }}} void sigint_handler */
134 static ping_context_t *context_create (void) /* {{{ */
138 if ((ret = malloc (sizeof (ping_context_t))) == NULL)
141 memset (ret, '\0', sizeof (ping_context_t));
143 ret->latency_min = -1.0;
144 ret->latency_max = -1.0;
145 ret->latency_total = 0.0;
146 ret->latency_total_square = 0.0;
153 } /* }}} ping_context_t *context_create */
155 static void context_destroy (ping_context_t *context) /* {{{ */
161 if (context->window != NULL)
163 delwin (context->window);
164 context->window = NULL;
169 } /* }}} void context_destroy */
171 static double context_get_average (ping_context_t *ctx) /* {{{ */
178 if (ctx->req_rcvd < 1)
181 num_total = (double) ctx->req_rcvd;
182 return (ctx->latency_total / num_total);
183 } /* }}} double context_get_average */
185 static double context_get_stddev (ping_context_t *ctx) /* {{{ */
192 if (ctx->req_rcvd < 1)
194 else if (ctx->req_rcvd < 2)
197 num_total = (double) ctx->req_rcvd;
198 return (sqrt (((num_total * ctx->latency_total_square)
199 - (ctx->latency_total * ctx->latency_total))
200 / (num_total * (num_total - 1.0))));
201 } /* }}} double context_get_stddev */
203 static double context_get_packet_loss (const ping_context_t *ctx) /* {{{ */
208 if (ctx->req_sent < 1)
211 return (100.0 * (ctx->req_sent - ctx->req_rcvd)
212 / ((double) ctx->req_sent));
213 } /* }}} double context_get_packet_loss */
215 static int ping_initialize_contexts (pingobj_t *ping) /* {{{ */
217 pingobj_iter_t *iter;
224 for (iter = ping_iterator_get (ping);
226 iter = ping_iterator_next (iter))
228 ping_context_t *context;
231 context = context_create ();
232 context->index = index;
234 buffer_size = sizeof (context->host);
235 ping_iterator_get_info (iter, PING_INFO_HOSTNAME, context->host, &buffer_size);
237 buffer_size = sizeof (context->addr);
238 ping_iterator_get_info (iter, PING_INFO_ADDRESS, context->addr, &buffer_size);
240 ping_iterator_set_context (iter, (void *) context);
246 } /* }}} int ping_initialize_contexts */
248 static void usage_exit (const char *name, int status) /* {{{ */
252 name_length = (int) strlen (name);
254 fprintf (stderr, "Usage: %s [OPTIONS] "
255 "-f filename | host [host [host ...]]\n"
257 "\nAvailable options:\n"
258 " -4|-6 force the use of IPv4 or IPv6\n"
259 " -c count number of ICMP packets to send\n"
260 " -i interval interval with which to send ICMP packets\n"
261 " -t ttl time to live for each ICMP packet\n"
262 " -z tos Type-of-service/class-of-service for each ICMP packet\n"
263 " -I srcaddr source address\n"
264 " -D device outgoing interface name\n"
265 " -f filename filename to read hosts from\n"
267 "\noping "PACKAGE_VERSION", http://verplant.org/liboping/\n"
268 "by Florian octo Forster <octo@verplant.org>\n"
269 "for contributions see `AUTHORS'\n",
272 } /* }}} void usage_exit */
274 static void usage_tos_exit (const char *arg, int status) /* {{{ */
277 fprintf (stderr, "Invalid ToS argument: \"%s\"\n\n", arg);
279 fprintf (stderr, "Valid ToS arguments (option \"-z\") are:\n"
281 " lowdelay (%#04x) minimize delays\n"
282 " throughput (%#04x) optimize throughput\n"
283 " reliability (%#04x) optimize reliability\n"
284 " mincost (%#04x) minimize cost\n"
285 " 0x00 - 0xff specify manually\n"
287 (unsigned int) IPTOS_LOWDELAY,
288 (unsigned int) IPTOS_THROUGHPUT,
289 (unsigned int) IPTOS_RELIABILITY,
290 (unsigned int) IPTOS_MINCOST);
293 } /* }}} void usage_tos_exit */
295 static int set_opt_send_tos (const char *opt) /* {{{ */
300 if (strcasecmp ("lowdelay", opt) == 0)
301 opt_send_tos = IPTOS_LOWDELAY;
302 else if (strcasecmp ("throughput", opt) == 0)
303 opt_send_tos = IPTOS_THROUGHPUT;
304 else if (strcasecmp ("reliability", opt) == 0)
305 opt_send_tos = IPTOS_RELIABILITY;
306 else if (strcasecmp ("mincost", opt) == 0)
307 opt_send_tos = IPTOS_MINCOST;
308 else if (strcasecmp ("help", opt) == 0)
309 usage_tos_exit (/* arg = */ NULL, /* status = */ EXIT_SUCCESS);
317 value = strtoul (opt, &endptr, /* base = */ 0);
318 if ((errno != 0) || (endptr == opt)
319 || (endptr == NULL) || (*endptr != 0)
321 usage_tos_exit (/* arg = */ opt, /* status = */ EXIT_FAILURE);
323 opt_send_tos = (uint8_t) value;
327 } /* }}} int set_opt_send_tos */
329 static int read_options (int argc, char **argv) /* {{{ */
335 optchar = getopt (argc, argv, "46c:hi:I:t:z:f:D:");
344 opt_addrfamily = (optchar == '4') ? AF_INET : AF_INET6;
350 new_count = atoi (optarg);
352 opt_count = new_count;
354 fprintf(stderr, "Ignoring invalid count: %s\n",
361 if (opt_filename != NULL)
363 opt_filename = strdup (optarg);
370 new_interval = atof (optarg);
371 if (new_interval < 0.001)
372 fprintf (stderr, "Ignoring invalid interval: %s\n",
375 opt_interval = new_interval;
380 if (opt_srcaddr != NULL)
382 opt_srcaddr = strdup (optarg);
393 new_send_ttl = atoi (optarg);
394 if ((new_send_ttl > 0) && (new_send_ttl < 256))
395 opt_send_ttl = new_send_ttl;
397 fprintf (stderr, "Ignoring invalid TTL argument: %s\n",
403 set_opt_send_tos (optarg);
407 usage_exit (argv[0], 0);
410 usage_exit (argv[0], 1);
415 } /* }}} read_options */
417 static void time_normalize (struct timespec *ts) /* {{{ */
419 while (ts->tv_nsec < 0)
428 ts->tv_nsec += 1000000000;
431 while (ts->tv_nsec >= 1000000000)
434 ts->tv_nsec -= 1000000000;
436 } /* }}} void time_normalize */
438 static void time_calc (struct timespec *ts_dest, /* {{{ */
439 const struct timespec *ts_int,
440 const struct timeval *tv_begin,
441 const struct timeval *tv_end)
443 ts_dest->tv_sec = tv_begin->tv_sec + ts_int->tv_sec;
444 ts_dest->tv_nsec = (tv_begin->tv_usec * 1000) + ts_int->tv_nsec;
445 time_normalize (ts_dest);
447 /* Assure that `(begin + interval) > end'.
448 * This may seem overly complicated, but `tv_sec' is of type `time_t'
449 * which may be `unsigned. *sigh* */
450 if ((tv_end->tv_sec > ts_dest->tv_sec)
451 || ((tv_end->tv_sec == ts_dest->tv_sec)
452 && ((tv_end->tv_usec * 1000) > ts_dest->tv_nsec)))
455 ts_dest->tv_nsec = 0;
459 ts_dest->tv_sec = ts_dest->tv_sec - tv_end->tv_sec;
460 ts_dest->tv_nsec = ts_dest->tv_nsec - (tv_end->tv_usec * 1000);
461 time_normalize (ts_dest);
462 } /* }}} void time_calc */
465 static int update_stats_from_context (ping_context_t *ctx) /* {{{ */
467 if ((ctx == NULL) || (ctx->window == NULL))
470 werase (ctx->window);
472 box (ctx->window, 0, 0);
473 wattron (ctx->window, A_BOLD);
474 mvwprintw (ctx->window, /* y = */ 0, /* x = */ 5,
476 wattroff (ctx->window, A_BOLD);
477 wprintw (ctx->window, "ping statistics ");
478 mvwprintw (ctx->window, /* y = */ 1, /* x = */ 2,
479 "%i packets transmitted, %i received, %.2f%% packet "
481 ctx->req_sent, ctx->req_rcvd,
482 context_get_packet_loss (ctx),
484 if (ctx->req_rcvd != 0)
489 average = context_get_average (ctx);
490 deviation = context_get_stddev (ctx);
492 mvwprintw (ctx->window, /* y = */ 2, /* x = */ 2,
493 "rtt min/avg/max/sdev = %.3f/%.3f/%.3f/%.3f ms",
500 wrefresh (ctx->window);
503 } /* }}} int update_stats_from_context */
505 static int on_resize (pingobj_t *ping) /* {{{ */
507 pingobj_iter_t *iter;
512 getmaxyx (stdscr, height, width);
513 if ((height < 1) || (width < 1))
516 main_win_height = height - (4 * host_num);
517 wresize (main_win, main_win_height, /* width = */ width);
518 /* Allow scrolling */
519 scrollok (main_win, TRUE);
520 /* wsetscrreg (main_win, 0, main_win_height - 1); */
521 /* Allow hardware accelerated scrolling. */
522 idlok (main_win, TRUE);
525 for (iter = ping_iterator_get (ping);
527 iter = ping_iterator_next (iter))
529 ping_context_t *context;
531 context = ping_iterator_get_context (iter);
535 if (context->window != NULL)
537 delwin (context->window);
538 context->window = NULL;
540 context->window = newwin (/* height = */ 4,
542 /* y = */ main_win_height + (4 * context->index),
549 static int check_resize (pingobj_t *ping) /* {{{ */
555 int key = wgetch (stdscr);
558 else if (key == KEY_RESIZE)
563 return (on_resize (ping));
566 } /* }}} int check_resize */
568 static int pre_loop_hook (pingobj_t *ping) /* {{{ */
570 pingobj_iter_t *iter;
578 nodelay (stdscr, TRUE);
580 getmaxyx (stdscr, height, width);
581 if ((height < 1) || (width < 1))
584 if (has_colors () == TRUE)
587 init_pair (OPING_GREEN, COLOR_GREEN, /* default = */ 0);
588 init_pair (OPING_YELLOW, COLOR_YELLOW, /* default = */ 0);
589 init_pair (OPING_RED, COLOR_RED, /* default = */ 0);
592 main_win_height = height - (4 * host_num);
593 main_win = newwin (/* height = */ main_win_height,
595 /* y = */ 0, /* x = */ 0);
596 /* Allow scrolling */
597 scrollok (main_win, TRUE);
598 /* wsetscrreg (main_win, 0, main_win_height - 1); */
599 /* Allow hardware accelerated scrolling. */
600 idlok (main_win, TRUE);
601 wmove (main_win, /* y = */ main_win_height - 1, /* x = */ 0);
604 for (iter = ping_iterator_get (ping);
606 iter = ping_iterator_next (iter))
608 ping_context_t *context;
610 context = ping_iterator_get_context (iter);
614 if (context->window != NULL)
616 delwin (context->window);
617 context->window = NULL;
619 context->window = newwin (/* height = */ 4,
621 /* y = */ main_win_height + (4 * context->index),
626 /* Don't know what good this does exactly, but without this code
627 * "check_resize" will be called right after startup and *somehow*
628 * this leads to display errors. If we purge all initial characters
629 * here, the problem goes away. "wgetch" is non-blocking due to
630 * "nodelay" (see above). */
631 while (wgetch (stdscr) != ERR)
633 /* eat up characters */;
637 } /* }}} int pre_loop_hook */
639 static int pre_sleep_hook (pingobj_t *ping) /* {{{ */
641 return (check_resize (ping));
642 } /* }}} int pre_sleep_hook */
644 static int post_sleep_hook (pingobj_t *ping) /* {{{ */
646 return (check_resize (ping));
647 } /* }}} int pre_sleep_hook */
648 #else /* if !USE_NCURSES */
649 static int pre_loop_hook (pingobj_t *ping) /* {{{ */
651 pingobj_iter_t *iter;
653 for (iter = ping_iterator_get (ping);
655 iter = ping_iterator_next (iter))
660 ctx = ping_iterator_get_context (iter);
665 ping_iterator_get_info (iter, PING_INFO_DATA, NULL, &buffer_size);
667 printf ("PING %s (%s) %zu bytes of data.\n",
668 ctx->host, ctx->addr, buffer_size);
672 } /* }}} int pre_loop_hook */
674 static int pre_sleep_hook (__attribute__((unused)) pingobj_t *ping) /* {{{ */
679 } /* }}} int pre_sleep_hook */
681 static int post_sleep_hook (__attribute__((unused)) pingobj_t *ping) /* {{{ */
684 } /* }}} int post_sleep_hook */
687 static void update_host_hook (pingobj_iter_t *iter, /* {{{ */
691 unsigned int sequence;
696 ping_context_t *context;
699 buffer_len = sizeof (latency);
700 ping_iterator_get_info (iter, PING_INFO_LATENCY,
701 &latency, &buffer_len);
704 buffer_len = sizeof (sequence);
705 ping_iterator_get_info (iter, PING_INFO_SEQUENCE,
706 &sequence, &buffer_len);
709 buffer_len = sizeof (recv_ttl);
710 ping_iterator_get_info (iter, PING_INFO_RECV_TTL,
711 &recv_ttl, &buffer_len);
714 buffer_len = sizeof (recv_tos);
715 ping_iterator_get_info (iter, PING_INFO_RECV_TOS,
716 &recv_tos, &buffer_len);
719 ping_iterator_get_info (iter, PING_INFO_DATA,
722 context = (ping_context_t *) ping_iterator_get_context (iter);
725 # define HOST_PRINTF(...) wprintw(main_win, __VA_ARGS__)
727 # define HOST_PRINTF(...) printf(__VA_ARGS__)
734 context->latency_total += latency;
735 context->latency_total_square += (latency * latency);
737 if ((context->latency_max < 0.0) || (context->latency_max < latency))
738 context->latency_max = latency;
739 if ((context->latency_min < 0.0) || (context->latency_min > latency))
740 context->latency_min = latency;
743 if (has_colors () == TRUE)
745 int color = OPING_GREEN;
746 double average = context_get_average (context);
747 double stddev = context_get_stddev (context);
749 if ((latency < (average - (2 * stddev)))
750 || (latency > (average + (2 * stddev))))
752 else if ((latency < (average - stddev))
753 || (latency > (average + stddev)))
754 color = OPING_YELLOW;
756 HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i tos=0x%02"PRIx8
758 data_len, context->host, context->addr,
759 sequence, recv_ttl, recv_tos);
760 wattron (main_win, COLOR_PAIR(color));
761 HOST_PRINTF ("%.2f", latency);
762 wattroff (main_win, COLOR_PAIR(color));
763 HOST_PRINTF (" ms\n");
768 HOST_PRINTF ("%zu bytes from %s (%s): icmp_seq=%u ttl=%i tos=0x%02"PRIx8
771 context->host, context->addr,
772 sequence, recv_ttl, recv_tos, latency);
780 if (has_colors () == TRUE)
782 HOST_PRINTF ("echo reply from %s (%s): icmp_seq=%u ",
783 context->host, context->addr,
785 wattron (main_win, COLOR_PAIR(OPING_RED) | A_BOLD);
786 HOST_PRINTF ("timeout");
787 wattroff (main_win, COLOR_PAIR(OPING_RED) | A_BOLD);
793 HOST_PRINTF ("echo reply from %s (%s): icmp_seq=%u timeout\n",
794 context->host, context->addr,
802 update_stats_from_context (context);
805 } /* }}} void update_host_hook */
807 static int post_loop_hook (pingobj_t *ping) /* {{{ */
809 pingobj_iter_t *iter;
815 for (iter = ping_iterator_get (ping);
817 iter = ping_iterator_next (iter))
819 ping_context_t *context;
821 context = ping_iterator_get_context (iter);
823 printf ("\n--- %s ping statistics ---\n"
824 "%i packets transmitted, %i received, %.2f%% packet loss, time %.1fms\n",
825 context->host, context->req_sent, context->req_rcvd,
826 context_get_packet_loss (context),
827 context->latency_total);
829 if (context->req_rcvd != 0)
834 average = context_get_average (context);
835 deviation = context_get_stddev (context);
837 printf ("rtt min/avg/max/sdev = %.3f/%.3f/%.3f/%.3f ms\n",
838 context->latency_min,
840 context->latency_max,
844 ping_iterator_set_context (iter, NULL);
845 context_destroy (context);
849 } /* }}} int post_loop_hook */
851 int main (int argc, char **argv) /* {{{ */
854 pingobj_iter_t *iter;
856 struct sigaction sigint_action;
858 struct timeval tv_begin;
859 struct timeval tv_end;
860 struct timespec ts_wait;
861 struct timespec ts_int;
869 /* Save the old effective user id */
870 saved_set_uid = geteuid ();
871 /* Set the effective user ID to the real user ID without changing the
872 * saved set-user ID */
873 status = seteuid (getuid ());
876 fprintf (stderr, "Temporarily dropping privileges "
877 "failed: %s\n", strerror (errno));
882 optind = read_options (argc, argv);
884 #if !_POSIX_SAVED_IDS
885 /* Cannot temporarily drop privileges -> reject every file but "-". */
886 if ((opt_filename != NULL)
887 && (strcmp ("-", opt_filename) != 0)
888 && (getuid () != geteuid ()))
890 fprintf (stderr, "Your real and effective user IDs don't "
891 "match. Reading from a file (option '-f')\n"
892 "is therefore too risky. You can still read "
893 "from STDIN using '-f -' if you like.\n"
899 if ((optind >= argc) && (opt_filename == NULL)) {
900 usage_exit (argv[0], 1);
903 if ((ping = ping_construct ()) == NULL)
905 fprintf (stderr, "ping_construct failed\n");
909 if (ping_setopt (ping, PING_OPT_TTL, &opt_send_ttl) != 0)
911 fprintf (stderr, "Setting TTL to %i failed: %s\n",
912 opt_send_ttl, ping_get_error (ping));
915 if (ping_setopt (ping, PING_OPT_TOS, &opt_send_tos) != 0)
917 fprintf (stderr, "Setting TOS to %i failed: %s\n",
918 opt_send_tos, ping_get_error (ping));
925 temp_nsec = modf (opt_interval, &temp_sec);
926 ts_int.tv_sec = (time_t) temp_sec;
927 ts_int.tv_nsec = (long) (temp_nsec * 1000000000L);
929 /* printf ("ts_int = %i.%09li\n", (int) ts_int.tv_sec, ts_int.tv_nsec); */
932 if (opt_addrfamily != PING_DEF_AF)
933 ping_setopt (ping, PING_OPT_AF, (void *) &opt_addrfamily);
935 if (opt_srcaddr != NULL)
937 if (ping_setopt (ping, PING_OPT_SOURCE, (void *) opt_srcaddr) != 0)
939 fprintf (stderr, "Setting source address failed: %s\n",
940 ping_get_error (ping));
944 if (opt_device != NULL)
946 if (ping_setopt (ping, PING_OPT_DEVICE, (void *) opt_device) != 0)
948 fprintf (stderr, "Setting device failed: %s\n",
949 ping_get_error (ping));
953 if (opt_filename != NULL)
959 if (strcmp (opt_filename, "-") == 0)
961 infile = fdopen(0, "r");
963 infile = fopen(opt_filename, "r");
967 fprintf (stderr, "Opening %s failed: %s\n",
968 (strcmp (opt_filename, "-") == 0)
969 ? "STDIN" : opt_filename,
975 /* Regain privileges */
976 status = seteuid (saved_set_uid);
979 fprintf (stderr, "Temporarily re-gaining privileges "
980 "failed: %s\n", strerror (errno));
985 while (fgets(line, sizeof(line), infile))
987 /* Strip whitespace */
988 if (sscanf(line, "%s", host) != 1)
991 if ((host[0] == 0) || (host[0] == '#'))
994 if (ping_host_add(ping, host) < 0)
996 const char *errmsg = ping_get_error (ping);
998 fprintf (stderr, "Adding host `%s' failed: %s\n", host, errmsg);
1007 #if _POSIX_SAVED_IDS
1008 /* Drop privileges */
1009 status = seteuid (getuid ());
1012 fprintf (stderr, "Temporarily dropping privileges "
1013 "failed: %s\n", strerror (errno));
1014 exit (EXIT_FAILURE);
1021 #if _POSIX_SAVED_IDS
1022 /* Regain privileges */
1023 status = seteuid (saved_set_uid);
1026 fprintf (stderr, "Temporarily re-gaining privileges "
1027 "failed: %s\n", strerror (errno));
1028 exit (EXIT_FAILURE);
1032 for (i = optind; i < argc; i++)
1034 if (ping_host_add (ping, argv[i]) < 0)
1036 const char *errmsg = ping_get_error (ping);
1038 fprintf (stderr, "Adding host `%s' failed: %s\n", argv[i], errmsg);
1047 /* Permanently drop root privileges if we're setuid-root. */
1048 status = setuid (getuid ());
1051 fprintf (stderr, "Dropping privileges failed: %s\n",
1053 exit (EXIT_FAILURE);
1056 #if _POSIX_SAVED_IDS
1057 saved_set_uid = (uid_t) -1;
1060 ping_initialize_contexts (ping);
1065 memset (&sigint_action, '\0', sizeof (sigint_action));
1066 sigint_action.sa_handler = sigint_handler;
1067 if (sigaction (SIGINT, &sigint_action, NULL) < 0)
1069 perror ("sigaction");
1073 pre_loop_hook (ping);
1075 while (opt_count != 0)
1080 if (gettimeofday (&tv_begin, NULL) < 0)
1082 perror ("gettimeofday");
1086 if (ping_send (ping) < 0)
1088 fprintf (stderr, "ping_send failed: %s\n",
1089 ping_get_error (ping));
1094 for (iter = ping_iterator_get (ping);
1096 iter = ping_iterator_next (iter))
1098 update_host_hook (iter, index);
1102 pre_sleep_hook (ping);
1104 /* Don't sleep in the last iteration */
1108 if (gettimeofday (&tv_end, NULL) < 0)
1110 perror ("gettimeofday");
1114 time_calc (&ts_wait, &ts_int, &tv_begin, &tv_end);
1116 /* printf ("Sleeping for %i.%09li seconds\n", (int) ts_wait.tv_sec, ts_wait.tv_nsec); */
1117 while ((status = nanosleep (&ts_wait, &ts_wait)) != 0)
1121 perror ("nanosleep");
1124 else if (opt_count == 0)
1131 post_sleep_hook (ping);
1135 } /* while (opt_count != 0) */
1137 post_loop_hook (ping);
1139 ping_destroy (ping);
1142 } /* }}} int main */
1144 /* vim: set fdm=marker : */