SCCS-vsn: sbin/ping/ping.c 5.2
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ping.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)ping.c 5.2 (Berkeley) %G%";
u_long inet_addr();
char *inet_ntoa(), *pr_addr();
u_long inet_addr();
char *inet_ntoa(), *pr_addr();
-int catcher(), finish(), prefinish();
+int catcher(), finish();
main(argc, argv)
int argc;
main(argc, argv)
int argc;
else
(void)printf("PING %s: %d data bytes\n", hostname, datalen);
else
(void)printf("PING %s: %d data bytes\n", hostname, datalen);
- (void)signal(SIGINT, prefinish);
+ (void)signal(SIGINT, finish);
(void)signal(SIGALRM, catcher);
while (preload--) /* fire off them quickies */
(void)signal(SIGALRM, catcher);
while (preload--) /* fire off them quickies */
out->tv_sec -= in->tv_sec;
}
out->tv_sec -= in->tv_sec;
}
-/*
- * prefinish --
- * On the first SIGINT, allow any outstanding packets to dribble in.
- */
-prefinish()
-{
- /* quit now if caught up or if remote is dead */
- if (!nreceived || nreceived >= ntransmitted)
- finish();
-
- /* do this only the 1st time, let the normal limit work */
- (void)signal(SIGINT, finish);
- npackets = ntransmitted + 1;
-}
/*
* finish --
* Print out statistics, and give up.
*/
finish()
{
/*
* finish --
* Print out statistics, and give up.
*/
finish()
{
+ (void)signal(SIGINT, SIG_IGN);
(void)putchar('\n');
(void)fflush(stdout);
(void)printf("--- %s ping statistics ---\n", hostname);
(void)putchar('\n');
(void)fflush(stdout);
(void)printf("--- %s ping statistics ---\n", hostname);