aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/hostname.c4
-rw-r--r--networking/nc.c2
-rw-r--r--networking/ping.c18
-rw-r--r--networking/telnet.c6
-rw-r--r--networking/wget.c30
5 files changed, 30 insertions, 30 deletions
diff --git a/networking/hostname.c b/networking/hostname.c
index 44d529c83..13e52c41d 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: hostname.c,v 1.15 2000/10/12 22:30:31 andersen Exp $ 3 * $Id: hostname.c,v 1.16 2000/12/07 19:56:48 markw Exp $
4 * Mini hostname implementation for busybox 4 * Mini hostname implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -40,7 +40,7 @@ void do_sethostname(char *s, int isfile)
40 if (!isfile) { 40 if (!isfile) {
41 if (sethostname(s, strlen(s)) < 0) { 41 if (sethostname(s, strlen(s)) < 0) {
42 if (errno == EPERM) 42 if (errno == EPERM)
43 errorMsg("you must be root to change the hostname\n"); 43 error_msg("you must be root to change the hostname\n");
44 else 44 else
45 perror("sethostname"); 45 perror("sethostname");
46 exit(1); 46 exit(1);
diff --git a/networking/nc.c b/networking/nc.c
index fcacb0c45..805bbd4d8 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -63,7 +63,7 @@ int nc_main(int argc, char **argv)
63 hostinfo = (struct hostent *) gethostbyname(*argv); 63 hostinfo = (struct hostent *) gethostbyname(*argv);
64 64
65 if (!hostinfo) { 65 if (!hostinfo) {
66 fatalError("cannot resolve %s\n", *argv); 66 error_msg_and_die("cannot resolve %s\n", *argv);
67 } 67 }
68 68
69 address.sin_family = AF_INET; 69 address.sin_family = AF_INET;
diff --git a/networking/ping.c b/networking/ping.c
index af109cf0a..ccc535b26 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.27 2000/12/01 02:55:13 kraai Exp $ 3 * $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -202,7 +202,7 @@ static void ping(const char *host)
202 202
203 pingaddr.sin_family = AF_INET; 203 pingaddr.sin_family = AF_INET;
204 if (!(h = gethostbyname(host))) { 204 if (!(h = gethostbyname(host))) {
205 errorMsg("unknown host %s\n", host); 205 error_msg("unknown host %s\n", host);
206 exit(1); 206 exit(1);
207 } 207 }
208 memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); 208 memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
@@ -219,7 +219,7 @@ static void ping(const char *host)
219 if (c < 0 || c != sizeof(packet)) { 219 if (c < 0 || c != sizeof(packet)) {
220 if (c < 0) 220 if (c < 0)
221 perror("ping: sendto"); 221 perror("ping: sendto");
222 errorMsg("write incomplete\n"); 222 error_msg("write incomplete\n");
223 exit(1); 223 exit(1);
224 } 224 }
225 225
@@ -325,9 +325,9 @@ static void sendping(int junk)
325 (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); 325 (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
326 326
327 if (i < 0) 327 if (i < 0)
328 fatalError("sendto: %s\n", strerror(errno)); 328 error_msg_and_die("sendto: %s\n", strerror(errno));
329 else if ((size_t)i != sizeof(packet)) 329 else if ((size_t)i != sizeof(packet))
330 fatalError("ping wrote %d chars; %d expected\n", i, 330 error_msg_and_die("ping wrote %d chars; %d expected\n", i,
331 (int)sizeof(packet)); 331 (int)sizeof(packet));
332 332
333 signal(SIGALRM, sendping); 333 signal(SIGALRM, sendping);
@@ -422,7 +422,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
422 printf("\n"); 422 printf("\n");
423 } else 423 } else
424 if (icmppkt->icmp_type != ICMP_ECHO) 424 if (icmppkt->icmp_type != ICMP_ECHO)
425 errorMsg("Warning: Got ICMP %d (%s)\n", 425 error_msg("Warning: Got ICMP %d (%s)\n",
426 icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); 426 icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
427} 427}
428 428
@@ -440,7 +440,7 @@ static void ping(const char *host)
440 if ((pingsock = socket(AF_INET, SOCK_RAW, 440 if ((pingsock = socket(AF_INET, SOCK_RAW,
441 (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ 441 (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
442 if (errno == EPERM) { 442 if (errno == EPERM) {
443 errorMsg("permission denied. (are you root?)\n"); 443 error_msg("permission denied. (are you root?)\n");
444 } else { 444 } else {
445 perror("ping: creating a raw socket"); 445 perror("ping: creating a raw socket");
446 } 446 }
@@ -454,12 +454,12 @@ static void ping(const char *host)
454 454
455 pingaddr.sin_family = AF_INET; 455 pingaddr.sin_family = AF_INET;
456 if (!(h = gethostbyname(host))) { 456 if (!(h = gethostbyname(host))) {
457 errorMsg("unknown host %s\n", host); 457 error_msg("unknown host %s\n", host);
458 exit(1); 458 exit(1);
459 } 459 }
460 460
461 if (h->h_addrtype != AF_INET) { 461 if (h->h_addrtype != AF_INET) {
462 errorMsg("unknown address type; only AF_INET is currently supported.\n"); 462 error_msg("unknown address type; only AF_INET is currently supported.\n");
463 exit(1); 463 exit(1);
464 } 464 }
465 465
diff --git a/networking/telnet.c b/networking/telnet.c
index bfa964460..7a7bcfb9f 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -583,7 +583,7 @@ static int getport(char * p)
583 583
584 if ((unsigned)(port - 1 ) > 65534) 584 if ((unsigned)(port - 1 ) > 65534)
585 { 585 {
586 fatalError("%s: bad port number\n", p); 586 error_msg_and_die("%s: bad port number\n", p);
587 } 587 }
588 return port; 588 return port;
589} 589}
@@ -595,7 +595,7 @@ static struct in_addr getserver(char * host)
595 struct hostent * he; 595 struct hostent * he;
596 if ((he = gethostbyname(host)) == NULL) 596 if ((he = gethostbyname(host)) == NULL)
597 { 597 {
598 fatalError("%s: Unknown host\n", host); 598 error_msg_and_die("%s: Unknown host\n", host);
599 } 599 }
600 memcpy(&addr, he->h_addr, sizeof addr); 600 memcpy(&addr, he->h_addr, sizeof addr);
601 601
@@ -650,7 +650,7 @@ static int remote_connect(struct in_addr addr, int port)
650 650
651 if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0) 651 if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0)
652 { 652 {
653 fatalError("Unable to connect to remote host: %s\n", strerror(errno)); 653 error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno));
654 } 654 }
655 return s; 655 return s;
656} 656}
diff --git a/networking/wget.c b/networking/wget.c
index b43bbad62..0ec4dff19 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -100,7 +100,7 @@ int wget_main(int argc, char **argv)
100 100
101 101
102 if (do_continue && !fname_out) 102 if (do_continue && !fname_out)
103 fatalError("cannot specify continue (-c) without a filename (-O)\n"); 103 error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
104 /* 104 /*
105 * Parse url into components. 105 * Parse url into components.
106 */ 106 */
@@ -117,7 +117,7 @@ int wget_main(int argc, char **argv)
117 if (fname_out != (char *)1) { 117 if (fname_out != (char *)1) {
118 if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) 118 if ( (output=fopen(fname_out, (do_continue ? "a" : "w")))
119 == NULL) 119 == NULL)
120 fatalPerror("fopen(%s)", fname_out); 120 perror_msg_and_die("fopen(%s)", fname_out);
121 } else { 121 } else {
122 output = stdout; 122 output = stdout;
123 } 123 }
@@ -128,7 +128,7 @@ int wget_main(int argc, char **argv)
128 if (do_continue) { 128 if (do_continue) {
129 struct stat sbuf; 129 struct stat sbuf;
130 if (fstat(fileno(output), &sbuf) < 0) 130 if (fstat(fileno(output), &sbuf) < 0)
131 fatalError("fstat()"); 131 error_msg_and_die("fstat()");
132 if (sbuf.st_size > 0) 132 if (sbuf.st_size > 0)
133 beg_range = sbuf.st_size; 133 beg_range = sbuf.st_size;
134 else 134 else
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv)
147 * Retrieve HTTP response line and check for "200" status code. 147 * Retrieve HTTP response line and check for "200" status code.
148 */ 148 */
149 if (fgets(buf, sizeof(buf), sfp) == NULL) 149 if (fgets(buf, sizeof(buf), sfp) == NULL)
150 fatalError("no response from server\n"); 150 error_msg_and_die("no response from server\n");
151 for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) 151 for (s = buf ; *s != '\0' && !isspace(*s) ; ++s)
152 ; 152 ;
153 for ( ; isspace(*s) ; ++s) 153 for ( ; isspace(*s) ; ++s)
@@ -156,13 +156,13 @@ int wget_main(int argc, char **argv)
156 case 200: 156 case 200:
157 if (!do_continue) 157 if (!do_continue)
158 break; 158 break;
159 fatalError("server does not support ranges\n"); 159 error_msg_and_die("server does not support ranges\n");
160 case 206: 160 case 206:
161 if (do_continue) 161 if (do_continue)
162 break; 162 break;
163 /*FALLTHRU*/ 163 /*FALLTHRU*/
164 default: 164 default:
165 fatalError("server returned error: %s", buf); 165 error_msg_and_die("server returned error: %s", buf);
166 } 166 }
167 167
168 /* 168 /*
@@ -175,7 +175,7 @@ int wget_main(int argc, char **argv)
175 continue; 175 continue;
176 } 176 }
177 if (strcmp(buf, "transfer-encoding") == 0) { 177 if (strcmp(buf, "transfer-encoding") == 0) {
178 fatalError("server wants to do %s transfer encoding\n", s); 178 error_msg_and_die("server wants to do %s transfer encoding\n", s);
179 continue; 179 continue;
180 } 180 }
181 } 181 }
@@ -197,7 +197,7 @@ int wget_main(int argc, char **argv)
197 filesize -= n; 197 filesize -= n;
198 } 198 }
199 if (n == 0 && ferror(sfp)) 199 if (n == 0 && ferror(sfp))
200 fatalPerror("network read error"); 200 perror_msg_and_die("network read error");
201 201
202 exit(0); 202 exit(0);
203} 203}
@@ -211,7 +211,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path)
211 *uri_port = 80; 211 *uri_port = 80;
212 212
213 if (strncmp(url, "http://", 7) != 0) 213 if (strncmp(url, "http://", 7) != 0)
214 fatalError("not an http url: %s\n", url); 214 error_msg_and_die("not an http url: %s\n", url);
215 215
216 /* pull the host portion to the front of the buffer */ 216 /* pull the host portion to the front of the buffer */
217 for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) { 217 for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) {
@@ -240,7 +240,7 @@ FILE *open_socket(char *host, int port)
240 memzero(&sin, sizeof(sin)); 240 memzero(&sin, sizeof(sin));
241 sin.sin_family = AF_INET; 241 sin.sin_family = AF_INET;
242 if ((hp = (struct hostent *) gethostbyname(host)) == NULL) 242 if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
243 fatalError("cannot resolve %s\n", host); 243 error_msg_and_die("cannot resolve %s\n", host);
244 memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); 244 memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length);
245 sin.sin_port = htons(port); 245 sin.sin_port = htons(port);
246 246
@@ -248,11 +248,11 @@ FILE *open_socket(char *host, int port)
248 * Get the server onto a stdio stream. 248 * Get the server onto a stdio stream.
249 */ 249 */
250 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) 250 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
251 fatalPerror("socket()"); 251 perror_msg_and_die("socket()");
252 if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) 252 if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
253 fatalPerror("connect(%s)", host); 253 perror_msg_and_die("connect(%s)", host);
254 if ((fp = fdopen(fd, "r+")) == NULL) 254 if ((fp = fdopen(fd, "r+")) == NULL)
255 fatalPerror("fdopen()"); 255 perror_msg_and_die("fdopen()");
256 256
257 return fp; 257 return fp;
258} 258}
@@ -281,7 +281,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
281 281
282 /* verify we are at the end of the header name */ 282 /* verify we are at the end of the header name */
283 if (*s != ':') 283 if (*s != ':')
284 fatalError("bad header line: %s\n", buf); 284 error_msg_and_die("bad header line: %s\n", buf);
285 285
286 /* locate the start of the header value */ 286 /* locate the start of the header value */
287 for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) 287 for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
@@ -475,7 +475,7 @@ progressmeter(int flag)
475 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 475 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
476 * SUCH DAMAGE. 476 * SUCH DAMAGE.
477 * 477 *
478 * $Id: wget.c,v 1.9 2000/12/07 03:55:35 tausq Exp $ 478 * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $
479 */ 479 */
480 480
481 481