diff options
author | Matt Kraai | 2000-07-14 01:51:25 +0000 |
---|---|---|
committer | Matt Kraai | 2000-07-14 01:51:25 +0000 |
commit | d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb (patch) | |
tree | 62127f20fc07758e445d8c4e186306cbe83d77b1 /networking | |
parent | 4ac6cb534d78d63d7b0a206118c56bad7024b9f8 (diff) | |
download | busybox-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.zip busybox-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.gz |
Use errorMsg rather than fprintf.
Diffstat (limited to 'networking')
-rw-r--r-- | networking/hostname.c | 5 | ||||
-rw-r--r-- | networking/ping.c | 16 |
2 files changed, 9 insertions, 12 deletions
diff --git a/networking/hostname.c b/networking/hostname.c index e909138..60f66c0 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: hostname.c,v 1.10 2000/06/19 17:25:39 andersen Exp $ + * $Id: hostname.c,v 1.11 2000/07/14 01:51:25 kraai Exp $ * Mini hostname implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -55,8 +55,7 @@ void do_sethostname(char *s, int isfile) if (!isfile) { if (sethostname(s, strlen(s)) < 0) { if (errno == EPERM) - fprintf(stderr, - "hostname: you must be root to change the hostname\n"); + errorMsg("you must be root to change the hostname\n"); else perror("sethostname"); exit(1); diff --git a/networking/ping.c b/networking/ping.c index 0359abb..52cb07b 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $ + * $Id: ping.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -208,7 +208,7 @@ static void ping(const char *host) pingaddr.sin_family = AF_INET; if (!(h = gethostbyname(host))) { - fprintf(stderr, "ping: unknown host %s\n", host); + errorMsg("unknown host %s\n", host); exit(1); } memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); @@ -225,7 +225,7 @@ static void ping(const char *host) if (c < 0 || c != sizeof(packet)) { if (c < 0) perror("ping: sendto"); - fprintf(stderr, "ping: write incomplete\n"); + errorMsg("write incomplete\n"); exit(1); } @@ -433,8 +433,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) printf("\n"); } else if (icmppkt->icmp_type != ICMP_ECHO) - fprintf(stderr, - "Warning: Got ICMP %d (%s)\n", + errorMsg("Warning: Got ICMP %d (%s)\n", icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); } @@ -452,7 +451,7 @@ static void ping(const char *host) if ((pingsock = socket(AF_INET, SOCK_RAW, (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ if (errno == EPERM) { - fprintf(stderr, "ping: permission denied. (are you root?)\n"); + errorMsg("permission denied. (are you root?)\n"); } else { perror("ping: creating a raw socket"); } @@ -466,13 +465,12 @@ static void ping(const char *host) pingaddr.sin_family = AF_INET; if (!(h = gethostbyname(host))) { - fprintf(stderr, "ping: unknown host %s\n", host); + errorMsg("unknown host %s\n", host); exit(1); } if (h->h_addrtype != AF_INET) { - fprintf(stderr, - "ping: unknown address type; only AF_INET is currently supported.\n"); + errorMsg("unknown address type; only AF_INET is currently supported.\n"); exit(1); } |