From cd48a1d32b7e37d716e9ca0da9ba773994c976b3 Mon Sep 17 00:00:00 2001 From: charnier Date: Mon, 26 Jul 2004 20:18:11 +0000 Subject: Add __FBSDID. Replace local variable sin by sockin to not conflict with sin(3). Use warnx() instead of warn() when error message is not of any interest. Add prototypes. --- usr.bin/netstat/atalk.c | 9 +++++---- usr.bin/netstat/if.c | 21 +++++++++++---------- usr.bin/netstat/inet.c | 11 ++++++----- usr.bin/netstat/inet6.c | 12 +++++++----- usr.bin/netstat/ipsec.c | 13 ++++++------- usr.bin/netstat/ipx.c | 11 ++++++----- usr.bin/netstat/main.c | 18 ++++++++++-------- usr.bin/netstat/mbuf.c | 9 +++++---- usr.bin/netstat/mcast.c | 6 ++---- usr.bin/netstat/mroute.c | 6 ++---- usr.bin/netstat/mroute6.c | 4 +++- usr.bin/netstat/netgraph.c | 8 ++------ usr.bin/netstat/route.c | 21 +++++++++++---------- usr.bin/netstat/unix.c | 11 ++++++----- 14 files changed, 82 insertions(+), 78 deletions(-) (limited to 'usr.bin/netstat') diff --git a/usr.bin/netstat/atalk.c b/usr.bin/netstat/atalk.c index d0a09c2..517325c 100644 --- a/usr.bin/netstat/atalk.c +++ b/usr.bin/netstat/atalk.c @@ -31,13 +31,14 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint -/* static char sccsid[] = "@(#)atalk.c 1.1 (Whistle) 6/6/96"; -*/ -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 90a5a0a..0a8725b 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -31,13 +31,14 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint -/* static char sccsid[] = "@(#)if.c 8.3 (Berkeley) 4/28/95"; -*/ -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include @@ -210,9 +211,9 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *)) } ifaddraddr = 0; while (ifnetaddr || ifaddraddr) { - struct sockaddr_in *sin; + struct sockaddr_in *sockin; #ifdef INET6 - struct sockaddr_in6 *sin6; + struct sockaddr_in6 *sockin6; #endif char *cp; int n, m; @@ -291,7 +292,7 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *)) printf("%-15.15s ", "none"); break; case AF_INET: - sin = (struct sockaddr_in *)sa; + sockin = (struct sockaddr_in *)sa; #ifdef notdef /* can't use inet_makeaddr because kernel * keeps nets unshifted. @@ -306,19 +307,19 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *)) ifaddr.in.ia_subnetmask)); #endif printf("%-17.17s ", - routename(sin->sin_addr.s_addr)); + routename(sockin->sin_addr.s_addr)); network_layer = 1; break; #ifdef INET6 case AF_INET6: - sin6 = (struct sockaddr_in6 *)sa; + sockin6 = (struct sockaddr_in6 *)sa; printf("%-13.13s ", netname6(&ifaddr.in6.ia_addr, &ifaddr.in6.ia_prefixmask.sin6_addr)); printf("%-17.17s ", inet_ntop(AF_INET6, - &sin6->sin6_addr, + &sockin6->sin6_addr, ntop_buf, sizeof(ntop_buf))); network_layer = 1; diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index f75963f..ea679f8 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -31,13 +31,14 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint -/* static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; -*/ -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include @@ -142,7 +143,7 @@ protopr(u_long proto, /* for sysctl version we pass proto # */ return; } if ((buf = malloc(len)) == 0) { - warn("malloc %lu bytes", (u_long)len); + warnx("malloc %lu bytes", (u_long)len); return; } if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) { diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index 6b90b75..7f11a54 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -30,15 +30,16 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#if 0 #ifndef lint -/* static char sccsid[] = "@(#)inet6.c 8.4 (Berkeley) 4/20/94"; -*/ #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #ifdef INET6 #include @@ -72,7 +73,8 @@ static char sccsid[] = "@(#)inet6.c 8.4 (Berkeley) 4/20/94"; struct socket sockb; -char *inet6name (struct in6_addr *); +char *inet6name(struct in6_addr *); +const char *pluralies(int); static char ntop_buf[INET6_ADDRSTRLEN]; diff --git a/usr.bin/netstat/ipsec.c b/usr.bin/netstat/ipsec.c index 03c685a..c99d27a 100644 --- a/usr.bin/netstat/ipsec.c +++ b/usr.bin/netstat/ipsec.c @@ -63,15 +63,14 @@ * SUCH DAMAGE. */ -#include -#ifndef lint #if 0 -static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; -#else -static const char rcsid[] = - "$FreeBSD$"; -#endif +#ifndef lint +static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c index 2ab359a..b4f2940 100644 --- a/usr.bin/netstat/ipx.c +++ b/usr.bin/netstat/ipx.c @@ -31,13 +31,14 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint -/* static char sccsid[] = "@(#)ns.c 8.1 (Berkeley) 6/6/93"; -*/ -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include @@ -74,6 +75,7 @@ struct socket sockb; static char *ipx_prpr (struct ipx_addr *); static int first = 1; +extern char *tcpstates[]; /* * Print a summary of connections related to a Network Systems @@ -139,7 +141,6 @@ ipxprotopr(u_long off, const char *name, int af1 __unused) printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_laddr)); printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_faddr)); if (isspx) { - extern char *tcpstates[]; if (spxpcb.s_state >= TCP_NSTATES) printf(" %d", spxpcb.s_state); else diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 8992599..1474ba3 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -37,13 +37,14 @@ char const copyright[] = Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ -#ifndef lint #if 0 +#ifndef lint static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94"; -#endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include @@ -245,10 +246,11 @@ struct protox *protoprotox[] = { #endif ipxprotox, atalkprotox, NULL }; -static void printproto (struct protox *, const char *); -static void usage (void); -static struct protox *name2protox (char *); -static struct protox *knownname (char *); +const char *pluralies(int); +static void printproto(struct protox *, const char *); +static void usage(void); +static struct protox *name2protox(char *); +static struct protox *knownname(char *); static kvm_t *kvmd; static char *nlistf = NULL, *memf = NULL; diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c index 98546c4..feb4871 100644 --- a/usr.bin/netstat/mbuf.c +++ b/usr.bin/netstat/mbuf.c @@ -31,13 +31,14 @@ * SUCH DAMAGE. */ -#ifndef lint #if 0 +#ifndef lint static char sccsid[] = "@(#)mbuf.c 8.1 (Berkeley) 6/6/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include diff --git a/usr.bin/netstat/mcast.c b/usr.bin/netstat/mcast.c index 6a7afab..2b2a5cd 100644 --- a/usr.bin/netstat/mcast.c +++ b/usr.bin/netstat/mcast.c @@ -25,10 +25,8 @@ * */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); /* * Print the system's current multicast group memberships. diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index 3449268..e81ca2b 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -37,10 +37,8 @@ * @(#)mroute.c 8.2 (Berkeley) 4/28/95 */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); /* * Print multicast routing structures and statistics. diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c index 4dbaca5..bc06a3d 100644 --- a/usr.bin/netstat/mroute6.c +++ b/usr.bin/netstat/mroute6.c @@ -64,9 +64,11 @@ * SUCH DAMAGE. * * @(#)mroute.c 8.2 (Berkeley) 4/28/95 - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #ifdef INET6 #include #include diff --git a/usr.bin/netstat/netgraph.c b/usr.bin/netstat/netgraph.c index 845a7cc..e156989 100644 --- a/usr.bin/netstat/netgraph.c +++ b/usr.bin/netstat/netgraph.c @@ -30,14 +30,10 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. - * - * $FreeBSD$ */ -#ifndef lint -static const char rcsid[] = - "$Id: atalk.c,v 1.11 1998/07/06 21:01:22 bde Exp $"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); #include #include diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 8f9d814..37ca85d 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -31,13 +31,14 @@ * SUCH DAMAGE. */ -#ifndef lint #if 0 +#ifndef lint static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95"; -#endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include #include @@ -486,7 +487,7 @@ ntreestuff(void) } if ((buf = malloc(needed)) == 0) { - err(2, "malloc(%lu)", (unsigned long)needed); + errx(2, "malloc(%lu)", (unsigned long)needed); } if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { err(1, "sysctl: net.route.0.0.dump"); @@ -563,21 +564,21 @@ fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags) switch(sa->sa_family) { case AF_INET: { - struct sockaddr_in *sin = (struct sockaddr_in *)sa; + struct sockaddr_in *sockin = (struct sockaddr_in *)sa; - if ((sin->sin_addr.s_addr == INADDR_ANY) && + if ((sockin->sin_addr.s_addr == INADDR_ANY) && mask && ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr) ==0L) cp = "default" ; else if (flags & RTF_HOST) - cp = routename(sin->sin_addr.s_addr); + cp = routename(sockin->sin_addr.s_addr); else if (mask) - cp = netname(sin->sin_addr.s_addr, + cp = netname(sockin->sin_addr.s_addr, ntohl(((struct sockaddr_in *)mask) ->sin_addr.s_addr)); else - cp = netname(sin->sin_addr.s_addr, 0L); + cp = netname(sockin->sin_addr.s_addr, 0L); break; } diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index 5698ede..d925611 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -31,13 +31,14 @@ * SUCH DAMAGE. */ -#ifndef lint #if 0 +#ifndef lint static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); /* * Display protocol blocks in the unix domain. @@ -88,7 +89,7 @@ unixpr(void) continue; } if ((buf = malloc(len)) == 0) { - warn("malloc %lu bytes", (u_long)len); + warnx("malloc %lu bytes", (u_long)len); return; } if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) { -- cgit v1.1