/*
 * Infinite loop to receive every ICMP packet received on the socket.
 * For every packet that's received, we just call pr_pack() to look
 * at it and print it.
 */

#include	"defs.h"

#include <clib/exec_protos.h>
#include <libraries/dos.h>

void recv_ping()
{
	register int		n;
	long			fromlen;
	struct sockaddr_in	from;

	for ( ; ; ) {
		fromlen = sizeof(from);
		if ( (n = recvfrom(sockfd, recvpack, sizeof(recvpack), 0,
				(struct sockaddr *) &from, &fromlen)) < 0) {
			if (errno == EINTR)
				continue;	/* normal */
			err_ret("recvfrom error");
			continue;
		}

		if (SetSignal (0, 0) & SIGBREAKF_CTRL_C)
                	return;

		pr_pack(recvpack, n, &from);

	}
}
