exterminate u_intXXX.
fix ping6 buglet (memset is too short), minor sync between ping and ping6
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index e62975d..2c849eb 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -171,7 +171,7 @@
 	if (cmdedit_x >= num) {
 		cmdedit_x -= num;
 		if (num <= 4) {
-			do putchar('\b'); while (--num);
+			printf("\b\b\b\b" + (4-num));
 			return;
 		}
 		printf("\033[%uD", num);
@@ -183,7 +183,7 @@
 	count_y = 1 + (num / cmdedit_termw);
 	cmdedit_y -= count_y;
 	cmdedit_x = cmdedit_termw * count_y - num;
-	/* go to 1st col; go up; go to correct column */
+	/* go to 1st column; go up; go to correct column */
 	printf("\r" "\033[%dA" "\033[%dC", count_y, cmdedit_x);
 }
 
diff --git a/networking/inetd.c b/networking/inetd.c
index 218f85e..c1f9918 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1707,7 +1707,7 @@
  * some seventy years Bell Labs was asleep.
  */
 
-static u_int machtime(void)
+static unsigned machtime(void)
 {
 	struct timeval tv;
 
@@ -1715,14 +1715,14 @@
 		fprintf(stderr, "Unable to get time of day\n");
 		return 0L;
 	}
-	return htonl((u_int) tv.tv_sec + 2208988800UL);
+	return htonl((unsigned) tv.tv_sec + 2208988800UL);
 }
 
 /* ARGSUSED */
 static void
 machtime_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
 {
-	u_int result;
+	unsigned result;
 
 	result = machtime();
 	(void) write(s, (char *) &result, sizeof(result));
@@ -1732,7 +1732,7 @@
 static void
 machtime_dg(int s, servtab_t *sep ATTRIBUTE_UNUSED)
 {
-	u_int result;
+	unsigned result;
 	/* struct sockaddr_storage ss; */
 	struct sockaddr sa;
 	struct sockaddr_in *dg_sin;
diff --git a/networking/ping.c b/networking/ping.c
index 12730be..d8a7033 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,13 +1,15 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: ping.c,v 1.56 2004/03/15 08:28:48 andersen Exp $
  * Mini ping implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
  *
  * Adapted from the ping in netkit-base 0.10:
  * Copyright (c) 1989 The Regents of the University of California.
- * Derived from software contributed to Berkeley by Mike Muuss.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Mike Muuss.
  *
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
@@ -74,7 +76,7 @@
 
 	pingsock = create_icmp_socket();
 
-	memset(&pingaddr, 0, sizeof(struct sockaddr_in));
+	memset(&pingaddr, 0, sizeof(pingaddr));
 
 	pingaddr.sin_family = AF_INET;
 	h = xgethostbyname(host);
@@ -202,7 +204,7 @@
 	pkt->icmp_cksum = 0;
 	pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */
 	pkt->icmp_id = myid;
-	CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK);
+	CLR((uint16_t)ntransmitted % MAX_DUP_CHK);
 	ntransmitted++;
 
 	gettimeofday((struct timeval *) &pkt->icmp_dun, NULL);
@@ -230,20 +232,20 @@
 static char *icmp_type_name(int id)
 {
 	switch (id) {
-	case ICMP_ECHOREPLY:		return "Echo Reply";
-	case ICMP_DEST_UNREACH:		return "Destination Unreachable";
-	case ICMP_SOURCE_QUENCH:	return "Source Quench";
-	case ICMP_REDIRECT:			return "Redirect (change route)";
-	case ICMP_ECHO:				return "Echo Request";
-	case ICMP_TIME_EXCEEDED:	return "Time Exceeded";
-	case ICMP_PARAMETERPROB:	return "Parameter Problem";
-	case ICMP_TIMESTAMP:		return "Timestamp Request";
-	case ICMP_TIMESTAMPREPLY:	return "Timestamp Reply";
-	case ICMP_INFO_REQUEST:		return "Information Request";
-	case ICMP_INFO_REPLY:		return "Information Reply";
-	case ICMP_ADDRESS:			return "Address Mask Request";
-	case ICMP_ADDRESSREPLY:		return "Address Mask Reply";
-	default:					return "unknown ICMP type";
+	case ICMP_ECHOREPLY:      return "Echo Reply";
+	case ICMP_DEST_UNREACH:   return "Destination Unreachable";
+	case ICMP_SOURCE_QUENCH:  return "Source Quench";
+	case ICMP_REDIRECT:       return "Redirect (change route)";
+	case ICMP_ECHO:           return "Echo Request";
+	case ICMP_TIME_EXCEEDED:  return "Time Exceeded";
+	case ICMP_PARAMETERPROB:  return "Parameter Problem";
+	case ICMP_TIMESTAMP:      return "Timestamp Request";
+	case ICMP_TIMESTAMPREPLY: return "Timestamp Reply";
+	case ICMP_INFO_REQUEST:   return "Information Request";
+	case ICMP_INFO_REPLY:     return "Information Reply";
+	case ICMP_ADDRESS:        return "Address Mask Request";
+	case ICMP_ADDRESSREPLY:   return "Address Mask Reply";
+	default:                  return "unknown ICMP type";
 	}
 }
 
@@ -270,7 +272,7 @@
 		return;				/* not our ping */
 
 	if (icmppkt->icmp_type == ICMP_ECHOREPLY) {
-		u_int16_t recv_seq = ntohs(icmppkt->icmp_seq);
+		uint16_t recv_seq = ntohs(icmppkt->icmp_seq);
 		++nreceived;
 		tp = (struct timeval *) icmppkt->icmp_data;
 
@@ -307,11 +309,12 @@
 		if (dupflag)
 			printf(" (DUP!)");
 		puts("");
-	} else
+	} else {
 		if (icmppkt->icmp_type != ICMP_ECHO)
 			bb_error_msg("warning: got ICMP %d (%s)",
 					icmppkt->icmp_type,
 					icmp_type_name(icmppkt->icmp_type));
+	}
 	fflush(stdout);
 }
 
@@ -326,7 +329,7 @@
 		xbind(pingsock, (struct sockaddr*)&sourceaddr, sizeof(sourceaddr));
 	}
 
-	memset(&pingaddr, 0, sizeof(struct sockaddr_in));
+	memset(&pingaddr, 0, sizeof(pingaddr));
 
 	pingaddr.sin_family = AF_INET;
 	hostent = xgethostbyname(host);
@@ -339,7 +342,7 @@
 	setsockopt_broadcast(pingsock);
 
 	/* set recv buf for broadcast pings */
-	sockopt = 48 * 1024;
+	sockopt = 48 * 1024; /* explain why 48k? */
 	setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, (char *) &sockopt,
 			   sizeof(sockopt));
 
diff --git a/networking/ping6.c b/networking/ping6.c
index 5cb02f5..dec3b42 100644
--- a/networking/ping6.c
+++ b/networking/ping6.c
@@ -1,6 +1,5 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: ping6.c,v 1.6 2004/03/15 08:28:48 andersen Exp $
  * Mini ping implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -67,7 +66,7 @@
 
 	pingsock = create_icmp6_socket();
 
-	memset(&pingaddr, 0, sizeof(struct sockaddr_in));
+	memset(&pingaddr, 0, sizeof(pingaddr));
 
 	pingaddr.sin6_family = AF_INET6;
 	h = xgethostbyname2(host, AF_INET6);
@@ -196,7 +195,7 @@
 	pkt->icmp6_cksum = 0;
 	pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */
 	pkt->icmp6_id = myid;
-	CLR(pkt->icmp6_seq % MAX_DUP_CHK);
+	CLR((uint16_t)ntransmitted % MAX_DUP_CHK);
 	ntransmitted++;
 
 	gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL);
@@ -220,7 +219,7 @@
 	}
 }
 
-/* RFC3542 changed some definitions from RFC2292 for no good reason, whee !
+/* RFC3542 changed some definitions from RFC2292 for no good reason, whee!
  * the newer 3542 uses a MLD_ prefix where as 2292 uses ICMP6_ prefix */
 #ifndef MLD_LISTENER_QUERY
 # define MLD_LISTENER_QUERY ICMP6_MEMBERSHIP_QUERY
@@ -234,16 +233,16 @@
 static char *icmp6_type_name(int id)
 {
 	switch (id) {
-	case ICMP6_DST_UNREACH:         return "Destination Unreachable";
-	case ICMP6_PACKET_TOO_BIG:      return "Packet too big";
-	case ICMP6_TIME_EXCEEDED:       return "Time Exceeded";
-	case ICMP6_PARAM_PROB:          return "Parameter Problem";
-	case ICMP6_ECHO_REPLY:          return "Echo Reply";
-	case ICMP6_ECHO_REQUEST:        return "Echo Request";
-	case MLD_LISTENER_QUERY:        return "Listener Query";
-	case MLD_LISTENER_REPORT:       return "Listener Report";
-	case MLD_LISTENER_REDUCTION:	return "Listener Reduction";
-	default:                        return "unknown ICMP type";
+	case ICMP6_DST_UNREACH:      return "Destination Unreachable";
+	case ICMP6_PACKET_TOO_BIG:   return "Packet too big";
+	case ICMP6_TIME_EXCEEDED:    return "Time Exceeded";
+	case ICMP6_PARAM_PROB:       return "Parameter Problem";
+	case ICMP6_ECHO_REPLY:       return "Echo Reply";
+	case ICMP6_ECHO_REQUEST:     return "Echo Request";
+	case MLD_LISTENER_QUERY:     return "Listener Query";
+	case MLD_LISTENER_REPORT:    return "Listener Report";
+	case MLD_LISTENER_REDUCTION: return "Listener Reduction";
+	default:                     return "unknown ICMP type";
 	}
 }
 
@@ -266,6 +265,7 @@
 		return;				/* not our ping */
 
 	if (icmppkt->icmp6_type == ICMP6_ECHO_REPLY) {
+		uint16_t recv_seq = ntohs(icmppkt->icmp6_seq);
 		++nreceived;
 		tp = (struct timeval *) &icmppkt->icmp6_data8[4];
 
@@ -282,12 +282,12 @@
 		if (triptime > tmax)
 			tmax = triptime;
 
-		if (TST(icmppkt->icmp6_seq % MAX_DUP_CHK)) {
+		if (TST(recv_seq % MAX_DUP_CHK)) {
 			++nrepeats;
 			--nreceived;
 			dupflag = 1;
 		} else {
-			SET(icmppkt->icmp6_seq % MAX_DUP_CHK);
+			SET(recv_seq % MAX_DUP_CHK);
 			dupflag = 0;
 		}
 
@@ -297,16 +297,19 @@
 		printf("%d bytes from %s: icmp6_seq=%u", sz,
 			   inet_ntop(AF_INET6, &pingaddr.sin6_addr,
 						 buf, sizeof(buf)),
-			   ntohs(icmppkt->icmp6_seq));
+			   recv_seq);
 		printf(" ttl=%d time=%lu.%lu ms", hoplimit,
 			   triptime / 10, triptime % 10);
 		if (dupflag)
 			printf(" (DUP!)");
 		puts("");
-	} else
+	} else {
 		if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST)
 			bb_error_msg("warning: got ICMP %d (%s)",
-					icmppkt->icmp6_type, icmp6_type_name(icmppkt->icmp6_type));
+					icmppkt->icmp6_type,
+					icmp6_type_name(icmppkt->icmp6_type));
+	}
+	fflush(stdout);
 }
 
 static void ping(const char *host)
@@ -321,7 +324,7 @@
 
 	pingsock = create_icmp6_socket();
 
-	memset(&pingaddr, 0, sizeof(struct sockaddr_in));
+	memset(&pingaddr, 0, sizeof(pingaddr));
 
 	pingaddr.sin6_family = AF_INET6;
 	hostent = xgethostbyname2(host, AF_INET6);
@@ -431,7 +434,7 @@
 				"%s: invalid interface name", opt_I);
 	}
 
-	myid = (int16_t)getpid();
+	myid = (int16_t) getpid();
 	ping(argv[optind]);
 	return EXIT_SUCCESS;
 }
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 0f3da90..5eac6cd 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -268,7 +268,7 @@
 struct hostinfo {
 	char *name;
 	int n;
-	u_int32_t *addrs;
+	uint32_t *addrs;
 };
 
 /* Data section of the probe packet */
@@ -279,7 +279,7 @@
 };
 
 struct IFADDRLIST {
-	u_int32_t addr;
+	uint32_t addr;
 	char device[sizeof(struct ifreq)];
 };
 
@@ -299,9 +299,9 @@
 
 #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE
 /* Maximum number of gateways (include room for one noop) */
-#define NGATEWAYS ((int)((MAX_IPOPTLEN - IPOPT_MINOFF - 1) / sizeof(u_int32_t)))
+#define NGATEWAYS ((int)((MAX_IPOPTLEN - IPOPT_MINOFF - 1) / sizeof(uint32_t)))
 /* loose source route gateway list (including room for final destination) */
-static u_int32_t gwlist[NGATEWAYS + 1];
+static uint32_t gwlist[NGATEWAYS + 1];
 #endif
 
 static int s;                          /* receive (icmp) socket file descriptor */
@@ -429,7 +429,7 @@
 
 
 static void
-setsin(struct sockaddr_in *addr_sin, u_int32_t addr)
+setsin(struct sockaddr_in *addr_sin, uint32_t addr)
 {
 	memset(addr_sin, 0, sizeof(*addr_sin));
 #ifdef HAVE_SOCKADDR_SA_LEN
@@ -448,8 +448,8 @@
 {
 	int i, n;
 	FILE *f;
-	u_int32_t mask;
-	u_int32_t dest, tmask;
+	uint32_t mask;
+	uint32_t dest, tmask;
 	struct IFADDRLIST *al;
 	char buf[256], tdevice[256], device[256];
 
@@ -641,7 +641,7 @@
 		int nshorts, i;
 
 		sp = (uint16_t *)outip;
-		nshorts = (u_int)packlen / sizeof(uint16_t);
+		nshorts = (unsigned)packlen / sizeof(uint16_t);
 		i = 0;
 		printf("[ %d bytes", packlen);
 		while (--nshorts >= 0) {
@@ -776,7 +776,7 @@
 #if ENABLE_FEATURE_TRACEROUTE_VERBOSE
 	if (verbose) {
 		int i;
-		u_int32_t *lp = (u_int32_t *)&icp->icmp_ip;
+		uint32_t *lp = (uint32_t *)&icp->icmp_ip;
 
 		printf("\n%d bytes from %s to "
 		       "%s: icmp type %d (%s) code %d\n",
@@ -838,7 +838,7 @@
 	struct hostent *hp;
 	struct hostinfo *hi;
 	char **p;
-	u_int32_t addr, *ap;
+	uint32_t addr, *ap;
 
 	hi = xzalloc(sizeof(*hi));
 	addr = inet_addr(host);
@@ -874,7 +874,7 @@
 
 #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE
 static void
-getaddr(u_int32_t *ap, const char *host)
+getaddr(uint32_t *ap, const char *host)
 {
 	struct hostinfo *hi;
 
@@ -892,7 +892,7 @@
 
 	int code, n;
 	unsigned char *outp;
-	u_int32_t *ap;
+	uint32_t *ap;
 	struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom;
 	struct sockaddr_in *to = (struct sockaddr_in *)&whereto;
 	struct hostinfo *hi;
@@ -915,7 +915,7 @@
 	int nprobes = 3;
 	char *nprobes_str = NULL;
 	char *waittime_str = NULL;
-	u_int pausemsecs = 0;
+	unsigned pausemsecs = 0;
 	char *pausemsecs_str = NULL;
 	int first_ttl = 1;
 	char *first_ttl_str = NULL;
@@ -1211,7 +1211,7 @@
 	(void)fflush(stderr);
 
 	for (ttl = first_ttl; ttl <= max_ttl; ++ttl) {
-		u_int32_t lastaddr = 0;
+		uint32_t lastaddr = 0;
 		int gotlastaddr = 0;
 		int got_there = 0;
 		int unreachable = 0;
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 78a1b5e..418aa7c 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -22,7 +22,7 @@
 
 /* This list holds information about clients. The xid_* functions manipulate this list. */
 static struct xid_item {
-	u_int32_t xid;
+	uint32_t xid;
 	struct sockaddr_in ip;
 	int client;
 	time_t timestamp;
@@ -30,7 +30,7 @@
 } dhcprelay_xid_list = {0, {0}, 0, 0, NULL};
 
 
-static struct xid_item * xid_add(u_int32_t xid, struct sockaddr_in *ip, int client)
+static struct xid_item * xid_add(uint32_t xid, struct sockaddr_in *ip, int client)
 {
 	struct xid_item *item;
 
@@ -67,7 +67,7 @@
 	}
 }
 
-static struct xid_item * xid_find(u_int32_t xid)
+static struct xid_item * xid_find(uint32_t xid)
 {
 	struct xid_item *item = dhcprelay_xid_list.next;
 	while (item != NULL) {
@@ -79,7 +79,7 @@
 	return NULL;
 }
 
-static void xid_del(u_int32_t xid)
+static void xid_del(uint32_t xid)
 {
 	struct xid_item *item = dhcprelay_xid_list.next;
 	struct xid_item *last = &dhcprelay_xid_list;