diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-03-20 11:59:28 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-03-20 11:59:28 +0000 |
commit | b5474c48b158f4a7d60f4b4faa40129c7eda6e9f (patch) | |
tree | bcf069e666c98d99d6ef7527d8171c0334501ceb /networking/ping.c | |
parent | b159146fa6bbc779c5d9f01e3058cd0a9a6f2e8f (diff) | |
download | busybox-w32-b5474c48b158f4a7d60f4b4faa40129c7eda6e9f.tar.gz busybox-w32-b5474c48b158f4a7d60f4b4faa40129c7eda6e9f.tar.bz2 busybox-w32-b5474c48b158f4a7d60f4b4faa40129c7eda6e9f.zip |
Cave to pressure (2 months later). Eliminate using a
nested function, which is a purely unremovable gcc-ism...
-Erik
Diffstat (limited to 'networking/ping.c')
-rw-r--r-- | networking/ping.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/networking/ping.c b/networking/ping.c index eaaf91a04..82be07956 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.48 2002/02/01 16:54:00 kraai Exp $ | 3 | * $Id: ping.c,v 1.49 2002/03/20 11:59:28 andersen 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> |
@@ -175,6 +175,12 @@ static int in_cksum(unsigned short *buf, int sz) | |||
175 | 175 | ||
176 | /* simple version */ | 176 | /* simple version */ |
177 | #ifndef CONFIG_FEATURE_FANCY_PING | 177 | #ifndef CONFIG_FEATURE_FANCY_PING |
178 | static char *hostname = NULL; | ||
179 | void noresp(int ign) | ||
180 | { | ||
181 | printf("No response from %s\n", h->h_name); | ||
182 | exit(0); | ||
183 | } | ||
178 | 184 | ||
179 | static void ping(const char *host) | 185 | static void ping(const char *host) |
180 | { | 186 | { |
@@ -184,12 +190,6 @@ static void ping(const char *host) | |||
184 | int pingsock, c; | 190 | int pingsock, c; |
185 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; | 191 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; |
186 | 192 | ||
187 | void noresp(int ign) | ||
188 | { | ||
189 | printf("No response from %s\n", h->h_name); | ||
190 | exit(0); | ||
191 | } | ||
192 | |||
193 | pingsock = create_icmp_socket(); | 193 | pingsock = create_icmp_socket(); |
194 | 194 | ||
195 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); | 195 | memset(&pingaddr, 0, sizeof(struct sockaddr_in)); |
@@ -197,6 +197,7 @@ static void ping(const char *host) | |||
197 | pingaddr.sin_family = AF_INET; | 197 | pingaddr.sin_family = AF_INET; |
198 | h = xgethostbyname(host); | 198 | h = xgethostbyname(host); |
199 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); | 199 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); |
200 | hostname = h->h_name; | ||
200 | 201 | ||
201 | pkt = (struct icmp *) packet; | 202 | pkt = (struct icmp *) packet; |
202 | memset(pkt, 0, sizeof(packet)); | 203 | memset(pkt, 0, sizeof(packet)); |