From 1411c0f4f749dda670fc2c716705249f2124d166 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 13 Mar 2004 22:02:14 +0000 Subject: some NULL vs 0 and knf; parts from nimadeus@pandora.be --- usr.bin/netstat/atalk.c | 6 +++--- usr.bin/netstat/if.c | 8 ++++---- usr.bin/netstat/inet.c | 12 ++++++------ usr.bin/netstat/iso.c | 8 ++++---- usr.bin/netstat/main.c | 12 ++++++------ usr.bin/netstat/route.c | 12 ++++++------ usr.bin/netstat/unix.c | 13 ++++++------- 7 files changed, 35 insertions(+), 36 deletions(-) diff --git a/usr.bin/netstat/atalk.c b/usr.bin/netstat/atalk.c index 2a2c9677abf..fec8b7209c6 100644 --- a/usr.bin/netstat/atalk.c +++ b/usr.bin/netstat/atalk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atalk.c,v 1.11 2003/06/03 02:56:13 millert Exp $ */ +/* $OpenBSD: atalk.c,v 1.12 2004/03/13 22:02:13 deraadt Exp $ */ /* $NetBSD: atalk.c,v 1.2 1997/05/22 17:21:26 christos Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from @(#)atalk.c 1.1 (Whistle) 6/6/96"; #else -static char rcsid[] = "$OpenBSD: atalk.c,v 1.11 2003/06/03 02:56:13 millert Exp $"; +static char rcsid[] = "$OpenBSD: atalk.c,v 1.12 2004/03/13 22:02:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -206,7 +206,7 @@ char * atalk_print2(const struct sockaddr *sa, const struct sockaddr *mask, int what) { size_t n, l; - static char buf[100]; + static char buf[100]; struct sockaddr_at *sat1, *sat2; struct sockaddr_at thesockaddr; struct sockaddr *sa2; diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 53cbc773227..1e746c5680b 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.37 2003/09/26 06:17:02 deraadt Exp $ */ +/* $OpenBSD: if.c,v 1.38 2004/03/13 22:02:13 deraadt Exp $ */ /* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94"; #else -static char *rcsid = "$OpenBSD: if.c,v 1.37 2003/09/26 06:17:02 deraadt Exp $"; +static char *rcsid = "$OpenBSD: if.c,v 1.38 2004/03/13 22:02:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -228,7 +228,7 @@ intpr(int interval, u_long ifnetaddr) if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { sin6->sin6_scope_id = ntohs(*(u_int16_t *) - &sin6->sin6_addr.s6_addr[2]); + &sin6->sin6_addr.s6_addr[2]); sin6->sin6_addr.s6_addr[2] = 0; sin6->sin6_addr.s6_addr[3] = 0; } @@ -263,7 +263,7 @@ intpr(int interval, u_long ifnetaddr) if (IN6_IS_ADDR_MC_LINKLOCAL(&m6.sin6_addr)) { m6.sin6_scope_id = ntohs(*(u_int16_t *) - &m6.sin6_addr.s6_addr[2]); + &m6.sin6_addr.s6_addr[2]); m6.sin6_addr.s6_addr[2] = 0; m6.sin6_addr.s6_addr[3] = 0; } diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 3939d5cd5c2..c92eecd5349 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.83 2004/02/29 14:17:51 markus Exp $ */ +/* $OpenBSD: inet.c,v 1.84 2004/03/13 22:02:13 deraadt Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -static const char *rcsid = "$OpenBSD: inet.c,v 1.83 2004/02/29 14:17:51 markus Exp $"; +static const char *rcsid = "$OpenBSD: inet.c,v 1.84 2004/03/13 22:02:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -702,7 +702,7 @@ inetname(struct in_addr *inp) else domain[0] = '\0'; } - cp = 0; + cp = NULL; if (!nflag && inp->s_addr != INADDR_ANY) { int net = inet_netof(*inp); int lna = inet_lnaof(*inp); @@ -712,12 +712,12 @@ inetname(struct in_addr *inp) if (np) cp = np->n_name; } - if (cp == 0) { + if (cp == NULL) { hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET); if (hp) { if ((cp = strchr(hp->h_name, '.')) && !strcmp(cp + 1, domain)) - *cp = 0; + *cp = '\0'; cp = hp->h_name; } } @@ -876,7 +876,7 @@ ipip_stats(u_long off, char *name) #undef p } -/* +/* * Dump CARP statistics structure. */ void diff --git a/usr.bin/netstat/iso.c b/usr.bin/netstat/iso.c index 84d53093baa..2738f15cd98 100644 --- a/usr.bin/netstat/iso.c +++ b/usr.bin/netstat/iso.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iso.c,v 1.13 2003/06/26 21:59:11 deraadt Exp $ */ +/* $OpenBSD: iso.c,v 1.14 2004/03/13 22:02:13 deraadt Exp $ */ /* $NetBSD: iso.c,v 1.12 1995/10/03 21:42:38 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)iso.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: iso.c,v 1.13 2003/06/26 21:59:11 deraadt Exp $"; +static char *rcsid = "$OpenBSD: iso.c,v 1.14 2004/03/13 22:02:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -319,8 +319,8 @@ tp_protopr(u_long off, char *name) printf("undefined tpcb state: %p\n", tpr->tpr_pcb); if (!aflag && (tpcb.tp_state == TP_LISTENING || - tpcb.tp_state == TP_CLOSED || - tpcb.tp_state == TP_REFWAIT)) + tpcb.tp_state == TP_CLOSED || + tpcb.tp_state == TP_REFWAIT)) continue; kget(tpcb.tp_sock, sockb); if (tpcb.tp_npcb) diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 9757189b2df..062a96b6380 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.43 2003/12/15 07:11:31 mcbride Exp $ */ +/* $OpenBSD: main.c,v 1.44 2004/03/13 22:02:13 deraadt Exp $ */ /* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ char copyright[] = #if 0 static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 3/1/94"; #else -static char *rcsid = "$OpenBSD: main.c,v 1.43 2003/12/15 07:11:31 mcbride Exp $"; +static char *rcsid = "$OpenBSD: main.c,v 1.44 2004/03/13 22:02:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -214,10 +214,10 @@ struct protox { etherip_stats,"etherip" }, { -1, N_IPCOMPSTAT, 1, 0, ipcomp_stats, "ipcomp" }, - { -1, N_CARPSTAT, 1, 0, - carp_stats, "carp" }, - { -1, N_PFSYNCSTAT, 1, 0, - pfsync_stats, "pfsync" }, + { -1, N_CARPSTAT, 1, 0, + carp_stats, "carp" }, + { -1, N_PFSYNCSTAT, 1, 0, + pfsync_stats, "pfsync" }, { -1, -1, 0, 0, 0, 0 } }; diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index da3d6527740..1d747f746b4 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.61 2004/01/13 20:03:28 otto Exp $ */ +/* $OpenBSD: route.c,v 1.62 2004/03/13 22:02:13 deraadt Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else -static char *rcsid = "$OpenBSD: route.c,v 1.61 2004/01/13 20:03:28 otto Exp $"; +static char *rcsid = "$OpenBSD: route.c,v 1.62 2004/03/13 22:02:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -682,14 +682,14 @@ routename(in_addr_t in) else domain[0] = '\0'; } - cp = 0; + cp = NULL; if (!nflag) { hp = gethostbyaddr((char *)&in, sizeof (struct in_addr), AF_INET); if (hp) { if ((cp = strchr(hp->h_name, '.')) && !strcmp(cp + 1, domain)) - *cp = 0; + *cp = '\0'; cp = hp->h_name; } } @@ -711,9 +711,9 @@ routename(in_addr_t in) char * netname(in_addr_t in, in_addr_t mask) { - char *cp = 0; + char *cp = NULL; static char line[MAXHOSTNAMELEN]; - struct netent *np = 0; + struct netent *np = NULL; int mbits; in = ntohl(in); diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index d362e066238..daad60ad76c 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unix.c,v 1.10 2003/06/03 02:56:13 millert Exp $ */ +/* $OpenBSD: unix.c,v 1.11 2004/03/13 22:02:13 deraadt Exp $ */ /* $NetBSD: unix.c,v 1.13 1995/10/03 21:42:48 thorpej Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "from: @(#)unix.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: unix.c,v 1.10 2003/06/03 02:56:13 millert Exp $"; +static char *rcsid = "$OpenBSD: unix.c,v 1.11 2004/03/13 22:02:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -77,7 +77,7 @@ unixpr(u_long off) struct protosw *unixsw = (struct protosw *)off; filebuf = (char *)kvm_getfiles(kvmd, KERN_FILE, 0, &nfiles); - if (filebuf == 0) { + if (filebuf == NULL) { printf("Out of memory (file table).\n"); return; } @@ -111,14 +111,13 @@ unixdomainpr(struct socket *so, caddr_t soaddr) if (unp->unp_addr) { m = &mbuf; if (kread((u_long)unp->unp_addr, (char *)m, sizeof (*m))) - m = (struct mbuf *)0; + m = NULL; sa = (struct sockaddr_un *)(m->m_dat); } else - m = (struct mbuf *)0; + m = NULL; if (first) { printf("Active UNIX domain sockets\n"); - printf( -"%-*.*s %-6.6s %-6.6s %-6.6s %*.*s %*.*s %*.*s %*.*s Addr\n", + printf("%-*.*s %-6.6s %-6.6s %-6.6s %*.*s %*.*s %*.*s %*.*s Addr\n", PLEN, PLEN, "Address", "Type", "Recv-Q", "Send-Q", PLEN, PLEN, "Inode", PLEN, PLEN, "Conn", PLEN, PLEN, "Refs", PLEN, PLEN, "Nextref"); -- cgit v1.2.3