summaryrefslogtreecommitdiffhomepage
path: root/networking/ping.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-03-20 11:59:28 +0000
committerEric Andersen <andersen@codepoet.org>2002-03-20 11:59:28 +0000
commitb5474c48b158f4a7d60f4b4faa40129c7eda6e9f (patch)
treebcf069e666c98d99d6ef7527d8171c0334501ceb /networking/ping.c
parentb159146fa6bbc779c5d9f01e3058cd0a9a6f2e8f (diff)
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.c15
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 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.48 2002/02/01 16:54:00 kraai Exp $
+ * $Id: ping.c,v 1.49 2002/03/20 11:59:28 andersen Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -175,6 +175,12 @@ static int in_cksum(unsigned short *buf, int sz)
/* simple version */
#ifndef CONFIG_FEATURE_FANCY_PING
+static char *hostname = NULL;
+void noresp(int ign)
+{
+ printf("No response from %s\n", h->h_name);
+ exit(0);
+}
static void ping(const char *host)
{
@@ -184,12 +190,6 @@ static void ping(const char *host)
int pingsock, c;
char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
- void noresp(int ign)
- {
- printf("No response from %s\n", h->h_name);
- exit(0);
- }
-
pingsock = create_icmp_socket();
memset(&pingaddr, 0, sizeof(struct sockaddr_in));
@@ -197,6 +197,7 @@ static void ping(const char *host)
pingaddr.sin_family = AF_INET;
h = xgethostbyname(host);
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
+ hostname = h->h_name;
pkt = (struct icmp *) packet;
memset(pkt, 0, sizeof(packet));