- coalesce printf calls.

text    data     bss     dec     hex filename
   3474       4      96    3574     df6 networking/arping.o.orig
   3424       4      96    3524     dc4 networking/arping.o
This commit is contained in:
Bernhard Reutner-Fischer 2006-04-03 12:29:12 +00:00
parent a0f75e2bba
commit ebd1355828

View File

@ -112,8 +112,10 @@ static int send_pack(int sock, struct in_addr *src_addr,
static void finish(void) static void finish(void)
{ {
if (!(cfg&quiet)) { if (!(cfg&quiet)) {
printf("Sent %d probes (%d broadcast(s))\n", sent, brd_sent); printf("Sent %d probes (%d broadcast(s))\n"
printf("Received %d repl%s", received, (received > 1) ? "ies" : "y"); "Received %d repl%s",
sent, brd_sent,
received, (received > 1) ? "ies" : "y");
if (brd_recv || req_recv) { if (brd_recv || req_recv) {
printf(" ("); printf(" (");
if (req_recv) if (req_recv)
@ -221,12 +223,11 @@ static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
printf("%s ", printf("%s %s from %s [%s]",
FROM->sll_pkttype == PACKET_HOST ? "Unicast" : "Broadcast"); FROM->sll_pkttype == PACKET_HOST ? "Unicast" : "Broadcast",
printf("%s from ", ah->ar_op == htons(ARPOP_REPLY) ? "reply" : "request",
ah->ar_op == htons(ARPOP_REPLY) ? "reply" : "request"); inet_ntoa(src_ip),
printf("%s ", inet_ntoa(src_ip)); ether_ntoa((struct ether_addr *) p));
printf("[%s]", ether_ntoa((struct ether_addr *) p));
if (dst_ip.s_addr != src.s_addr) { if (dst_ip.s_addr != src.s_addr) {
printf("for %s ", inet_ntoa(dst_ip)); printf("for %s ", inet_ntoa(dst_ip));
s_printed = 1; s_printed = 1;
@ -421,8 +422,8 @@ int arping_main(int argc, char **argv)
memset(he.sll_addr, -1, he.sll_halen); memset(he.sll_addr, -1, he.sll_halen);
if (!(cfg&quiet)) { if (!(cfg&quiet)) {
printf("ARPING to %s", inet_ntoa(dst)); printf("ARPING to %s from %s via %s\n",
printf(" from %s via %s\n", inet_ntoa(src), inet_ntoa(dst), inet_ntoa(src),
device ? device : "unknown"); device ? device : "unknown");
} }