diff options
author | araujo <araujo@FreeBSD.org> | 2016-04-20 01:26:03 +0000 |
---|---|---|
committer | araujo <araujo@FreeBSD.org> | 2016-04-20 01:26:03 +0000 |
commit | b9140f06e39542ce964c5ebdceb847b4bf624130 (patch) | |
tree | 56ff47d925d1f49957bfba6e126dfa7355d23e91 /usr.bin | |
parent | 7ce919789adf84fa6f5faf5c751276f3544d0992 (diff) | |
download | FreeBSD-src-b9140f06e39542ce964c5ebdceb847b4bf624130.zip FreeBSD-src-b9140f06e39542ce964c5ebdceb847b4bf624130.tar.gz |
Use NULL instead of 0 for pointers.
gethostbyname(3) will return NULL for error status.
MFC after: 2 weeks.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/systat/cmds.c | 6 | ||||
-rw-r--r-- | usr.bin/systat/netcmds.c | 12 | ||||
-rw-r--r-- | usr.bin/systat/netstat.c | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/systat/cmds.c b/usr.bin/systat/cmds.c index 46b3931..f461f94 100644 --- a/usr.bin/systat/cmds.c +++ b/usr.bin/systat/cmds.c @@ -120,10 +120,10 @@ command(const char *cmd) (*curcmd->c_close)(wnd); curcmd->c_flags &= ~CF_INIT; wnd = (*p->c_open)(); - if (wnd == 0) { + if (wnd == NULL) { error("Couldn't open new display"); wnd = (*curcmd->c_open)(); - if (wnd == 0) { + if (wnd == NULL) { error("Couldn't change back to previous cmd"); exit(1); } @@ -141,7 +141,7 @@ command(const char *cmd) status(); goto done; } - if (curcmd->c_cmd == 0 || !(*curcmd->c_cmd)(tmpstr1, cp)) + if (curcmd->c_cmd == NULL || !(*curcmd->c_cmd)(tmpstr1, cp)) error("%s: Unknown command.", tmpstr1); done: free(tmpstr); diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c index f9da13e..a91af38 100644 --- a/usr.bin/systat/netcmds.c +++ b/usr.bin/systat/netcmds.c @@ -150,7 +150,7 @@ changeitems(const char *args, int onoff) continue; } hp = gethostbyname(tmpstr1); - if (hp == 0) { + if (hp == NULL) { in.s_addr = inet_addr(tmpstr1); if (in.s_addr == INADDR_NONE) { error("%s: unknown host or port", tmpstr1); @@ -167,7 +167,7 @@ static int selectproto(const char *proto) { - if (proto == 0 || streq(proto, "all")) + if (proto == NULL || streq(proto, "all")) protos = TCP | UDP; else if (streq(proto, "tcp")) protos = TCP; @@ -202,13 +202,13 @@ selectport(long port, int onoff) struct pitem *p; if (port == -1) { - if (ports == 0) + if (ports == NULL) return (0); free((char *)ports), ports = 0; nports = 0; return (1); } - for (p = ports; p < ports+nports; p++) + for (p = ports; p < ports + nports; p++) if (p->port == port) { p->onoff = onoff; return (0); @@ -258,8 +258,8 @@ selecthost(struct in_addr *in, int onoff) { struct hitem *p; - if (in == 0) { - if (hosts == 0) + if (in == NULL) { + if (hosts == NULL) return (0); free((char *)hosts), hosts = 0; nhosts = 0; diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index 56bc34e..90ddd25 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -605,7 +605,7 @@ inetname(struct sockaddr *sa) if (np) cp = np->n_name; } - if (cp == 0) { + if (cp == NULL) { hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET); if (hp) cp = hp->h_name; |