From 678e8cc6002ecd3a79cdae95ac8b454437219fc5 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 5 Mar 2012 22:05:24 +0100 Subject: [PATCH] Sweep-fix comparing pointers with 0 (and assigning 0 to pointers). For better readability, don't compare pointers with 0 or assign 0 to them. Use NULL instead. The change was done with coccinelle. --- bin/df/df.c | 7 +- bin/ps/fmt.c | 7 +- bin/ps/ps.c | 3 +- bin/rcp/rcp.c | 2 +- bin/sh/miscbltin.c | 2 +- bin/sh/parser.c | 2 +- bin/test/test.c | 2 +- games/adventure/io.c | 5 +- games/adventure/subr.c | 5 +- games/backgammon/backgammon/move.c | 21 ++--- games/backgammon/backgammon/text.c | 3 +- games/backgammon/common_source/fancy.c | 3 +- games/backgammon/common_source/subs.c | 3 +- games/battlestar/save.c | 7 +- games/canfield/canfield/canfield.c | 5 +- games/canfield/cfscores/cfscores.c | 7 +- games/hack/hack.Decl.c | 13 ++- games/hack/hack.c | 3 +- games/hack/hack.dog.c | 5 +- games/hack/hack.end.c | 5 +- games/hack/hack.engrave.c | 9 +- games/hack/hack.invent.c | 5 +- games/hack/hack.lev.c | 5 +- games/hack/hack.main.c | 7 +- games/hack/hack.objnam.c | 3 +- games/hack/hack.pager.c | 5 +- games/hack/hack.rumors.c | 3 +- games/hack/hack.save.c | 9 +- games/hack/hack.shk.c | 17 ++-- games/hack/hack.termcap.c | 3 +- games/hack/hack.topl.c | 5 +- games/hack/hack.unix.c | 7 +- games/hack/hack.vault.c | 11 +-- games/hack/hack.worm.c | 5 +- games/hack/hack.worn.c | 3 +- games/larn/data.c | 3 +- games/larn/diag.c | 5 +- games/larn/io.c | 5 +- games/larn/main.c | 11 +-- games/larn/monster.c | 11 +-- games/larn/movem.c | 5 +- games/larn/tok.c | 11 +-- games/rogue/hit.c | 9 +- games/sail/dr_1.c | 9 +- games/sail/dr_3.c | 5 +- games/sail/dr_5.c | 3 +- games/sail/lo_main.c | 3 +- games/sail/misc.c | 3 +- games/sail/pl_2.c | 3 +- games/sail/pl_3.c | 3 +- games/sail/pl_7.c | 3 +- games/sail/sync.c | 5 +- games/trek/getpar.c | 3 +- games/trek/kill.c | 3 +- games/trek/klmove.c | 3 +- lib/libalias/alias_db.c | 3 +- lib/libbluetooth/bluetooth.c | 5 +- lib/libc/citrus/citrus_iconv.h | 3 +- lib/libc/citrus/citrus_none.c | 3 +- lib/libc/citrus/modules/citrus_big5.c | 5 +- lib/libc/citrus/modules/citrus_euc.c | 5 +- lib/libc/citrus/modules/citrus_euctw.c | 5 +- lib/libc/citrus/modules/citrus_iso2022.c | 7 +- lib/libc/citrus/modules/citrus_johab.c | 3 +- lib/libc/citrus/modules/citrus_mskanji.c | 3 +- lib/libc/citrus/modules/citrus_utf1632.c | 5 +- lib/libc/citrus/modules/citrus_utf8.c | 5 +- lib/libc/gen/err.c | 9 +- lib/libc/gen/getmntinfo.c | 3 +- lib/libc/gen/getmntvinfo.c | 5 +- lib/libc/gen/getvfsent.c | 15 ++- lib/libc/gen/tls.c | 5 +- lib/libc/locale/_wcstol.h | 3 +- lib/libc/locale/_wcstoul.h | 3 +- lib/libc/locale/setlocale.c | 3 +- lib/libc/net/base64.c | 3 +- lib/libc/net/gethostbyht.c | 3 +- lib/libc/net/getifaddrs.c | 3 +- lib/libc/net/getnetbyht.c | 3 +- lib/libc/net/getprotoname.c | 3 +- lib/libc/net/getservent.c | 5 +- lib/libc/net/rcmd.c | 3 +- lib/libc/resolv/mtctxres.c | 8 +- lib/libc/resolv/res_init.c | 4 +- lib/libc/resolv/res_mkupdate.c | 4 +- lib/libc/rpc/auth_none.c | 5 +- lib/libc/rpc/clnt_perror.c | 7 +- lib/libc/rpc/des_crypt.c | 3 +- lib/libc/rpc/getnetpath.c | 2 +- lib/libc/rpc/getpublickey.c | 3 +- lib/libc/rpc/key_call.c | 6 +- lib/libc/rpc/mt_misc.c | 4 +- lib/libc/rpc/rpcdname.c | 7 +- lib/libc/stdio/fputwc.c | 3 +- lib/libc/stdio/ungetwc.c | 3 +- lib/libc/stdlib/_strtol.h | 4 +- lib/libc/stdlib/_strtoul.h | 4 +- lib/libc/stdlib/tsearch.c | 3 +- lib/libc/uuid/uuid_to_string.c | 3 +- lib/libc/xdr/xdr_mem.c | 3 +- lib/libcompat/4.1/getpw.c | 3 +- lib/libcompat/4.3/rexec.c | 12 +-- lib/libcompat/regexp/regexp.c | 3 +- lib/libedit/filecomplete.c | 4 +- lib/libevtr/ktrfmt.yy.c | 8 +- lib/libfetch/ftp.c | 3 +- lib/libipsec/pfkey.c | 3 +- lib/libipx/ipx_addr.c | 5 +- lib/libkcore/kcore_proc.c | 4 +- lib/libkvm/kvm.c | 7 +- lib/libkvm/kvm_file.c | 3 +- lib/libkvm/kvm_i386.c | 3 +- lib/libkvm/kvm_minidump_i386.c | 2 +- lib/libkvm/kvm_minidump_x86_64.c | 2 +- lib/libkvm/kvm_proc.c | 19 ++-- lib/libkvm/kvm_sparc.c | 3 +- lib/libkvm/kvm_x86_64.c | 2 +- lib/libm/src/e_j0.c | 5 +- lib/libm/src/e_j0f.c | 5 +- lib/libm/src/e_j1.c | 5 +- lib/libm/src/e_j1f.c | 5 +- lib/libpuffs/null.c | 2 +- lib/libstand/cd9660.c | 5 +- lib/libstand/nfs.c | 7 +- lib/libstand/strtol.c | 3 +- lib/libtelnet/auth.c | 5 +- lib/libtelnet/encrypt.c | 21 ++--- lib/libtelnet/genget.c | 8 +- lib/libtelnet/kerberos5.c | 3 +- lib/libtelnet/krb4encpwd.c | 5 +- lib/libtelnet/misc.c | 3 +- lib/libtelnet/pk.c | 3 +- lib/libtelnet/rsaencpwd.c | 3 +- lib/libthread_xu/thread/thr_private.h | 4 +- lib/libusbhid/usage.c | 7 +- lib/libvgl/text.c | 3 +- lib/libypclnt/ypclnt_passwd.c | 4 +- .../pam_login_access/login_access.c | 4 +- libexec/bootpd/tools/bootptest/print-bootp.c | 5 +- libexec/ftpd/ftpd.c | 13 ++- libexec/ftpd/popen.c | 3 +- libexec/getty/subr.c | 3 +- libexec/rbootd/bpf.c | 5 +- libexec/rlogind/rlogind.c | 3 +- libexec/rtld-elf/rtld.c | 2 +- libexec/telnetd/state.c | 7 +- libexec/telnetd/sys_term.c | 6 +- libexec/telnetd/telnetd.c | 5 +- libexec/tftpd/tftpd.c | 3 +- sbin/disklabel32/disklabel.c | 12 +-- sbin/disklabel64/disklabel64.c | 4 +- sbin/dump/itime.c | 2 +- sbin/fsck/fsutil.c | 4 +- sbin/fsck/inode.c | 3 +- sbin/fsck/pass4.c | 3 +- sbin/fsck/pass5.c | 3 +- sbin/fsck/preen.c | 9 +- sbin/fsck/utilities.c | 3 +- sbin/fsck_msdosfs/dir.c | 2 +- sbin/fsdb/fsdbutil.c | 3 +- sbin/ifconfig/af_inet.c | 4 +- sbin/init/init.c | 56 +++++------ sbin/ip6fw/ip6fw.c | 5 +- sbin/ipfw/ipfw2.c | 4 +- sbin/iscontrol/config.c | 2 +- sbin/iscontrol/iscontrol.c | 2 +- sbin/mkinitrd/mini_init/oinit.c | 2 +- sbin/mount_portal/conf.c | 7 +- sbin/mount_portal/pt_tcp.c | 7 +- sbin/mount_portal/pt_tcplisten.c | 7 +- sbin/mountd/mountd.c | 3 +- sbin/ping6/ping6.c | 5 +- sbin/quotacheck/quotacheck.c | 5 +- sbin/restore/utilities.c | 3 +- sbin/route/route.c | 6 +- sbin/routed/if.c | 93 +++++++++---------- sbin/routed/input.c | 53 ++++++----- sbin/routed/main.c | 23 +++-- sbin/routed/output.c | 39 ++++---- sbin/routed/parms.c | 25 +++-- sbin/routed/radix.c | 25 +++-- sbin/routed/rdisc.c | 37 ++++---- sbin/routed/rtquery/rtquery.c | 37 ++++---- sbin/routed/table.c | 91 +++++++++--------- sbin/routed/trace.c | 53 ++++++----- sbin/slattach/slattach.c | 7 +- sbin/startslip/startslip.c | 3 +- sbin/umount/umount.c | 3 +- test/interbench/hackbench.c | 2 +- test/stress/stress2/testcases/fts/fts.c | 2 +- test/stress/stress2/testcases/run/run.c | 2 +- test/stress/stress2/testcases/shm/shm.c | 2 +- test/testcases/crypto/aesctr/aesctr.c | 4 +- tools/regression/p1003_1b/sched.c | 3 +- tools/test/malloc/main.c | 8 +- tools/tools/net80211/stumbler/stumbler.c | 8 +- tools/tools/net80211/w00t/assoc/assoc.c | 2 +- tools/tools/net80211/w00t/expand/expand.c | 2 +- tools/tools/net80211/w00t/libw00t/w00t.c | 2 +- tools/tools/net80211/w00t/redir/redir.c | 4 +- tools/tools/net80211/wesside/dics/dics.c | 2 +- .../tools/net80211/wesside/wesside/wesside.c | 14 +-- tools/tools/net80211/wlanwatch/wlanwatch.c | 4 +- usr.bin/chat/chat.c | 3 +- usr.bin/doscmd/AsyncIO.c | 13 ++- usr.bin/doscmd/config.c | 3 +- usr.bin/doscmd/cwd.c | 13 ++- usr.bin/doscmd/doscmd.c | 15 ++- usr.bin/doscmd/int13.c | 27 +++--- usr.bin/doscmd/int17.c | 7 +- usr.bin/doscmd/intff.c | 7 +- usr.bin/doscmd/mouse.c | 3 +- usr.bin/doscmd/port.c | 7 +- usr.bin/doscmd/tty.c | 13 ++- usr.bin/ee/new_curse.c | 3 +- usr.bin/find/find.c | 3 +- usr.bin/find/function.c | 3 +- usr.bin/finger/net.c | 5 +- usr.bin/fmt/fmt.c | 5 +- usr.bin/gzip/gzip.c | 3 +- usr.bin/indent/lexi.c | 4 +- usr.bin/indent/pr_comment.c | 8 +- usr.bin/killall/killall.c | 3 +- usr.bin/lex/initscan.c | 8 +- usr.bin/lex/main.c | 3 +- usr.bin/lex/misc.c | 2 +- usr.bin/lex/sym.c | 3 +- usr.bin/login/login_fbtab.c | 7 +- usr.bin/m4/gnum4.c | 5 +- usr.bin/mail/cmd2.c | 9 +- usr.bin/mail/cmd3.c | 3 +- usr.bin/mail/lex.c | 5 +- usr.bin/mail/send.c | 5 +- usr.bin/make/job.c | 3 +- usr.bin/mkstr/mkstr.c | 5 +- usr.bin/netstat/if.c | 2 +- usr.bin/netstat/inet.c | 9 +- usr.bin/netstat/inet6.c | 5 +- usr.bin/netstat/ipx.c | 5 +- usr.bin/netstat/iso.c | 5 +- usr.bin/netstat/main.c | 2 +- usr.bin/netstat/route.c | 14 +-- usr.bin/netstat/unix.c | 3 +- usr.bin/newkey/generic.c | 3 +- usr.bin/nfsstat/nfsstat.c | 3 +- usr.bin/quota/quota.c | 3 +- usr.bin/rdist/expand.c | 7 +- usr.bin/rdist/main.c | 3 +- usr.bin/rdist/rshrcmd.c | 5 +- usr.bin/rdist/server.c | 3 +- usr.bin/rpcgen/rpc_main.c | 15 ++- usr.bin/rs/rs.c | 3 +- usr.bin/sed/compile.c | 7 +- usr.bin/sort/sort.c | 2 +- usr.bin/systat/mbufs.c | 5 +- usr.bin/systat/netcmds.c | 14 +-- usr.bin/systat/netstat.c | 7 +- usr.bin/talk/get_addrs.c | 2 +- usr.bin/telnet/commands.c | 69 +++++++------- usr.bin/telnet/main.c | 3 +- usr.bin/telnet/telnet.c | 21 ++--- usr.bin/telnet/utilities.c | 3 +- usr.bin/tftp/main.c | 6 +- usr.bin/tip/libacu/v831.c | 2 +- usr.bin/tip/tip/value.c | 2 +- usr.bin/units/units.c | 5 +- usr.bin/usbhidctl/usbhid.c | 12 +-- usr.bin/vmstat/vmstat.c | 3 +- usr.bin/whereis/whereis.c | 9 +- usr.bin/window/cmd.c | 20 ++-- usr.bin/window/cmd2.c | 2 +- usr.bin/window/cmd6.c | 6 +- usr.bin/window/cmd7.c | 6 +- usr.bin/window/compress.c | 56 +++++------ usr.bin/window/context.c | 4 +- usr.bin/window/error.c | 8 +- usr.bin/window/lcmd1.c | 20 ++-- usr.bin/window/lcmd2.c | 24 ++--- usr.bin/window/main.c | 8 +- usr.bin/window/parser2.c | 34 +++---- usr.bin/window/parser4.c | 2 +- usr.bin/window/parser5.c | 4 +- usr.bin/window/startup.c | 4 +- usr.bin/window/string.c | 8 +- usr.bin/window/ttgeneric.c | 22 ++--- usr.bin/window/ttinit.c | 4 +- usr.bin/window/tttermcap.c | 6 +- usr.bin/window/ttwyse60.c | 4 +- usr.bin/window/ttwyse75.c | 4 +- usr.bin/window/var.c | 12 +-- usr.bin/window/win.c | 16 ++-- usr.bin/window/wwalloc.c | 2 +- usr.bin/window/wwinit.c | 2 +- usr.bin/window/wwiomux.c | 2 +- usr.bin/window/wwopen.c | 4 +- usr.bin/window/wwsize.c | 30 +++--- usr.bin/window/wwunframe.c | 2 +- usr.bin/window/wwwrite.c | 10 +- usr.bin/window/xx.c | 12 +-- usr.bin/window/xxflush.c | 6 +- usr.bin/yacc/error.c | 3 +- usr.bin/yacc/lr0.c | 5 +- usr.bin/yacc/main.c | 35 ++++--- usr.bin/yacc/mkpar.c | 7 +- usr.bin/yacc/output.c | 9 +- usr.bin/yacc/reader.c | 91 +++++++++--------- usr.bin/yacc/symtab.c | 9 +- usr.bin/yacc/verbose.c | 3 +- usr.sbin/IPXrouted/af.c | 3 +- usr.sbin/IPXrouted/if.c | 7 +- usr.sbin/IPXrouted/input.c | 19 ++-- usr.sbin/IPXrouted/sap_input.c | 7 +- usr.sbin/IPXrouted/startup.c | 4 +- usr.sbin/IPXrouted/tables.c | 7 +- usr.sbin/arp/arp.c | 3 +- usr.sbin/cdcontrol/cdcontrol.c | 3 +- usr.sbin/config/mkheaders.c | 3 +- usr.sbin/config/mkmakefile.c | 12 +-- usr.sbin/config/mkoptions.c | 5 +- usr.sbin/cron/cron/popen.c | 3 +- usr.sbin/daemon/daemon.c | 3 +- usr.sbin/edquota/edquota.c | 2 +- usr.sbin/gifconfig/gifconfig.c | 3 +- usr.sbin/inetd/builtins.c | 3 +- usr.sbin/inetd/inetd.c | 7 +- usr.sbin/kernbb/kernbb.c | 5 +- usr.sbin/kgmon/kgmon.c | 3 +- usr.sbin/lpr/chkprintcap/chkprintcap.c | 9 +- usr.sbin/lpr/common_source/common.c | 5 +- usr.sbin/lpr/common_source/net.c | 3 +- usr.sbin/lpr/common_source/printcap.c | 9 +- usr.sbin/lpr/common_source/request.c | 5 +- usr.sbin/lpr/common_source/rmjob.c | 2 +- usr.sbin/lpr/lpc/lpc.c | 9 +- usr.sbin/lpr/lpd/printjob.c | 7 +- usr.sbin/lpr/lpr/lpr.c | 5 +- usr.sbin/mfiutil/mfi_patrol.c | 2 +- usr.sbin/mrouted/callout.c | 9 +- usr.sbin/mrouted/main.c | 2 +- usr.sbin/mrouted/mapper.c | 9 +- usr.sbin/mrouted/mtrace.c | 7 +- usr.sbin/mrouted/prune.c | 3 +- usr.sbin/mrouted/route.c | 3 +- usr.sbin/mrouted/vif.c | 17 ++-- usr.sbin/mtree/excludes.c | 7 +- usr.sbin/ppp/command.c | 3 +- usr.sbin/ppp/filter.c | 3 +- usr.sbin/pppctl/pppctl.c | 3 +- usr.sbin/pppd/main.c | 21 ++--- usr.sbin/pstat/pstat.c | 5 +- usr.sbin/puffs/mount_psshfs/fs.c | 2 +- usr.sbin/quot/quot.c | 3 +- usr.sbin/repquota/repquota.c | 11 +-- usr.sbin/rmt/rmt.c | 7 +- usr.sbin/route6d/route6d.c | 12 +-- usr.sbin/rtadvd/rtadvd.c | 2 +- usr.sbin/timed/timed/acksend.c | 5 +- usr.sbin/timed/timed/master.c | 7 +- usr.sbin/timed/timed/readmsg.c | 5 +- usr.sbin/timed/timed/slave.c | 7 +- usr.sbin/timed/timed/timed.c | 49 +++++----- usr.sbin/timed/timedc/cmds.c | 9 +- usr.sbin/timed/timedc/timedc.c | 13 ++- usr.sbin/traceroute/traceroute.c | 7 +- usr.sbin/traceroute6/traceroute6.c | 3 +- usr.sbin/tzsetup/tzsetup.c | 13 ++- usr.sbin/usbdevs/usbdevs.c | 5 +- usr.sbin/zic/zic.c | 12 +-- 368 files changed, 1305 insertions(+), 1568 deletions(-) diff --git a/bin/df/df.c b/bin/df/df.c index 7f31f9a7ac..39253ee7b7 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -38,7 +38,6 @@ * @(#) Copyright (c) 1980, 1990, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)df.c 8.9 (Berkeley) 5/8/95 * $FreeBSD: src/bin/df/df.c,v 1.23.2.9 2002/07/01 00:14:24 iedowse Exp $ - * $DragonFly: src/bin/df/df.c,v 1.13 2008/08/07 09:59:49 swildner Exp $ */ #include @@ -197,13 +196,13 @@ main(int argc, char **argv) for (; *argv; argv++) { if (stat(*argv, &stbuf) < 0) { - if ((mntpt = getmntpt(*argv)) == 0) { + if ((mntpt = getmntpt(*argv)) == NULL) { warn("%s", *argv); rv = 1; continue; } } else if (S_ISCHR(stbuf.st_mode)) { - if ((mntpt = getmntpt(*argv)) == 0) { + if ((mntpt = getmntpt(*argv)) == NULL) { mdev.fspec = *argv; mntpath = strdup("/tmp/df.XXXXXX"); if (mntpath == NULL) { @@ -510,7 +509,7 @@ ufs_df(char *file, struct maxwidths *mwp) sfsp->f_ffree = vsfsp->f_ffree = sblock.fs_cstotal.cs_nifree; sfsp->f_fsid.val[0] = 0; sfsp->f_fsid.val[1] = 0; - if ((mntpt = getmntpt(file)) == 0) + if ((mntpt = getmntpt(file)) == NULL) mntpt = ""; memmove(&sfsp->f_mntonname[0], mntpt, (size_t)MNAMELEN); memmove(&sfsp->f_mntfromname[0], file, (size_t)MNAMELEN); diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c index 091778d0ee..695d363c88 100644 --- a/bin/ps/fmt.c +++ b/bin/ps/fmt.c @@ -32,7 +32,6 @@ * * @(#)fmt.c 8.4 (Berkeley) 4/15/94 * $FreeBSD: src/bin/ps/fmt.c,v 1.14.2.1 2002/03/16 01:15:11 mikeh Exp $ - * $DragonFly: src/bin/ps/fmt.c,v 1.7 2004/11/16 12:16:36 joerg Exp $ */ #include @@ -69,12 +68,12 @@ shquote(char **argv) errx(1, "malloc failed"); } - if (*argv == 0) { + if (*argv == NULL) { buf[0] = 0; return (buf); } dst = buf; - for (p = argv; (src = *p++) != 0; ) { + for (p = argv; (src = *p++) != NULL; ) { if (*src == 0) continue; len = (4 * arg_max - (dst - buf)) / 4; @@ -106,7 +105,7 @@ fmt_argv(char **argv, char *cmd, int maxlen) int len; char *ap, *cp; - if (argv == 0 || argv[0] == 0) { + if (argv == NULL || argv[0] == NULL) { if (cmd == NULL) return (""); ap = NULL; diff --git a/bin/ps/ps.c b/bin/ps/ps.c index d1723bdf59..a7f0380be0 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1990, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)ps.c 8.4 (Berkeley) 4/2/94 * $FreeBSD: src/bin/ps/ps.c,v 1.30.2.6 2002/07/04 08:30:37 sobomax Exp $ - * $DragonFly: src/bin/ps/ps.c,v 1.25 2008/01/10 14:18:39 matthias Exp $ */ #include @@ -339,7 +338,7 @@ main(int argc, char **argv) } kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf); - if (kd == 0) + if (kd == NULL) errx(1, "%s", errbuf); if (!fmt) diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c index 142f624f7e..a683200428 100644 --- a/bin/rcp/rcp.c +++ b/bin/rcp/rcp.c @@ -531,7 +531,7 @@ rsource(char *name, struct stat *statp) return; } last = strrchr(name, '/'); - if (last == 0) + if (last == NULL) last = name; else last++; diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index ae34d9fef3..e9779f2316 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -318,7 +318,7 @@ umaskcmd(int argc __unused, char **argv __unused) } else { void *set; INTOFF; - if ((set = setmode (ap)) == 0) + if ((set = setmode (ap)) == NULL) error("Illegal number: %s", ap); mask = getmode (set, ~mask & 0777); diff --git a/bin/sh/parser.c b/bin/sh/parser.c index aac54b8c8c..112b854ded 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -625,7 +625,7 @@ simplecmd(union node **rpp, union node *redir) /* If we don't have any redirections already, then we must reset */ /* rpp to be the address of the local redir variable. */ - if (redir == 0) + if (redir == NULL) rpp = &redir; args = NULL; diff --git a/bin/test/test.c b/bin/test/test.c index 6c01b3976b..7f94685bce 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -431,7 +431,7 @@ t_lex(char *s) { struct t_op const *op = ops; - if (s == 0) { + if (s == NULL) { t_wp_op = NULL; return EOI; } diff --git a/games/adventure/io.c b/games/adventure/io.c index 6d3ca81520..d454f623cd 100644 --- a/games/adventure/io.c +++ b/games/adventure/io.c @@ -33,7 +33,6 @@ * * @(#)io.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/adventure/io.c,v 1.8.2.1 2001/03/05 11:43:11 kris Exp $ - * $DragonFly: src/games/adventure/io.c,v 1.3 2007/04/18 18:32:12 swildner Exp $ */ /* Re-coding of advent in C: file i/o and user i/o */ @@ -419,7 +418,7 @@ twrite(int loq) printf("If"); speak(<ext[loq]); printf("then\n"); - for (t = travel[loq]; t != 0; t = t->next) { + for (t = travel[loq]; t != NULL; t = t->next) { printf("verb %d takes you to ", t->tverb); if (t->tloc <= 300) speak(<ext[t->tloc]); @@ -570,7 +569,7 @@ pspeak(int m, int skip) char *tbuf; msg = &ptext[m]; - if ((tbuf = malloc(msg->txtlen + 1)) == 0) + if ((tbuf = malloc(msg->txtlen + 1)) == NULL) errx(1, "Out of memory!"); memcpy(tbuf, msg->seekadr, (unsigned)msg->txtlen + 1); /* Room to null */ s = tbuf; diff --git a/games/adventure/subr.c b/games/adventure/subr.c index 13480c2001..65db839ecb 100644 --- a/games/adventure/subr.c +++ b/games/adventure/subr.c @@ -33,7 +33,6 @@ * * @(#)subr.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/adventure/subr.c,v 1.7.2.1 2001/03/05 11:43:11 kris Exp $ - * $DragonFly: src/games/adventure/subr.c,v 1.4 2007/04/18 18:32:12 swildner Exp $ */ /* Re-coding of advent in C: subroutines from main */ @@ -187,7 +186,7 @@ fdwarf(void) if (dloc[i] == 0) continue; j = 1; - for (kk = travel[dloc[i]]; kk != 0; kk = kk->next) { + for (kk = travel[dloc[i]]; kk != NULL; kk = kk->next) { newloc = kk->tloc; if (newloc > 300 || newloc < 15 || newloc == odloc[i] || (j > 1 && newloc == tk[j - 1]) || j >= 20 @@ -383,7 +382,7 @@ mback(void) k = oldlc2; oldlc2 = oldloc; oldloc = loc; - tk2 = 0; + tk2 = NULL; if (k == loc) { rspeak(91); return (2); diff --git a/games/backgammon/backgammon/move.c b/games/backgammon/backgammon/move.c index f1202982ea..a6a9997f72 100644 --- a/games/backgammon/backgammon/move.c +++ b/games/backgammon/backgammon/move.c @@ -28,7 +28,6 @@ * * @(#)move.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/backgammon/backgammon/move.c,v 1.5 1999/11/30 03:48:23 billf Exp $ - * $DragonFly: src/games/backgammon/backgammon/move.c,v 1.3 2006/08/08 16:36:11 pavalos Exp $ */ #include "back.h" @@ -60,8 +59,8 @@ struct BOARD { /* structure of game position */ struct BOARD *b_next; /* forward queue pointer */ }; -struct BOARD *freeq = 0; -struct BOARD *checkq = 0; +struct BOARD *freeq = NULL; +struct BOARD *checkq = NULL; /* these variables are values for the candidate move */ static int ch; /* chance of being hit */ @@ -262,9 +261,9 @@ binsert(struct BOARD *new) struct BOARD *qp; /* queue pointer */ qp = checkq; - if (qp == 0) { /* check if queue empty */ + if (qp == NULL) { /* check if queue empty */ checkq = qp = new; - qp->b_next = 0; + qp->b_next = NULL; return; } result = bcomp(new, qp); /* compare to first element */ @@ -278,7 +277,7 @@ binsert(struct BOARD *new) makefree(new); return; } - while (qp->b_next != 0) { /* traverse queue */ + while (qp->b_next != NULL) { /* traverse queue */ result = bcomp(new, qp->b_next); if (result < 0) { /* found place */ new->b_next = qp->b_next; @@ -294,7 +293,7 @@ binsert(struct BOARD *new) } /* place at end of queue */ qp->b_next = new; - new->b_next = 0; + new->b_next = NULL; } static int @@ -346,13 +345,13 @@ nextfree(void) { struct BOARD *new; - if (freeq == 0) { + if (freeq == NULL) { new = calloc(1, sizeof(struct BOARD)); - if (new == 0) { + if (new == NULL) { writel("\nOut of memory\n"); getout(); } - new->b_next = 0; + new->b_next = NULL; } else { new = freeq; freeq = freeq->b_next; @@ -379,7 +378,7 @@ pickmove(void) makefree(checkq); checkq = next; movcmp(); - } while (checkq != 0); + } while (checkq != NULL); boardcopy(now); } diff --git a/games/backgammon/backgammon/text.c b/games/backgammon/backgammon/text.c index 27387b1ec2..9a523c7ba2 100644 --- a/games/backgammon/backgammon/text.c +++ b/games/backgammon/backgammon/text.c @@ -28,7 +28,6 @@ * * @(#)text.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/backgammon/backgammon/text.c,v 1.5 1999/11/30 03:48:23 billf Exp $ - * $DragonFly: src/games/backgammon/backgammon/text.c,v 1.3 2006/08/08 16:36:11 pavalos Exp $ */ #include "back.h" @@ -106,7 +105,7 @@ text(const char *const *t) const char *s, *a; fixtty(noech); - while (*t != 0) { + while (*t != NULL) { s = a = *t; for (i = 0; *a != '\0'; i--) a++; diff --git a/games/backgammon/common_source/fancy.c b/games/backgammon/common_source/fancy.c index 7b36784213..61ef08e986 100644 --- a/games/backgammon/common_source/fancy.c +++ b/games/backgammon/common_source/fancy.c @@ -28,7 +28,6 @@ * * @(#)fancy.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/backgammon/common_source/fancy.c,v 1.7 1999/11/30 03:48:25 billf Exp $ - * $DragonFly: src/games/backgammon/common_source/fancy.c,v 1.4 2006/08/08 16:36:11 pavalos Exp $ */ #include @@ -569,7 +568,7 @@ clear(void) int i; /* double space if can't clear */ - if (CL == 0) { + if (CL == NULL) { writel("\n\n"); return; } diff --git a/games/backgammon/common_source/subs.c b/games/backgammon/common_source/subs.c index ee5ee9d900..cbbfdd6e78 100644 --- a/games/backgammon/common_source/subs.c +++ b/games/backgammon/common_source/subs.c @@ -28,7 +28,6 @@ * * @(#)subs.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/backgammon/common_source/subs.c,v 1.12 1999/11/30 03:48:27 billf Exp $ - * $DragonFly: src/games/backgammon/common_source/subs.c,v 1.3 2006/08/08 16:36:11 pavalos Exp $ */ #include @@ -369,7 +368,7 @@ getarg(int argc, char **argv) recover(optarg); break; case 'h': - for (i = 0; descr[i] != 0; i++) + for (i = 0; descr[i] != NULL; i++) puts(descr[i]); getout(); } diff --git a/games/battlestar/save.c b/games/battlestar/save.c index 1ddfa44433..1ebbbec3ae 100644 --- a/games/battlestar/save.c +++ b/games/battlestar/save.c @@ -28,7 +28,6 @@ * * @(#)save.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/battlestar/save.c,v 1.8.2.1 2001/03/05 11:45:36 kris Exp $ - * $DragonFly: src/games/battlestar/save.c,v 1.3 2006/08/08 16:47:20 pavalos Exp $ */ #include @@ -50,7 +49,7 @@ restore(void) else return; - if ((fp = fopen(home1, "r")) == 0) { + if ((fp = fopen(home1, "r")) == NULL) { perror(home1); return; } @@ -105,7 +104,7 @@ save(void) FILE *fp; home = getenv("HOME"); - if (home == 0) + if (home == NULL) return; sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home); @@ -129,7 +128,7 @@ save(void) } } - if ((fp = fdopen(fd, "w")) == 0) { + if ((fp = fdopen(fd, "w")) == NULL) { perror(home1); return; } diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c index fd91c7f993..bb1615128b 100644 --- a/games/canfield/canfield/canfield.c +++ b/games/canfield/canfield/canfield.c @@ -29,7 +29,6 @@ * @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved. * @(#)canfield.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/canfield/canfield/canfield.c,v 1.11 1999/12/12 07:25:13 billf Exp $ - * $DragonFly: src/games/canfield/canfield/canfield.c,v 1.4 2005/11/19 09:50:30 swildner Exp $ */ /* @@ -1608,7 +1607,7 @@ instruct(void) if (srcpile == 'n') return; clear(); - for (cp = basicinstructions; *cp != 0; cp++) + for (cp = basicinstructions; *cp != NULL; cp++) printw(*cp); refresh(); getch(); @@ -1621,7 +1620,7 @@ instruct(void) if (srcpile == 'n') return; clear(); - for (cp = bettinginstructions; *cp != 0; cp++) + for (cp = bettinginstructions; *cp != NULL; cp++) printw(*cp); refresh(); getch(); diff --git a/games/canfield/cfscores/cfscores.c b/games/canfield/cfscores/cfscores.c index a1d8d7591e..4a4930b84e 100644 --- a/games/canfield/cfscores/cfscores.c +++ b/games/canfield/cfscores/cfscores.c @@ -29,7 +29,6 @@ * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)cfscores.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/canfield/cfscores/cfscores.c,v 1.9 1999/12/12 07:25:14 billf Exp $ - * $DragonFly: src/games/canfield/cfscores/cfscores.c,v 1.4 2005/11/19 09:50:30 swildner Exp $ */ #include @@ -76,7 +75,7 @@ main(int argc, char *argv[]) if (argc == 1) { uid = getuid(); pw = getpwuid(uid); - if (pw == 0) { + if (pw == NULL) { printf("You are not listed in the password file?!?\n"); exit(2); } @@ -84,12 +83,12 @@ main(int argc, char *argv[]) exit(0); } if (strcmp(argv[1], "-a") == 0) { - while ((pw = getpwent()) != 0) + while ((pw = getpwent()) != NULL) printuser(pw, 0); exit(0); } pw = getpwnam(argv[1]); - if (pw == 0) { + if (pw == NULL) { printf("User %s unknown\n", argv[1]); exit(3); } diff --git a/games/hack/hack.Decl.c b/games/hack/hack.Decl.c index 6c2cfce597..15f807e96d 100644 --- a/games/hack/hack.Decl.c +++ b/games/hack/hack.Decl.c @@ -1,6 +1,5 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.Decl.c - version 1.0.3 */ -/* $DragonFly: src/games/hack/hack.Decl.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" char nul[40]; /* contains zeros */ @@ -14,12 +13,12 @@ struct rm levl[COLNO][ROWNO]; /* level map */ struct mkroom rooms[MAXNROFROOMS + 1]; coord doors[DOORMAX]; #endif /* QUEST */ -struct monst *fmon = 0; -struct trap *ftrap = 0; -struct gold *fgold = 0; -struct obj *fobj = 0, *fcobj = 0, *invent = 0, *uwep = 0, *uarm = 0, - *uarm2 = 0, *uarmh = 0, *uarms = 0, *uarmg = 0, *uright = 0, - *uleft = 0, *uchain = 0, *uball = 0; +struct monst *fmon = NULL; +struct trap *ftrap = NULL; +struct gold *fgold = NULL; +struct obj *fobj = NULL, *fcobj = NULL, *invent = NULL, *uwep = NULL, *uarm = NULL, + *uarm2 = NULL, *uarmh = NULL, *uarms = NULL, *uarmg = NULL, *uright = NULL, + *uleft = NULL, *uchain = NULL, *uball = NULL; struct flag flags; struct you u; struct monst youmonst; /* dummy; used as return value for boomhit */ diff --git a/games/hack/hack.c b/games/hack/hack.c index 42bc267ac3..56aa11fa33 100644 --- a/games/hack/hack.c +++ b/games/hack/hack.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.c,v 1.4 1999/11/16 10:26:35 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.c,v 1.6 2007/05/13 18:33:55 swildner Exp $ */ #include "hack.h" @@ -516,7 +515,7 @@ lookaround(void) (x == u.ux + u.dx && y == u.uy + u.dy)) goto stop; } else /* invisible M cannot influence us */ - mtmp = 0; + mtmp = NULL; if (x == u.ux - u.dx && y == u.uy - u.dy) continue; switch (levl[x][y].scrsym) { diff --git a/games/hack/hack.dog.c b/games/hack/hack.dog.c index a75f35be87..531a3a41be 100644 --- a/games/hack/hack.dog.c +++ b/games/hack/hack.dog.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.dog.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.dog.c,v 1.3 1999/11/16 02:57:03 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.dog.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" #include "hack.mfndpos.h" @@ -40,8 +39,8 @@ initedog(struct monst *mtmp) } /* attach the monsters that went down (or up) together with @ */ -struct monst *mydogs = 0; -struct monst *fallen_down = 0; /* monsters that fell through a trapdoor */ +struct monst *mydogs = NULL; +struct monst *fallen_down = NULL; /* monsters that fell through a trapdoor */ /* they will appear on the next level @ goes to, even if he goes up! */ void diff --git a/games/hack/hack.end.c b/games/hack/hack.end.c index 6ba411cf0a..c2e948aa36 100644 --- a/games/hack/hack.end.c +++ b/games/hack/hack.end.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.end.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.end.c,v 1.4 1999/11/16 10:26:36 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.end.c,v 1.5 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" #define Sprintf (void) sprintf @@ -294,7 +293,7 @@ topten(void) t0->points = 0; t1 = tt_head = newttentry(); - tprev = 0; + tprev = NULL; /* rank0: -1 undefined, 0 not_on_list, n n_th on list */ for (rank = 1;;) { if (fscanf(rfile, "%6s %d %d %d %d %d %ld %c%c %[^,],%[^\n]", @@ -306,7 +305,7 @@ topten(void) t1->points = 0; if (rank0 < 0 && t1->points < t0->points) { rank0 = rank++; - if (tprev == 0) + if (tprev == NULL) tt_head = t0; else tprev->tt_next = t0; diff --git a/games/hack/hack.engrave.c b/games/hack/hack.engrave.c index 60776d3c6d..a319fa9546 100644 --- a/games/hack/hack.engrave.c +++ b/games/hack/hack.engrave.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.engrave.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.engrave.c,v 1.4 1999/11/16 02:57:04 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.engrave.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" @@ -154,7 +153,7 @@ doengrave(void) return (0); if (otmp == &zeroobj) - otmp = 0; + otmp = NULL; if (otmp && otmp->otyp == WAN_FIRE && otmp->spe) { type = BURN; otmp->spe--; @@ -202,7 +201,7 @@ doengrave(void) if (oep && oep->engr_type == DUST) { pline("You wipe out the message that was written here."); del_engr(oep); - oep = 0; + oep = NULL; } if (type == DUST && oep) { pline("You cannot wipe out the message that is %s in the rock.", @@ -294,7 +293,7 @@ save_engravings(int fd) ep = ep->nxt_engr; } bwrite(fd, (char *)nul, sizeof(unsigned)); - head_engr = 0; + head_engr = NULL; } void @@ -303,7 +302,7 @@ rest_engravings(int fd) struct engr *ep; unsigned lth; - head_engr = 0; + head_engr = NULL; for (;;) { mread(fd, (char *)<h, sizeof(unsigned)); if (lth == 0) diff --git a/games/hack/hack.invent.c b/games/hack/hack.invent.c index c16f2e84b1..a95efbd4a9 100644 --- a/games/hack/hack.invent.c +++ b/games/hack/hack.invent.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.invent.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.invent.c,v 1.4 1999/11/16 10:26:36 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.invent.c,v 1.5 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" extern struct obj zeroobj; @@ -67,7 +66,7 @@ addinv(struct obj *obj) /* merge or attach to end of chain */ if (!invent) { invent = obj; - otmp = 0; + otmp = NULL; } else for (otmp = invent; /* otmp */; otmp = otmp->nobj) { if (merged(otmp, obj, 0)) @@ -202,7 +201,7 @@ m_at(int x, int y) struct wseg *wtmp; #endif /* NOWORM */ - m_atseg = 0; + m_atseg = NULL; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (mtmp->mx == x && mtmp->my == y) return (mtmp); diff --git a/games/hack/hack.lev.c b/games/hack/hack.lev.c index 9509f5fafc..d47b873e4e 100644 --- a/games/hack/hack.lev.c +++ b/games/hack/hack.lev.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.lev.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.lev.c,v 1.4 1999/11/16 10:26:36 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.lev.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" extern struct obj *billobjs; @@ -44,7 +43,7 @@ savelev(int fd, xchar lev) savetrapchn(fd, ftrap); saveobjchn(fd, fobj); saveobjchn(fd, billobjs); - billobjs = 0; + billobjs = NULL; save_engravings(fd); #ifndef QUEST bwrite(fd, (char *)rooms, sizeof(rooms)); @@ -61,7 +60,7 @@ savelev(int fd, xchar lev) wtmp2 = wtmp->nseg; bwrite(fd, (char *)wtmp, sizeof(struct wseg)); } - wsegs[tmp] = 0; + wsegs[tmp] = NULL; } bwrite(fd, (char *)wgrowtime, sizeof(wgrowtime)); #endif /* NOWORM */ diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c index c4eacd8fe7..8718e1cd10 100644 --- a/games/hack/hack.main.c +++ b/games/hack/hack.main.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.main.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.main.c,v 1.9 1999/11/16 10:26:36 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.main.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include #include "hack.h" @@ -345,7 +344,7 @@ not_recovered: nomovemsg = 0; if (afternmv) (*afternmv)(); - afternmv = 0; + afternmv = NULL; } } find_ac(); @@ -366,7 +365,7 @@ not_recovered: if (monster_nearby()) stop_occupation(); else if ((*occupation)() == 0) - occupation = 0; + occupation = NULL; continue; } @@ -503,6 +502,6 @@ stop_occupation(void) { if (occupation) { pline("You stop %s.", occtxt); - occupation = 0; + occupation = NULL; } } diff --git a/games/hack/hack.objnam.c b/games/hack/hack.objnam.c index 7b8589f186..2dc2397a65 100644 --- a/games/hack/hack.objnam.c +++ b/games/hack/hack.objnam.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.objnam.c - version 1.0.2 */ /* $FreeBSD: src/games/hack/hack.objnam.c,v 1.3 1999/11/16 02:57:08 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.objnam.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" #define Sprintf (void) sprintf @@ -362,7 +361,7 @@ readobjnam(char *bp) cnt = spe = spesgn = typ = heavy = 0; let = 0; - an = dn = un = 0; + an = dn = un = NULL; for (p = bp; *p; p++) if ('A' <= *p && *p <= 'Z') *p += 'a' - 'A'; diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c index 2c06f949c2..121e9624f6 100644 --- a/games/hack/hack.pager.c +++ b/games/hack/hack.pager.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.pager.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.pager.c,v 1.7 1999/11/16 02:57:09 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.pager.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ /* This file contains the command routine dowhatis() and a pager. */ /* @@ -199,7 +198,7 @@ cornline(int mode, const char *text) struct line *tl; if (mode == 0) { - texthead = 0; + texthead = NULL; maxlen = 0; linect = 0; if (text) { @@ -219,7 +218,7 @@ cornline(int mode, const char *text) if (len > maxlen) maxlen = len; tl = alloc((unsigned)(len + sizeof(struct line) + 1)); - tl->next_line = 0; + tl->next_line = NULL; tl->line_text = (char *)(tl + 1); strcpy(tl->line_text, text); if (!texthead) diff --git a/games/hack/hack.rumors.c b/games/hack/hack.rumors.c index 7e308fa3cf..fd6a45b839 100644 --- a/games/hack/hack.rumors.c +++ b/games/hack/hack.rumors.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.rumors.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.rumors.c,v 1.3 1999/11/16 02:57:10 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.rumors.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" /* for RUMORFILE and BSD (index) */ #define CHARSZ 8 /* number of bits in a char */ @@ -50,7 +49,7 @@ outline(FILE *rumf) if (!fgets(line, sizeof(line), rumf)) return; - if ((ep = strchr(line, '\n')) != 0) + if ((ep = strchr(line, '\n')) != NULL) *ep = 0; pline("This cookie has a scrap of paper inside! It reads: "); pline(line); diff --git a/games/hack/hack.save.c b/games/hack/hack.save.c index 4d319dd7df..afe4343300 100644 --- a/games/hack/hack.save.c +++ b/games/hack/hack.save.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.save.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.save.c,v 1.4 1999/11/16 10:26:37 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.save.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" @@ -176,11 +175,11 @@ struct obj * restobjchn(int fd) { struct obj *otmp, *otmp2; - struct obj *first = 0; + struct obj *first = NULL; int xl; /* suppress "used before set" warning from lint */ - otmp2 = 0; + otmp2 = NULL; for (;;) { mread(fd, (char *)&xl, sizeof(xl)); if (xl == -1) @@ -205,7 +204,7 @@ struct monst * restmonchn(int fd) { struct monst *mtmp, *mtmp2; - struct monst *first = 0; + struct monst *first = NULL; int xl; struct permonst *monbegin; long differ; @@ -214,7 +213,7 @@ restmonchn(int fd) differ = (char *)(&mons[0]) - (char *)(monbegin); /* suppress "used before set" warning from lint */ - mtmp2 = 0; + mtmp2 = NULL; for (;;) { mread(fd, (char *)&xl, sizeof(xl)); if (xl == -1) diff --git a/games/hack/hack.shk.c b/games/hack/hack.shk.c index 7d484634aa..eea05582cb 100644 --- a/games/hack/hack.shk.c +++ b/games/hack/hack.shk.c @@ -1,13 +1,12 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.shk.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.shk.c,v 1.5 1999/11/16 10:26:37 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.shk.c,v 1.6 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" #ifdef QUEST int shlevel = 0; -struct monst *shopkeeper = 0; -struct obj *billobjs = 0; +struct monst *shopkeeper = NULL; +struct obj *billobjs = NULL; void obfree(struct obj *obj, struct obj *merge) @@ -96,7 +95,7 @@ shkname(void) /* Descriptor of current shopkeeper. Note that the bill need not be * per-shopkeeper, since it is valid only when in a shop. */ -static struct monst *shopkeeper = 0; +static struct monst *shopkeeper = NULL; static struct bill_x *bill; static int shlevel = 0; /* level of this shopkeeper */ struct obj *billobjs; /* objects on bill with bp->useup */ @@ -145,7 +144,7 @@ shkdead(struct monst *mtmp) /* called in mon.c */ rooms[eshk->shoproom].rtype = 0; if (mtmp == shopkeeper) { setpaid(); - shopkeeper = 0; + shopkeeper = NULL; bill = (struct bill_x *) - 1000; /* dump core when referenced */ } } @@ -221,7 +220,7 @@ inshop(void) == (rn2(3) == 0)) ESHK(shopkeeper)->following = 1; } - shopkeeper = 0; + shopkeeper = NULL; shlevel = 0; } u.uinshop = 0; @@ -311,7 +310,7 @@ findshk(int roomno) /* (and it is harmless to have too many things in billobjs) */ return; } - shopkeeper = 0; + shopkeeper = NULL; shlevel = 0; bill = (struct bill_x *) - 1000; /* dump core when referenced */ } @@ -660,7 +659,7 @@ subfrombill(struct obj *obj) (u.ux == ESHK(shopkeeper)->shk.x && u.uy == ESHK(shopkeeper)->shk.y) || (u.ux == ESHK(shopkeeper)->shd.x && u.uy == ESHK(shopkeeper)->shd.y)) return; - if ((bp = onbill(obj)) != 0) { + if ((bp = onbill(obj)) != NULL) { obj->unpaid = 0; if (bp->bquan > obj->quan) { otmp = newobj(0); @@ -888,7 +887,7 @@ shk_move(struct monst *shkp) boolean uondoor = 0, satdoor, avoid = 0, badinv; coord poss[9]; int info[9]; - struct obj *ib = 0; + struct obj *ib = NULL; omx = shkp->mx; omy = shkp->my; diff --git a/games/hack/hack.termcap.c b/games/hack/hack.termcap.c index de47b4d9b7..04c605202a 100644 --- a/games/hack/hack.termcap.c +++ b/games/hack/hack.termcap.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.termcap.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.termcap.c,v 1.10 1999/11/16 10:26:38 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.termcap.c,v 1.5 2006/08/21 19:45:32 pavalos Exp $ */ #include #include "hack.h" @@ -73,7 +72,7 @@ startup(void) SO = tgetstr(__DECONST(char *, "so"), &tbufptr); SE = tgetstr(__DECONST(char *, "se"), &tbufptr); SG = tgetnum(__DECONST(char *, "sg")); - if (!SO || !SE || (SG > 0)) SO = SE = 0; + if (!SO || !SE || (SG > 0)) SO = SE = NULL; CD = tgetstr(__DECONST(char *, "cd"), &tbufptr); set_whole_screen(); /* uses LI and CD */ if (tbufptr - tbuf > (int)sizeof(tbuf)) error( diff --git a/games/hack/hack.topl.c b/games/hack/hack.topl.c index 8fb6b8ed2e..75d612adf4 100644 --- a/games/hack/hack.topl.c +++ b/games/hack/hack.topl.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.topl.c - version 1.0.2 */ /* $FreeBSD: src/games/hack/hack.topl.c,v 1.3 1999/11/16 02:57:12 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.topl.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" extern int CO; @@ -58,7 +57,7 @@ remember_topl(void) if (old_toplines && !strcmp(toplines, old_toplines->topl_text)) return; - last_redone_topl = 0; + last_redone_topl = NULL; tl = alloc((unsigned)(strlen(toplines) + sizeof(struct topl) + 1)); tl->next_topl = old_toplines; tl->topl_text = (char *)(tl + 1); @@ -70,7 +69,7 @@ remember_topl(void) } if (tl && tl->next_topl) { free(tl->next_topl); - tl->next_topl = 0; + tl->next_topl = NULL; } } diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c index 7efe5c3b52..880dae3c53 100644 --- a/games/hack/hack.unix.c +++ b/games/hack/hack.unix.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.unix.c - version 1.0.3 */ /* $FreeBSD: src/games/hack/hack.unix.c,v 1.8 1999/11/16 02:57:13 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.unix.c,v 1.7 2006/08/21 19:45:32 pavalos Exp $ */ /* This file collects some Unix dependencies; hack.pager.c contains some more */ @@ -271,7 +270,7 @@ getmailstatus(void) if (stat(mailbox, &omstat)) { #ifdef PERMANENT_MAILBOX pline("Cannot get status of MAIL=%s .", mailbox); - mailbox = 0; + mailbox = NULL; #else omstat.st_mtime = 0; #endif /* PERMANENT_MAILBOX */ @@ -291,7 +290,7 @@ ckmailstatus(void) if (stat(mailbox, &nmstat)) { #ifdef PERMANENT_MAILBOX pline("Cannot get status of MAIL=%s anymore.", mailbox); - mailbox = 0; + mailbox = NULL; #else nmstat.st_mtime = 0; #endif /* PERMANENT_MAILBOX */ @@ -392,7 +391,7 @@ void readmail(void) { #ifdef DEF_MAILREADER /* This implies that UNIX is defined */ - char *mr = 0; + char *mr = NULL; more(); if (!(mr = getenv("MAILREADER"))) diff --git a/games/hack/hack.vault.c b/games/hack/hack.vault.c index 7f790310f7..7dca55cf27 100644 --- a/games/hack/hack.vault.c +++ b/games/hack/hack.vault.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.vault.c - version 1.0.2 */ /* $FreeBSD: src/games/hack/hack.vault.c,v 1.4 1999/11/16 10:26:38 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.vault.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" #ifdef QUEST @@ -76,7 +75,7 @@ restfakecorr(void) } /* it seems he left the corridor - let the guard disappear */ mondead(guard); - guard = 0; + guard = NULL; } static bool @@ -101,7 +100,7 @@ setgd(void) gdlevel = dlevel; return; } - guard = 0; + guard = NULL; } void @@ -161,7 +160,7 @@ fnd: gdlevel = dlevel; if (!cansee(guard->mx, guard->my)) { mondead(guard); - guard = 0; + guard = NULL; return; } @@ -175,7 +174,7 @@ fnd: if (!strcmp(buf, "Croesus") || !strcmp(buf, "Kroisos")) { pline("\"Oh, yes - of course. Sorry to have disturbed you.\""); mondead(guard); - guard = 0; + guard = NULL; return; } clrlin(); @@ -298,7 +297,7 @@ newpos: void gddead(void) { - guard = 0; + guard = NULL; } void diff --git a/games/hack/hack.worm.c b/games/hack/hack.worm.c index 3b7c24989f..3a8d360390 100644 --- a/games/hack/hack.worm.c +++ b/games/hack/hack.worm.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.worm.c - version 1.0.2 */ /* $FreeBSD: src/games/hack/hack.worm.c,v 1.4 1999/11/16 10:26:38 marcel Exp $ */ -/* $DragonFly: src/games/hack/hack.worm.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" #ifndef NOWORM @@ -83,7 +82,7 @@ worm_nomove(struct monst *mtmp) wtmp = wsegs[tmp]; if (wtmp == wheads[tmp]) return; - if (wtmp == 0 || wtmp->nseg == 0) + if (wtmp == NULL || wtmp->nseg == 0) panic("worm_nomove?"); wsegs[tmp] = wtmp->nseg; remseg(wtmp); @@ -103,7 +102,7 @@ wormdead(struct monst *mtmp) wtmp2 = wtmp->nseg; remseg(wtmp); } - wsegs[tmp] = 0; + wsegs[tmp] = NULL; } void diff --git a/games/hack/hack.worn.c b/games/hack/hack.worn.c index 9067055cca..a754aee2c5 100644 --- a/games/hack/hack.worn.c +++ b/games/hack/hack.worn.c @@ -1,7 +1,6 @@ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* hack.worn.c - version 1.0.2 */ /* $FreeBSD: src/games/hack/hack.worn.c,v 1.3 1999/11/16 02:57:14 billf Exp $ */ -/* $DragonFly: src/games/hack/hack.worn.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */ #include "hack.h" @@ -60,7 +59,7 @@ setnotworn(struct obj *obj) for (wp = worn; wp->w_mask; wp++) if (obj == *(wp->w_obj)) { - *(wp->w_obj) = 0; + *(wp->w_obj) = NULL; obj->owornmask &= ~wp->w_mask; } if (uarm2 && !uarm) { diff --git a/games/larn/data.c b/games/larn/data.c index b3675439dc..bba0fb1b2a 100644 --- a/games/larn/data.c +++ b/games/larn/data.c @@ -28,7 +28,6 @@ * * @(#)data.c 5.3 (Berkeley) 5/13/91 * $FreeBSD: src/games/larn/data.c,v 1.5 1999/11/30 03:48:59 billf Exp $ - * $DragonFly: src/games/larn/data.c,v 1.5 2008/06/08 20:40:15 swildner Exp $ */ /* data.c Larn is copyrighted 1986 by Noah Morgan. */ @@ -152,7 +151,7 @@ long outstanding_taxes = 0; /* present tax bill from score file */ long c[100], cbak[100]; /* the character description arrays */ int enable_scroll = 0; /* constant for enabled/disabled scrolling regn */ char aborted[] = " aborted"; -struct sphere *spheres = 0; /* pointer to linked list for spheres of annihilation */ +struct sphere *spheres = NULL; /* pointer to linked list for spheres of annihilation */ const char *levelname[] = { " H"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10","V1","V2","V3" }; diff --git a/games/larn/diag.c b/games/larn/diag.c index 73913b7332..e558b35f7a 100644 --- a/games/larn/diag.c +++ b/games/larn/diag.c @@ -1,6 +1,5 @@ /* diag.c Larn is copyrighted 1986 by Noah Morgan. */ /* $FreeBSD: src/games/larn/diag.c,v 1.5 1999/11/16 02:57:21 billf Exp $ */ -/* $DragonFly: src/games/larn/diag.c,v 1.5 2006/08/26 17:05:05 pavalos Exp $ */ #include #include #include @@ -288,10 +287,10 @@ restoregame(char *fname) for (i = 0; i < MAXMONST; i++) monster[i].genocided = lgetc(); /* genocide info */ - for (sp = 0, i = 0; i < c[SPHCAST]; i++) { + for (sp = NULL, i = 0; i < c[SPHCAST]; i++) { sp2 = sp; sp = malloc(sizeof(struct sphere)); - if (sp == 0) { + if (sp == NULL) { write(2, "Can't malloc() for sphere space\n", 32); break; } diff --git a/games/larn/io.c b/games/larn/io.c index 9ff751d5bd..f068e0085f 100644 --- a/games/larn/io.c +++ b/games/larn/io.c @@ -1,6 +1,5 @@ /* io.c Larn is copyrighted 1986 by Noah Morgan. * $FreeBSD: src/games/larn/io.c,v 1.7 1999/11/16 02:57:22 billf Exp $ - * $DragonFly: src/games/larn/io.c,v 1.7 2008/06/05 18:06:30 swildner Exp $ * * Below are the functions in this file: * @@ -672,7 +671,7 @@ cursors(void) static char cap[256]; char *CM, *CE, *CD, *CL, *SO, *SE, *AL, *DL;/* Termcap capabilities */ -static char *outbuf = 0; /* translated output buffer */ +static char *outbuf = NULL; /* translated output buffer */ /* * init_term() Terminal initialization -- setup termcap info @@ -725,7 +724,7 @@ init_term(void) exit(1); } /* get memory for decoded output buffer*/ - if ((outbuf = malloc(BUFBIG + 16)) == 0) { + if ((outbuf = malloc(BUFBIG + 16)) == NULL) { write(2, "Error malloc'ing memory for decoded output buffer\n", 50); died(-285); /* malloc() failure */ } diff --git a/games/larn/main.c b/games/larn/main.c index 77aa761669..529f7345fc 100644 --- a/games/larn/main.c +++ b/games/larn/main.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/games/larn/main.c,v 1.9 1999/11/30 03:48:59 billf Exp $ */ -/* $DragonFly: src/games/larn/main.c,v 1.5 2008/06/05 18:06:30 swildner Exp $ */ /* main.c */ #include #include @@ -82,17 +81,17 @@ main(int argc, char **argv) init_term(); /* setup the terminal (find out what type) for termcap */ #endif /* VT100 */ /* try to get login name */ - if (((ptr = getlogin()) == 0) || (*ptr == 0)) { + if (((ptr = getlogin()) == NULL) || (*ptr == 0)) { /* can we get it from /etc/passwd? */ if ((pwe = getpwuid(getuid())) != NULL) ptr = pwe->pw_name; - else if ((ptr = getenv("USER")) == 0) - if ((ptr = getenv("LOGNAME")) == 0) { + else if ((ptr = getenv("USER")) == NULL) + if ((ptr = getenv("LOGNAME")) == NULL) { noone: write(2, "Can't find your logname. Who Are You?\n", 39); exit(1); } } - if (ptr == 0) + if (ptr == NULL) goto noone; if (strlen(ptr) == 0) goto noone; @@ -102,7 +101,7 @@ noone: write(2, "Can't find your logname. Who Are You?\n", 39); */ strcpy(loginname, ptr); /* save loginname of the user for logging purposes */ strcpy(logname, ptr); /* this will be overwritten with the players name */ - if ((ptr = getenv("HOME")) == 0) + if ((ptr = getenv("HOME")) == NULL) ptr = "."; strcpy(savefilename, ptr); strcat(savefilename, "/Larn.sav"); /* save file name in home directory */ diff --git a/games/larn/monster.c b/games/larn/monster.c index aed97f1b58..a86c2573f7 100644 --- a/games/larn/monster.c +++ b/games/larn/monster.c @@ -1,7 +1,6 @@ /* * monster.c Larn is copyrighted 1986 by Noah Morgan. * $FreeBSD: src/games/larn/monster.c,v 1.6 1999/11/16 11:47:40 marcel Exp $ - * $DragonFly: src/games/larn/monster.c,v 1.4 2006/08/26 17:05:05 pavalos Exp $ * * This file contains the following functions: * ---------------------------------------------------------------------------- @@ -716,7 +715,7 @@ direct(int spnum, int dam, const char *str, int arg) { int x, y; int m; - if (spnum < 0 || spnum >= SPNUM || str == 0) /* bad arguments */ + if (spnum < 0 || spnum >= SPNUM || str == NULL) /* bad arguments */ return; if (isconfuse()) return; @@ -777,7 +776,7 @@ godirect(int spnum, int dam, const char *str, int delay, char cshow) char *p; int x, y, m; int dx, dy; - if (spnum < 0 || spnum >= SPNUM || str == 0 || delay < 0) /* bad args */ + if (spnum < 0 || spnum >= SPNUM || str == NULL || delay < 0) /* bad args */ return; if (isconfuse()) return; @@ -955,7 +954,7 @@ static void omnidirect(int spnum, int dam, const char *str) { int x, y, m; - if (spnum < 0 || spnum >= SPNUM || str == 0) /* bad args */ + if (spnum < 0 || spnum >= SPNUM || str == NULL) /* bad args */ return; for (x = playerx - 1; x < playerx + 2; x++) for (y = playery - 1; y < playery + 2; y++) { @@ -1721,7 +1720,7 @@ newsphere(int x, int y, int dir, int life) { int m; struct sphere *sp; - if (((sp = malloc(sizeof(struct sphere)))) == 0) + if (((sp = malloc(sizeof(struct sphere)))) == NULL) return (c[SPHCAST]); /* can't malloc, therefore failure */ if (dir >= 9) /* no movement if direction not found */ dir = 0; @@ -1804,7 +1803,7 @@ boom: sphboom(x, y); /* blow up stuff around sphere */ long rmsphere(int x, int y) { - struct sphere *sp, *sp2 = 0; + struct sphere *sp, *sp2 = NULL; for (sp = spheres; sp; sp2 = sp, sp = sp->p) if (level == sp->lev) /* is sphere on this level? */ if ((x == sp->x) && (y == sp->y)) { /* locate sphere at this location */ diff --git a/games/larn/movem.c b/games/larn/movem.c index e12a832f96..5fc11c6982 100644 --- a/games/larn/movem.c +++ b/games/larn/movem.c @@ -1,7 +1,6 @@ /* * movem.c (move monster) Larn is copyrighted 1986 by Noah Morgan. * $FreeBSD: src/games/larn/movem.c,v 1.4 1999/11/16 02:57:23 billf Exp $ - * $DragonFly: src/games/larn/movem.c,v 1.3 2006/08/26 17:05:05 pavalos Exp $ * * Here are the functions in this file: * @@ -355,7 +354,7 @@ mmove(int aa, int bb, int cc, int dd) if (c[BLINDCOUNT]) /* if blind don't show where monsters are */ return; if (know[cc][dd] & 1) { - p = 0; + p = NULL; if (flag) cursors(); switch (flag) { @@ -401,7 +400,7 @@ movsphere(void) /* first duplicate sphere list */ /* look through sphere list */ - for (sp = 0, x = 0, sp2 = spheres; sp2; sp2 = sp2->p) + for (sp = NULL, x = 0, sp2 = spheres; sp2; sp2 = sp2->p) if (sp2->lev == level) { /* only if this level */ sph[x] = *sp2; sph[x++].p = 0; /* copy the struct */ diff --git a/games/larn/tok.c b/games/larn/tok.c index e32a7e1a38..9ebeb0c3bf 100644 --- a/games/larn/tok.c +++ b/games/larn/tok.c @@ -1,6 +1,5 @@ /* tok.c Larn is copyrighted 1986 by Noah Morgan. */ /* $FreeBSD: src/games/larn/tok.c,v 1.5 1999/11/16 02:57:25 billf Exp $ */ -/* $DragonFly: src/games/larn/tok.c,v 1.5 2006/10/08 17:11:30 pavalos Exp $ */ #include #include #include @@ -176,7 +175,7 @@ readopts(void) return; /* user name if no character name */ } do { - if ((i = (char *)lgetw()) == 0) + if ((i = (char *)lgetw()) == NULL) break; /* check for EOF */ while ((*i == ' ') || (*i == '\t')) i++; /* eat leading whitespace */ @@ -203,7 +202,7 @@ readopts(void) case 'm': if (strcmp(i, "monster:") == 0) { /* name favorite monster */ - if ((i = lgetw()) == 0) + if ((i = lgetw()) == NULL) break; if (strlen(i) >= MAXMNAME) i[MAXMNAME - 1] = 0; @@ -223,7 +222,7 @@ readopts(void) case 'n': if (strcmp(i, "name:") == 0) { /* defining players name */ - if ((i = lgetw()) == 0) + if ((i = lgetw()) == NULL) break; if (strlen(i) >= LOGNAMESIZE) i[LOGNAMESIZE - 1] = 0; strcpy(logname, i); @@ -236,7 +235,7 @@ readopts(void) case 'p': if (strcmp(i, "process-name:") == 0) { - if ((i = lgetw()) == 0) + if ((i = lgetw()) == NULL) break; if (strlen(i) >= PSNAMESIZE) i[PSNAMESIZE - 1] = 0; @@ -247,7 +246,7 @@ readopts(void) case 's': if (strcmp(i, "savefile:") == 0) { /* defining savefilename */ - if ((i = lgetw()) == 0) + if ((i = lgetw()) == NULL) break; strcpy(savefilename, i); flag = 0; diff --git a/games/rogue/hit.c b/games/rogue/hit.c index 00320381ec..727fb80d65 100644 --- a/games/rogue/hit.c +++ b/games/rogue/hit.c @@ -31,7 +31,6 @@ * * @(#)hit.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/rogue/hit.c,v 1.6 1999/11/30 03:49:22 billf Exp $ - * $DragonFly: src/games/rogue/hit.c,v 1.3 2006/09/02 19:31:07 pavalos Exp $ */ /* @@ -67,7 +66,7 @@ mon_hit(object *monster) float minus; if (fight_monster && (monster != fight_monster)) { - fight_monster = 0; + fight_monster = NULL; } monster->trow = NO_ROOM; if (cur_level >= (AMULET_LEVEL * 2)) { @@ -298,7 +297,7 @@ mon_damage(object *monster, short damage) dungeon[row][col] &= ~MONSTER; mvaddch(row, col, (int)get_dungeon_char(row, col)); - fight_monster = 0; + fight_monster = NULL; cough_up(monster); mn = mon_name(monster); sprintf(hit_message+strlen(hit_message), "defeated the %s", mn); @@ -357,11 +356,11 @@ fight(boolean to_the_death) one_move_rogue(ch, 0); if (((!to_the_death) && (rogue.hp_current <= possible_damage)) || interrupted || (!(dungeon[row][col] & MONSTER))) { - fight_monster = 0; + fight_monster = NULL; } else { monster = object_at(&level_monsters, row, col); if (monster != fight_monster) { - fight_monster = 0; + fight_monster = NULL; } } } diff --git a/games/sail/dr_1.c b/games/sail/dr_1.c index 43bcc3b993..6c1499e446 100644 --- a/games/sail/dr_1.c +++ b/games/sail/dr_1.c @@ -28,7 +28,6 @@ * * @(#)dr_1.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/dr_1.c,v 1.7 1999/11/30 03:49:32 billf Exp $ - * $DragonFly: src/games/sail/dr_1.c,v 1.4 2006/09/03 17:33:13 pavalos Exp $ */ #include "driver.h" @@ -136,9 +135,9 @@ fightitout(struct ship *from, struct ship *to, int key) menfrom = mensent(from, to, crewfrom, &fromcap, &pcfrom, key); mento = mensent(to, from, crewto, &tocap, &pcto, 0); - if (fromcap == 0) + if (fromcap == NULL) fromcap = from; - if (tocap == 0) + if (tocap == NULL) tocap = to; if (key) { if (!menfrom) { /* if crew surprised */ @@ -304,7 +303,7 @@ compcombat(void) if ((ready & R_LOADED) == 0) continue; closest = closestenemy(sp, r ? 'r' : 'l', 0); - if (closest == 0) + if (closest == NULL) continue; if (range(closest, sp) > range(sp, closestenemy(sp, r ? 'r' : 'l', 1))) @@ -413,7 +412,7 @@ next(void) } if (best > 0.0) { char *p = getenv("WOTD"); - if (p == 0) { + if (p == NULL) { char buf[6] = "Driver"; p = buf; } diff --git a/games/sail/dr_3.c b/games/sail/dr_3.c index 783b45f811..7eb84238b9 100644 --- a/games/sail/dr_3.c +++ b/games/sail/dr_3.c @@ -28,7 +28,6 @@ * * @(#)dr_3.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/dr_3.c,v 1.6 1999/11/30 03:49:32 billf Exp $ - * $DragonFly: src/games/sail/dr_3.c,v 1.3 2006/09/03 17:33:13 pavalos Exp $ */ #include "driver.h" @@ -63,7 +62,7 @@ moveall(void) ta = maxturns(sp, &af); ma = maxmove(sp, sp->file->dir, 0); closest = closestenemy(sp, 0, 0); - if (closest == 0) + if (closest == NULL) *sp->file->movebuf = '\0'; else closeon(sp, closest, sp->file->movebuf, @@ -331,7 +330,7 @@ checksails(void) rig = 0; if (rig && sp->specs->crew3) { closest = closestenemy(sp, 0, 0); - if (closest != 0) { + if (closest != NULL) { if (range(sp, closest) > 9) full = 1; else diff --git a/games/sail/dr_5.c b/games/sail/dr_5.c index 0b8a14897e..203f3d205a 100644 --- a/games/sail/dr_5.c +++ b/games/sail/dr_5.c @@ -28,7 +28,6 @@ * * @(#)dr_5.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/dr_5.c,v 1.4 1999/11/30 03:49:33 billf Exp $ - * $DragonFly: src/games/sail/dr_5.c,v 1.3 2006/09/03 17:33:13 pavalos Exp $ */ #include "externs.h" @@ -78,7 +77,7 @@ mensent(struct ship *from, struct ship *to, int crew[3], struct ship **captured, c1 = men/100 ? crew[0] : 0; c2 = (men%100)/10 ? crew[1] : 0; c3 = men/10 ? crew[2] : 0; - c3 = *captured == 0 ? crew[2] : *pc; + c3 = *captured == NULL ? crew[2] : *pc; } else c1 = c2 = c3 = 0; return(c1 + c2 + c3); diff --git a/games/sail/lo_main.c b/games/sail/lo_main.c index c9f28e5e82..59c759c289 100644 --- a/games/sail/lo_main.c +++ b/games/sail/lo_main.c @@ -28,7 +28,6 @@ * * @(#)lo_main.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/lo_main.c,v 1.2 1999/11/30 03:49:34 billf Exp $ - * $DragonFly: src/games/sail/lo_main.c,v 1.3 2006/09/03 17:33:13 pavalos Exp $ */ /* @@ -57,7 +56,7 @@ lo_main(void) struct logs log; struct ship *ship; - if ((fp = fopen(_PATH_LOGFILE, "r")) == 0) { + if ((fp = fopen(_PATH_LOGFILE, "r")) == NULL) { perror(_PATH_LOGFILE); exit(1); } diff --git a/games/sail/misc.c b/games/sail/misc.c index cae69ef7c8..61e8345d91 100644 --- a/games/sail/misc.c +++ b/games/sail/misc.c @@ -28,7 +28,6 @@ * * @(#)misc.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/misc.c,v 1.5 1999/11/30 03:49:34 billf Exp $ - * $DragonFly: src/games/sail/misc.c,v 1.4 2006/09/03 17:33:13 pavalos Exp $ */ #include @@ -74,7 +73,7 @@ closestenemy(struct ship *from, char side, char anyship) struct ship *sp; char a; int olddist = 30000, dist; - struct ship *closest = 0; + struct ship *closest = NULL; a = capship(from)->nationality; foreachship(sp) { diff --git a/games/sail/pl_2.c b/games/sail/pl_2.c index 8e052dcf48..c20f104d6f 100644 --- a/games/sail/pl_2.c +++ b/games/sail/pl_2.c @@ -28,7 +28,6 @@ * * @(#)pl_2.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/pl_2.c,v 1.4 1999/11/30 03:49:36 billf Exp $ - * $DragonFly: src/games/sail/pl_2.c,v 1.3 2006/09/03 17:33:13 pavalos Exp $ */ #include "player.h" @@ -101,7 +100,7 @@ play(void) eyeball(sp); break; case 'i': - if ((sp = closestenemy(ms, 0, 1)) == 0) + if ((sp = closestenemy(ms, 0, 1)) == NULL) Signal("No more ships left.", NULL); else eyeball(sp); diff --git a/games/sail/pl_3.c b/games/sail/pl_3.c index 8866883b4e..e4d60b8224 100644 --- a/games/sail/pl_3.c +++ b/games/sail/pl_3.c @@ -28,7 +28,6 @@ * * @(#)pl_3.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/pl_3.c,v 1.6 1999/11/30 03:49:37 billf Exp $ - * $DragonFly: src/games/sail/pl_3.c,v 1.3 2006/09/03 17:33:13 pavalos Exp $ */ #include "player.h" @@ -81,7 +80,7 @@ acceptcombat(void) if (mf->struck || !crew[2]) goto cant; closest = closestenemy(ms, (r ? 'r' : 'l'), 1); - if (closest == 0) + if (closest == NULL) goto cant; if (closest->file->struck) goto cant; diff --git a/games/sail/pl_7.c b/games/sail/pl_7.c index e0514cb929..80ea3e8c0b 100644 --- a/games/sail/pl_7.c +++ b/games/sail/pl_7.c @@ -28,7 +28,6 @@ * * @(#)pl_7.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/pl_7.c,v 1.7 1999/11/30 03:49:37 billf Exp $ - * $DragonFly: src/games/sail/pl_7.c,v 1.3 2006/09/03 17:33:13 pavalos Exp $ */ #include @@ -170,7 +169,7 @@ prompt(const char *p, struct ship *ship) { static char buf[60]; - if (ship != 0) { + if (ship != NULL) { printf(buf, p, ship->shipname, colours(ship), sterncolour(ship)); p = buf; diff --git a/games/sail/sync.c b/games/sail/sync.c index bea8808f60..468da58407 100644 --- a/games/sail/sync.c +++ b/games/sail/sync.c @@ -28,7 +28,6 @@ * * @(#)sync.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/sail/sync.c,v 1.9 1999/11/30 03:49:38 billf Exp $ - * $DragonFly: src/games/sail/sync.c,v 1.4 2006/09/03 17:33:13 pavalos Exp $ */ #include @@ -84,7 +83,7 @@ makesignal(struct ship *from, const char *fmt, struct ship *ship, ...) va_list ap; va_start(ap, ship); - if (ship == 0) + if (ship == NULL) vsprintf(message, fmt, ap); else { fmtship(format, sizeof(format), fmt, ship); @@ -136,7 +135,7 @@ sync_open(void) void sync_close(char rm) { - if (sync_fp != 0) + if (sync_fp != NULL) fclose(sync_fp); if (rm) unlink(sync_file); diff --git a/games/trek/getpar.c b/games/trek/getpar.c index d2128fe690..731fc954a9 100644 --- a/games/trek/getpar.c +++ b/games/trek/getpar.c @@ -28,7 +28,6 @@ * * @(#)getpar.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/trek/getpar.c,v 1.5 1999/11/30 03:49:48 billf Exp $ - * $DragonFly: src/games/trek/getpar.c,v 1.3 2006/09/07 21:19:44 pavalos Exp $ */ #include "getpar.h" @@ -185,7 +184,7 @@ getstrpar(const char *s, char *r, int l, const char *t) char format[20]; int f; - if (t == 0) + if (t == NULL) t = " \t\n;"; sprintf(format, "%%%d[^%s]", l, t); while (1) { diff --git a/games/trek/kill.c b/games/trek/kill.c index bc86289709..4bc119a0fc 100644 --- a/games/trek/kill.c +++ b/games/trek/kill.c @@ -28,7 +28,6 @@ * * @(#)kill.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/trek/kill.c,v 1.4 1999/11/30 03:49:49 billf Exp $ - * $DragonFly: src/games/trek/kill.c,v 1.3 2006/09/07 21:19:44 pavalos Exp $ */ #include "trek.h" @@ -147,7 +146,7 @@ kills(int x, int y, int f) q = &Quad[Ship.quadx][Ship.quady]; Sect[x][y] = EMPTY; name = systemname(q); - if (name == 0) + if (name == NULL) return; printf("Inhabited starsystem %s at %d,%d destroyed\n", name, x, y); diff --git a/games/trek/klmove.c b/games/trek/klmove.c index 812fbc1cfd..c2451a6f49 100644 --- a/games/trek/klmove.c +++ b/games/trek/klmove.c @@ -28,7 +28,6 @@ * * @(#)klmove.c 8.1 (Berkeley) 5/31/93 * $FreeBSD: src/games/trek/klmove.c,v 1.4 1999/11/30 03:49:49 billf Exp $ - * $DragonFly: src/games/trek/klmove.c,v 1.4 2006/10/08 17:11:30 pavalos Exp $ */ #include "trek.h" @@ -141,7 +140,7 @@ klmove(int fl) Etc.nkling -= 1; bmove(&Etc.klingon[Etc.nkling], k, sizeof *k); Quad[Ship.quadx][Ship.quady].klings -= 1; - k = 0; + k = NULL; break; } if (Sect[lookx][looky] != EMPTY) { diff --git a/lib/libalias/alias_db.c b/lib/libalias/alias_db.c index 61dd980793..43bdcd703e 100644 --- a/lib/libalias/alias_db.c +++ b/lib/libalias/alias_db.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libalias/alias_db.c,v 1.21.2.14 2002/07/24 03:21:24 luigi Exp $ - * $DragonFly: src/lib/libalias/alias_db.c,v 1.7 2008/09/30 16:57:04 swildner Exp $ */ /* @@ -815,7 +814,7 @@ FindNewPortGroup(struct in_addr dst_addr, struct alias_link *search_result; for (j = 0; j < port_count; j++) - if (0 != (search_result = FindLinkIn(dst_addr, alias_addr, + if (NULL != (search_result = FindLinkIn(dst_addr, alias_addr, dst_port, htons(port_sys + j), link_type, 0))) break; diff --git a/lib/libbluetooth/bluetooth.c b/lib/libbluetooth/bluetooth.c index c3ff6a2007..ba1efb16a5 100644 --- a/lib/libbluetooth/bluetooth.c +++ b/lib/libbluetooth/bluetooth.c @@ -1,5 +1,4 @@ /* $NetBSD: bluetooth.c,v 1.1 2006/06/19 15:44:36 gdamore Exp $ */ -/* $DragonFly: src/lib/libbluetooth/bluetooth.c,v 1.1 2008/01/03 11:47:52 hasso Exp $ */ /* * bluetooth.c @@ -68,7 +67,7 @@ bt_gethostbyname(char const *name) while ((p = bt_gethostent()) != NULL) { if (strcasecmp(p->h_name, name) == 0) break; - for (cp = p->h_aliases; *cp != 0; cp++) + for (cp = p->h_aliases; *cp != NULL; cp++) if (strcasecmp(*cp, name) == 0) goto found; } @@ -181,7 +180,7 @@ bt_getprotobyname(char const *name) while ((p = bt_getprotoent()) != NULL) { if (strcmp(p->p_name, name) == 0) break; - for (cp = p->p_aliases; *cp != 0; cp++) + for (cp = p->p_aliases; *cp != NULL; cp++) if (strcmp(*cp, name) == 0) goto found; } diff --git a/lib/libc/citrus/citrus_iconv.h b/lib/libc/citrus/citrus_iconv.h index afbf1aed1d..8118ea61f4 100644 --- a/lib/libc/citrus/citrus_iconv.h +++ b/lib/libc/citrus/citrus_iconv.h @@ -1,5 +1,4 @@ /* $NetBSD: src/lib/libc/citrus/citrus_iconv.h,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */ -/* $DragonFly: src/lib/libc/citrus/citrus_iconv.h,v 1.2 2008/04/10 10:21:01 hasso Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -61,7 +60,7 @@ _citrus_iconv_convert(struct _citrus_iconv * __restrict cv, _DIAGASSERT(cv && cv->cv_shared && cv->cv_shared->ci_ops && cv->cv_shared->ci_ops->io_convert && out); - _DIAGASSERT(out || outbytes == 0); + _DIAGASSERT(out || outbytes == NULL); return (*cv->cv_shared->ci_ops->io_convert)(cv, in, inbytes, out, outbytes, flags, nresults); diff --git a/lib/libc/citrus/citrus_none.c b/lib/libc/citrus/citrus_none.c index bb3b30a3cb..9aa0a58d2f 100644 --- a/lib/libc/citrus/citrus_none.c +++ b/lib/libc/citrus/citrus_none.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_none.c,v 1.17 2005/12/02 11:14:20 yamt Exp $ */ -/* $DragonFly: src/lib/libc/citrus/citrus_none.c,v 1.5 2008/04/10 10:21:01 hasso Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -330,7 +329,7 @@ _citrus_NONE_ctype_wctomb(void * __restrict cl, char * __restrict s, int ret; size_t nr; - if (s == 0) { + if (s == NULL) { /* * initialize state here. * (nothing to do for us.) diff --git a/lib/libc/citrus/modules/citrus_big5.c b/lib/libc/citrus/modules/citrus_big5.c index ab7718c1f1..2eabd9cd4b 100644 --- a/lib/libc/citrus/modules/citrus_big5.c +++ b/lib/libc/citrus/modules/citrus_big5.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_big5.c,v 1.11 2006/11/22 23:38:27 tnozaki Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_big5.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */ /*- * Copyright (c)2002, 2006 Citrus Project, @@ -301,7 +300,7 @@ _citrus_BIG5_mbrtowc_priv(_BIG5EncodingInfo * __restrict ei, int chlenbak; const char *s0; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(ei != NULL); _DIAGASSERT(psenc != NULL); _DIAGASSERT(s != NULL && *s != NULL); @@ -393,7 +392,7 @@ _citrus_BIG5_wcrtomb_priv(_BIG5EncodingInfo * __restrict ei, int l, ret; _DIAGASSERT(ei != NULL); - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(s != NULL); /* check invalid sequence */ diff --git a/lib/libc/citrus/modules/citrus_euc.c b/lib/libc/citrus/modules/citrus_euc.c index 3a424c4503..32f9e10bcd 100644 --- a/lib/libc/citrus/modules/citrus_euc.c +++ b/lib/libc/citrus/modules/citrus_euc.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_euc.c,v 1.11 2006/03/19 01:25:44 christos Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_euc.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -205,7 +204,7 @@ _citrus_EUC_mbrtowc_priv(_EUCEncodingInfo *ei, wchar_t *pwc, const char **s, int chlenbak; const char *s0, *s1 = NULL; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(ei != NULL); _DIAGASSERT(psenc != NULL); _DIAGASSERT(s != NULL); @@ -300,7 +299,7 @@ _citrus_EUC_wcrtomb_priv(_EUCEncodingInfo *ei, char *s, size_t n, wchar_t wc, int cs, i, ret; _DIAGASSERT(ei != NULL); - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(s != NULL); m = wc & ei->mask; diff --git a/lib/libc/citrus/modules/citrus_euctw.c b/lib/libc/citrus/modules/citrus_euctw.c index f2fa7027a6..e5d768be74 100644 --- a/lib/libc/citrus/modules/citrus_euctw.c +++ b/lib/libc/citrus/modules/citrus_euctw.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_euctw.c,v 1.10 2005/10/29 18:02:04 tshiozak Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_euctw.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -197,7 +196,7 @@ _citrus_EUCTW_mbrtowc_priv(_EUCTWEncodingInfo * __restrict ei, int chlenbak; const char *s0; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(ei != NULL); _DIAGASSERT(psenc != NULL); _DIAGASSERT(s != NULL); @@ -300,7 +299,7 @@ _citrus_EUCTW_wcrtomb_priv(_EUCTWEncodingInfo * __restrict ei, int i, len, clen, ret; _DIAGASSERT(ei != NULL); - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(s != NULL); clen = 1; diff --git a/lib/libc/citrus/modules/citrus_iso2022.c b/lib/libc/citrus/modules/citrus_iso2022.c index d7e2d669cf..2a77711881 100644 --- a/lib/libc/citrus/modules/citrus_iso2022.c +++ b/lib/libc/citrus/modules/citrus_iso2022.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_iso2022.c,v 1.18 2007/11/21 14:19:32 tnozaki Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_iso2022.c,v 1.2 2008/04/10 10:21:01 hasso Exp $ */ /*- * Copyright (c)1999, 2002 Citrus Project, @@ -849,7 +848,7 @@ _citrus_ISO2022_mbrtowc_priv(_ISO2022EncodingInfo * __restrict ei, int c; int chlenbak; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(ei != NULL); _DIAGASSERT(psenc != NULL); _DIAGASSERT(s != NULL); @@ -1204,7 +1203,7 @@ _citrus_ISO2022_put_state_reset(_ISO2022EncodingInfo * __restrict ei, size_t len; _DIAGASSERT(ei != NULL); - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(s != NULL); /* XXX state will be modified after this operation... */ @@ -1240,7 +1239,7 @@ _citrus_ISO2022_wcrtomb_priv(_ISO2022EncodingInfo * __restrict ei, _DIAGASSERT(ei != NULL); _DIAGASSERT(s != NULL); _DIAGASSERT(psenc != NULL); - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); /* XXX state will be modified after this operation... */ ret = _ISO2022_sputwchar(ei, wc, buf, sizeof(buf), &result, psenc, diff --git a/lib/libc/citrus/modules/citrus_johab.c b/lib/libc/citrus/modules/citrus_johab.c index ddb66f30fa..589ffbb1b7 100644 --- a/lib/libc/citrus/modules/citrus_johab.c +++ b/lib/libc/citrus/modules/citrus_johab.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_johab.c,v 1.3 2007/10/23 15:28:25 tnozaki Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_johab.c,v 1.1 2008/04/10 10:21:01 hasso Exp $ */ /*- * Copyright (c)2006 Citrus Project, @@ -174,7 +173,7 @@ _citrus_JOHAB_mbrtowc_priv(_JOHABEncodingInfo * __restrict ei, /* ei may be unused */ _DIAGASSERT(s != NULL); _DIAGASSERT(psenc != NULL); - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); if (*s == NULL) { _citrus_JOHAB_init_state(ei, psenc); diff --git a/lib/libc/citrus/modules/citrus_mskanji.c b/lib/libc/citrus/modules/citrus_mskanji.c index cfb59f7c0e..a8e44f8b37 100644 --- a/lib/libc/citrus/modules/citrus_mskanji.c +++ b/lib/libc/citrus/modules/citrus_mskanji.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_mskanji.c,v 1.12 2007/03/05 16:57:06 tnozaki Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_mskanji.c,v 1.2 2008/04/10 10:21:02 hasso Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -181,7 +180,7 @@ _citrus_MSKanji_mbrtowc_priv(_MSKanjiEncodingInfo * __restrict ei, int chlenbak; const char *s0; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(ei != NULL); _DIAGASSERT(s != NULL); _DIAGASSERT(psenc != NULL); diff --git a/lib/libc/citrus/modules/citrus_utf1632.c b/lib/libc/citrus/modules/citrus_utf1632.c index ac5916eaee..730f8640b5 100644 --- a/lib/libc/citrus/modules/citrus_utf1632.c +++ b/lib/libc/citrus/modules/citrus_utf1632.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_utf1632.c,v 1.8 2008/03/20 11:47:45 tnozaki Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_utf1632.c,v 1.2 2008/04/10 10:21:02 hasso Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -94,7 +93,7 @@ _citrus_UTF1632_mbrtowc_priv(_UTF1632EncodingInfo *ei, wchar_t *pwc, size_t result; const char *s0; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(ei != NULL); _DIAGASSERT(s != NULL); _DIAGASSERT(psenc != NULL); @@ -258,7 +257,7 @@ _citrus_UTF1632_wcrtomb_priv(_UTF1632EncodingInfo *ei, char *s, size_t n, size_t cnt; _DIAGASSERT(ei != NULL); - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(s != NULL); cnt = (size_t)0; diff --git a/lib/libc/citrus/modules/citrus_utf8.c b/lib/libc/citrus/modules/citrus_utf8.c index c9b433ad10..b12bf9f9ba 100644 --- a/lib/libc/citrus/modules/citrus_utf8.c +++ b/lib/libc/citrus/modules/citrus_utf8.c @@ -1,5 +1,4 @@ /* $NetBSD: citrus_utf8.c,v 1.16 2007/03/06 16:13:58 tnozaki Exp $ */ -/* $DragonFly: src/lib/libc/citrus/modules/citrus_utf8.c,v 1.3 2008/05/20 21:13:39 hasso Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -200,7 +199,7 @@ _citrus_UTF8_mbrtowc_priv(_UTF8EncodingInfo *ei, wchar_t *pwc, const char **s, int c; int i; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(s != NULL); _DIAGASSERT(psenc != NULL); @@ -266,7 +265,7 @@ _citrus_UTF8_wcrtomb_priv(_UTF8EncodingInfo *ei, char *s, size_t n, wchar_t wc, int cnt, i, ret; wchar_t c; - _DIAGASSERT(nresult != 0); + _DIAGASSERT(nresult != NULL); _DIAGASSERT(s != NULL); if (_UTF8_surrogate(wc)) { diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c index e93dde279c..5bb1d688d9 100644 --- a/lib/libc/gen/err.c +++ b/lib/libc/gen/err.c @@ -28,7 +28,6 @@ * * @(#)err.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libc/gen/err.c,v 1.15 2008/04/03 20:36:44 imp Exp $ - * $DragonFly: src/lib/libc/gen/err.c,v 1.5 2006/02/12 21:14:11 dillon Exp $ */ #include "namespace.h" @@ -96,7 +95,7 @@ errc(int eval, int code, const char *fmt, ...) void verrc(int eval, int code, const char *fmt, va_list ap) { - if (err_file == 0) + if (err_file == NULL) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) { @@ -121,7 +120,7 @@ errx(int eval, const char *fmt, ...) void verrx(int eval, const char *fmt, va_list ap) { - if (err_file == 0) + if (err_file == NULL) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) @@ -163,7 +162,7 @@ warnc(int code, const char *fmt, ...) void vwarnc(int code, const char *fmt, va_list ap) { - if (err_file == 0) + if (err_file == NULL) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) { @@ -185,7 +184,7 @@ warnx(const char *fmt, ...) void vwarnx(const char *fmt, va_list ap) { - if (err_file == 0) + if (err_file == NULL) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) diff --git a/lib/libc/gen/getmntinfo.c b/lib/libc/gen/getmntinfo.c index 901b1c38ab..a8da0c5d7b 100644 --- a/lib/libc/gen/getmntinfo.c +++ b/lib/libc/gen/getmntinfo.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * @(#)getmntinfo.c 8.1 (Berkeley) 6/4/93 - * $DragonFly: src/lib/libc/gen/getmntinfo.c,v 1.4 2005/11/13 00:07:42 swildner Exp $ */ #include @@ -57,7 +56,7 @@ getmntinfo(struct statfs **mntbufp, int flags) if (mntbuf) free(mntbuf); bufsize = (mntsize + 1) * sizeof(struct statfs); - if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0) + if ((mntbuf = (struct statfs *)malloc(bufsize)) == NULL) return (0); if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) return (0); diff --git a/lib/libc/gen/getmntvinfo.c b/lib/libc/gen/getmntvinfo.c index a3898d0658..7ab3ff4ce0 100644 --- a/lib/libc/gen/getmntvinfo.c +++ b/lib/libc/gen/getmntvinfo.c @@ -32,7 +32,6 @@ * SUCH DAMAGE. * * @(#)getmntinfo.c 8.1 (Berkeley) 6/4/93 - * $DragonFly: src/lib/libc/gen/getmntvinfo.c,v 1.1 2008/06/01 20:46:44 dillon Exp $ */ #include @@ -62,9 +61,9 @@ getmntvinfo(struct statfs **mntbufp, struct statvfs **mntvbufp, int flags) free(mntsbuf); bufsize = (mntsize + 1) * sizeof(struct statfs); vbufsize = (mntsize + 1) * sizeof(struct statvfs); - if ((mntsbuf = (struct statfs *)malloc(bufsize)) == 0) + if ((mntsbuf = (struct statfs *)malloc(bufsize)) == NULL) return (0); - if ((mntvbuf = (struct statvfs *)malloc(vbufsize)) == 0) + if ((mntvbuf = (struct statvfs *)malloc(vbufsize)) == NULL) return (0); if ((mntsize = getvfsstat(mntsbuf, mntvbuf, vbufsize, flags)) < 0) return (0); diff --git a/lib/libc/gen/getvfsent.c b/lib/libc/gen/getvfsent.c index eaa67426fb..b2533b33fd 100644 --- a/lib/libc/gen/getvfsent.c +++ b/lib/libc/gen/getvfsent.c @@ -4,7 +4,6 @@ * This file is in the public domain. * * $FreeBSD: src/lib/libc/gen/getvfsent.c,v 1.14.2.1 2001/03/05 09:19:38 obrien Exp $ - * $DragonFly: src/lib/libc/gen/getvfsent.c,v 1.3 2005/04/26 06:16:29 joerg Exp $ */ #include @@ -18,7 +17,7 @@ /* XXX hide some compatibility problems. */ #undef getvfsbyname -static struct ovfsconf *_vfslist = 0; +static struct ovfsconf *_vfslist = NULL; static struct ovfsconf _vfsconf; static size_t _vfslistlen = 0; static int _vfs_keeplist = 0; @@ -44,7 +43,7 @@ initvfs(void) rv = sysctl(mib, 2, _vfslist, &size, NULL, (size_t)0); if(rv < 0) { free(_vfslist); - _vfslist = 0; + _vfslist = NULL; return 0; } @@ -67,7 +66,7 @@ getvfsent(void) if(!_vfs_keeplist) { free(_vfslist); - _vfslist = 0; + _vfslist = NULL; } return &_vfsconf; } @@ -90,7 +89,7 @@ getvfsbyname(const char *name) if(!_vfs_keeplist) { free(_vfslist); - _vfslist = 0; + _vfslist = NULL; } if(i < _vfslistlen) @@ -117,7 +116,7 @@ getvfsbytype(int type) if(!_vfs_keeplist) { free(_vfslist); - _vfslist = 0; + _vfslist = NULL; } if(i < _vfslistlen) @@ -131,7 +130,7 @@ setvfsent(int keep) { if(_vfslist && !keep) { free(_vfslist); - _vfslist = 0; + _vfslist = NULL; } _vfs_keeplist = keep; @@ -143,7 +142,7 @@ endvfsent(void) { if(_vfslist) { free(_vfslist); - _vfslist = 0; + _vfslist = NULL; } _vfs_index = 0; diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 2a8376127b..00867ccb94 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc/gen/tls.c,v 1.7 2005/03/01 23:42:00 davidxu Exp $ - * $DragonFly: src/lib/libc/gen/tls.c,v 1.10 2005/11/19 22:32:53 swildner Exp $ */ /* @@ -227,7 +226,7 @@ _libc_init_tls(void) while (*sp++ != 0) ; aux = (Elf_Auxinfo *) sp; - phdr = 0; + phdr = NULL; phent = phnum = 0; for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { switch (auxp->a_type) { @@ -244,7 +243,7 @@ _libc_init_tls(void) break; } } - if (phdr == 0 || phent != sizeof(Elf_Phdr) || phnum == 0) + if (phdr == NULL || phent != sizeof(Elf_Phdr) || phnum == 0) return(NULL); for (i = 0; (unsigned)i < phnum; i++) { diff --git a/lib/libc/locale/_wcstol.h b/lib/libc/locale/_wcstol.h index 15e5afd746..a9ed7d8405 100644 --- a/lib/libc/locale/_wcstol.h +++ b/lib/libc/locale/_wcstol.h @@ -1,5 +1,4 @@ /* $NetBSD: src/lib/libc/locale/_wcstol.h,v 1.2 2003/08/07 16:43:03 agc Exp $ */ -/* $DragonFly: src/lib/libc/locale/_wcstol.h,v 1.1 2005/03/16 06:54:41 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -132,7 +131,7 @@ _FUNCNAME(const wchar_t *nptr, wchar_t **endptr, int base) } } } - if (endptr != 0) + if (endptr != NULL) /* LINTED interface specification */ *endptr = (wchar_t *)(any ? s - 1 : nptr); return(acc); diff --git a/lib/libc/locale/_wcstoul.h b/lib/libc/locale/_wcstoul.h index 3ae944babe..dd0ad82782 100644 --- a/lib/libc/locale/_wcstoul.h +++ b/lib/libc/locale/_wcstoul.h @@ -1,5 +1,4 @@ /* $NetBSD: src/lib/libc/locale/_wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp $ */ -/* $DragonFly: src/lib/libc/locale/_wcstoul.h,v 1.1 2005/03/16 06:54:41 joerg Exp $ */ /* * Copyright (c) 1990, 1993 @@ -112,7 +111,7 @@ _FUNCNAME(const wchar_t *nptr, wchar_t **endptr, int base) } if (neg && any > 0) acc = -acc; - if (endptr != 0) + if (endptr != NULL) /* LINTED interface specification */ *endptr = (wchar_t *)(any ? s - 1 : nptr); return(acc); diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c index 0ce6c90384..d1fb246894 100644 --- a/lib/libc/locale/setlocale.c +++ b/lib/libc/locale/setlocale.c @@ -1,5 +1,4 @@ /* $NetBSD: src/lib/libc/locale/setlocale.c,v 1.47 2004/07/21 20:27:46 tshiozak Exp $ */ -/* $DragonFly: src/lib/libc/locale/setlocale.c,v 1.3 2005/04/21 16:36:34 joerg Exp $ */ /* * Copyright (c) 1991, 1993 @@ -200,7 +199,7 @@ setlocale(int category, const char *locale) strlcpy(new_categories[category], locale, sizeof(new_categories[category])); } else { - if ((r = strchr(locale, '/')) == 0) { + if ((r = strchr(locale, '/')) == NULL) { for (i = 1; i < _LC_LAST; ++i) { strlcpy(new_categories[i], locale, sizeof(new_categories[i])); diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c index 0a18e32cbf..5094bf4611 100644 --- a/lib/libc/net/base64.c +++ b/lib/libc/net/base64.c @@ -42,7 +42,6 @@ /* * $FreeBSD: src/lib/libc/net/base64.c,v 1.4 1999/11/04 04:30:43 ache Exp $ - * $DragonFly: src/lib/libc/net/base64.c,v 1.4 2005/11/13 02:04:47 swildner Exp $ */ #include @@ -212,7 +211,7 @@ b64_pton(char const *src, u_char *target, size_t targsize) break; pos = strchr(Base64, ch); - if (pos == 0) /* A non-base64 character. */ + if (pos == NULL) /* A non-base64 character. */ return (-1); switch (state) { diff --git a/lib/libc/net/gethostbyht.c b/lib/libc/net/gethostbyht.c index ead6f12839..fec20bbd21 100644 --- a/lib/libc/net/gethostbyht.c +++ b/lib/libc/net/gethostbyht.c @@ -48,7 +48,6 @@ * * @(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libc/net/gethostbyht.c,v 1.27 2007/01/09 00:28:02 imp Exp $ - * $DragonFly: src/lib/libc/net/gethostbyht.c,v 1.6 2005/11/13 02:04:47 swildner Exp $ */ #include @@ -254,7 +253,7 @@ _ht_gethostbyname(void *rval, void *cb_data, va_list ap) } if (strcasecmp(he.h_name, name) == 0) break; - for (cp = he.h_aliases; *cp != 0; cp++) + for (cp = he.h_aliases; *cp != NULL; cp++) if (strcasecmp(*cp, name) == 0) goto found; } diff --git a/lib/libc/net/getifaddrs.c b/lib/libc/net/getifaddrs.c index fecb73c42b..899cf5b3cc 100644 --- a/lib/libc/net/getifaddrs.c +++ b/lib/libc/net/getifaddrs.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/lib/libc/net/getifaddrs.c,v 1.6 2002/07/25 08:08:30 ume Exp $ */ -/* $DragonFly: src/lib/libc/net/getifaddrs.c,v 1.5 2005/01/31 22:29:33 dillon Exp $ */ /* $KAME: getifaddrs.c,v 1.9 2001/08/20 02:31:20 itojun Exp $ */ /* @@ -98,7 +97,7 @@ getifaddrs(struct ifaddrs **pif) size_t needed; char *buf; char *next; - struct ifaddrs *cif = 0; + struct ifaddrs *cif = NULL; char *p, *p0; struct rt_msghdr *rtm; struct if_msghdr *ifm; diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index 541e54c45a..d5634de005 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -29,7 +29,6 @@ * @(#)getnetent.c 8.1 (Berkeley) 6/4/93 * From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp * $FreeBSD: src/lib/libc/net/getnetbyht.c,v 1.19 2007/01/09 00:28:02 imp Exp $ - * $DragonFly: src/lib/libc/net/getnetbyht.c,v 1.5 2005/11/13 02:04:47 swildner Exp $ */ /* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro @@ -212,7 +211,7 @@ _ht_getnetbyname(void *rval, void *cb_data, va_list ap) while ((error = getnetent_p(&ne, ned)) == 0) { if (strcasecmp(ne.n_name, name) == 0) break; - for (cp = ne.n_aliases; *cp != 0; cp++) + for (cp = ne.n_aliases; *cp != NULL; cp++) if (strcasecmp(*cp, name) == 0) goto found; } diff --git a/lib/libc/net/getprotoname.c b/lib/libc/net/getprotoname.c index 4ee59b0740..ba32368b9c 100644 --- a/lib/libc/net/getprotoname.c +++ b/lib/libc/net/getprotoname.c @@ -28,7 +28,6 @@ * * @(#)getprotoname.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libc/net/getprotoname.c,v 1.7 2007/01/09 00:28:02 imp Exp $ - * $DragonFly: src/lib/libc/net/getprotoname.c,v 1.5 2005/11/13 02:04:47 swildner Exp $ */ #include @@ -81,7 +80,7 @@ files_getprotobyname(void *retval, void *mdata, va_list ap) while ((error = __getprotoent_p(&pe, ped)) == 0) { if (strcmp(pe.p_name, name) == 0) break; - for (cp = pe.p_aliases; *cp != 0; cp++) + for (cp = pe.p_aliases; *cp != NULL; cp++) if (strcmp(*cp, name) == 0) goto found; } diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c index 54557c786d..47685a4d11 100644 --- a/lib/libc/net/getservent.c +++ b/lib/libc/net/getservent.c @@ -28,7 +28,6 @@ * * @(#)getservent.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libc/net/getservent.c,v 1.23 2007/01/09 00:28:02 imp Exp $ - * $DragonFly: src/lib/libc/net/getservent.c,v 1.7 2005/11/13 02:04:47 swildner Exp $ */ #include @@ -389,14 +388,14 @@ files_servent(void *retval, void *mdata, va_list ap) continue; gotname: - if (proto == 0 || strcmp(serv->s_proto, proto) == 0) + if (proto == NULL || strcmp(serv->s_proto, proto) == 0) rv = NS_SUCCESS; break; case nss_lt_id: if (port != serv->s_port) continue; - if (proto == 0 || strcmp(serv->s_proto, proto) == 0) + if (proto == NULL || strcmp(serv->s_proto, proto) == 0) rv = NS_SUCCESS; break; case nss_lt_all: diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c index 96a2dc32ad..4dabd50f05 100644 --- a/lib/libc/net/rcmd.c +++ b/lib/libc/net/rcmd.c @@ -28,7 +28,6 @@ * * @(#)rcmd.c 8.3 (Berkeley) 3/26/94 * $FreeBSD: src/lib/libc/net/rcmd.c,v 1.42 2007/01/09 00:28:02 imp Exp $ - * $DragonFly: src/lib/libc/net/rcmd.c,v 1.7 2005/11/13 02:04:47 swildner Exp $ */ #include "namespace.h" @@ -202,7 +201,7 @@ rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser, } } lport--; - if (fd2p == 0) { + if (fd2p == NULL) { _write(s, "", 1); lport = 0; } else { diff --git a/lib/libc/resolv/mtctxres.c b/lib/libc/resolv/mtctxres.c index 6f9f586b4b..efacb0df44 100644 --- a/lib/libc/resolv/mtctxres.c +++ b/lib/libc/resolv/mtctxres.c @@ -75,7 +75,7 @@ __res_init_ctx(void) { return (0); } - if ((mt = malloc(sizeof (mtctxres_t))) == 0) { + if ((mt = malloc(sizeof (mtctxres_t))) == NULL) { errno = ENOMEM; return (-1); } @@ -96,7 +96,7 @@ __res_destroy_ctx(void *value) { mtctxres_t *mt = (mtctxres_t *)value; - if (mt != 0) + if (mt != NULL) free(mt); } #endif @@ -131,9 +131,9 @@ ___mtctxres(void) { * that fails return a global context. */ if (mt_key_initialized) { - if (((mt = pthread_getspecific(key)) != 0) || + if (((mt = pthread_getspecific(key)) != NULL) || (__res_init_ctx() == 0 && - (mt = pthread_getspecific(key)) != 0)) { + (mt = pthread_getspecific(key)) != NULL)) { return (mt); } } diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index 4f79115a52..2b5b0c68de 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -299,7 +299,7 @@ __res_vinit(res_state statp, int preinit) { while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n') cp++; *cp = '\0'; - *pp++ = 0; + *pp++ = NULL; } #define MATCH(line, name) \ @@ -363,7 +363,7 @@ __res_vinit(res_state statp, int preinit) { while (*cp != '\0' && *cp != ' ' && *cp != '\t') cp++; *cp = '\0'; - *pp++ = 0; + *pp++ = NULL; havesearch = 1; continue; } diff --git a/lib/libc/resolv/res_mkupdate.c b/lib/libc/resolv/res_mkupdate.c index 47ce4c94b3..b4b2250072 100644 --- a/lib/libc/resolv/res_mkupdate.c +++ b/lib/libc/resolv/res_mkupdate.c @@ -1165,7 +1165,7 @@ res_protocolname(int num) { if (protolist == (struct valuelist *)0) res_buildprotolist(); pp = cgetprotobynumber(num); - if (pp == 0) { + if (pp == NULL) { (void) sprintf(number, "%d", num); return (number); } @@ -1180,7 +1180,7 @@ res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */ if (servicelist == (struct valuelist *)0) res_buildservicelist(); ss = cgetservbyport(htons(port), proto); - if (ss == 0) { + if (ss == NULL) { (void) sprintf(number, "%d", port); return (number); } diff --git a/lib/libc/rpc/auth_none.c b/lib/libc/rpc/auth_none.c index 8e02db4bda..eba58ea23a 100644 --- a/lib/libc/rpc/auth_none.c +++ b/lib/libc/rpc/auth_none.c @@ -30,7 +30,6 @@ * @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC * $NetBSD: auth_none.c,v 1.13 2000/01/22 22:19:17 mycroft Exp $ * $FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.14 2006/02/27 22:10:58 deischen Exp $ - * $DragonFly: src/lib/libc/rpc/auth_none.c,v 1.4 2005/11/13 12:27:04 swildner Exp $ */ /* @@ -79,9 +78,9 @@ authnone_create(void) XDR *xdrs; mutex_lock(&authnone_lock); - if (ap == 0) { + if (ap == NULL) { ap = (struct authnone_private *)calloc(1, sizeof (*ap)); - if (ap == 0) { + if (ap == NULL) { mutex_unlock(&authnone_lock); return (0); } diff --git a/lib/libc/rpc/clnt_perror.c b/lib/libc/rpc/clnt_perror.c index 46e6a85d81..a2d03694bf 100644 --- a/lib/libc/rpc/clnt_perror.c +++ b/lib/libc/rpc/clnt_perror.c @@ -30,7 +30,6 @@ * @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC * $NetBSD: clnt_perror.c,v 1.24 2000/06/02 23:11:07 fvdl Exp $ * $FreeBSD: src/lib/libc/rpc/clnt_perror.c,v 1.17 2004/10/16 06:11:34 obrien Exp $ - * $DragonFly: src/lib/libc/rpc/clnt_perror.c,v 1.5 2005/11/13 12:27:04 swildner Exp $ */ /* @@ -61,7 +60,7 @@ static char * _buf(void) { - if (buf == 0) + if (buf == NULL) buf = (char *)malloc(CLNT_PERROR_BUFLEN); return (buf); } @@ -82,7 +81,7 @@ clnt_sperror(CLIENT *rpch, const char *s) assert(s != NULL); str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */ - if (str == 0) + if (str == NULL) return (0); len = CLNT_PERROR_BUFLEN; strstart = str; @@ -237,7 +236,7 @@ clnt_spcreateerror(const char *s) assert(s != NULL); str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */ - if (str == 0) + if (str == NULL) return(0); len = CLNT_PERROR_BUFLEN; i = snprintf(str, len, "%s: ", s); diff --git a/lib/libc/rpc/des_crypt.c b/lib/libc/rpc/des_crypt.c index fd9891b2aa..f64ecf71ac 100644 --- a/lib/libc/rpc/des_crypt.c +++ b/lib/libc/rpc/des_crypt.c @@ -28,7 +28,6 @@ * * @(#)des_crypt.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI * $FreeBSD: src/lib/libc/rpc/des_crypt.c,v 1.3 1999/08/28 00:00:38 peter Exp $ - * $DragonFly: src/lib/libc/rpc/des_crypt.c,v 1.5 2005/11/13 12:27:04 swildner Exp $ */ /* * des_crypt.c, DES encryption library routines @@ -40,7 +39,7 @@ #include static int common_crypt ( char *, char *, unsigned, unsigned, struct desparams * ); -int (*__des_crypt_LOCAL)() = 0; +int (*__des_crypt_LOCAL)() = NULL; extern int _des_crypt_call( char *, int, struct desparams * ); /* * Copy 8 bytes diff --git a/lib/libc/rpc/getnetpath.c b/lib/libc/rpc/getnetpath.c index 83be925588..6c06b0565a 100644 --- a/lib/libc/rpc/getnetpath.c +++ b/lib/libc/rpc/getnetpath.c @@ -260,7 +260,7 @@ _get_next_token(char *npp, /* string */ *cp++ = '\0'; /* null-terminate token */ /* get rid of any backslash escapes */ ep = npp; - while ((np = strchr(ep, '\\')) != 0) { + while ((np = strchr(ep, '\\')) != NULL) { if (np[1] == '\\') np++; strcpy(np, (ep = &np[1])); /* XXX: overlapping string copy */ diff --git a/lib/libc/rpc/getpublickey.c b/lib/libc/rpc/getpublickey.c index 81eedf8a44..3d37f52290 100644 --- a/lib/libc/rpc/getpublickey.c +++ b/lib/libc/rpc/getpublickey.c @@ -28,7 +28,6 @@ * Mountain View, California 94043 * * $FreeBSD: src/lib/libc/rpc/getpublickey.c,v 1.9 2006/02/28 16:02:26 deischen Exp $ - * $DragonFly: src/lib/libc/rpc/getpublickey.c,v 1.3 2005/11/13 12:27:04 swildner Exp $ * * @(#)publickey.c 1.10 91/03/11 Copyr 1986 Sun Micro */ @@ -57,7 +56,7 @@ /* * Hack to let ypserv/rpc.nisd use AUTH_DES. */ -int (*__getpublickey_LOCAL)() = 0; +int (*__getpublickey_LOCAL)() = NULL; /* * Get somebody's public key diff --git a/lib/libc/rpc/key_call.c b/lib/libc/rpc/key_call.c index 5f36f15e94..a2aaa75433 100644 --- a/lib/libc/rpc/key_call.c +++ b/lib/libc/rpc/key_call.c @@ -80,9 +80,9 @@ * implementations of these functions, and to call those in key_call(). */ -cryptkeyres *(*__key_encryptsession_pk_LOCAL)() = 0; -cryptkeyres *(*__key_decryptsession_pk_LOCAL)() = 0; -des_block *(*__key_gendes_LOCAL)() = 0; +cryptkeyres *(*__key_encryptsession_pk_LOCAL)() = NULL; +cryptkeyres *(*__key_decryptsession_pk_LOCAL)() = NULL; +des_block *(*__key_gendes_LOCAL)() = NULL; static int key_call( u_long, xdrproc_t, void *, xdrproc_t, void *); diff --git a/lib/libc/rpc/mt_misc.c b/lib/libc/rpc/mt_misc.c index 850bc5b0eb..24559a292d 100644 --- a/lib/libc/rpc/mt_misc.c +++ b/lib/libc/rpc/mt_misc.c @@ -88,12 +88,12 @@ struct rpc_createerr * __rpc_createerr(void) { static thread_key_t rce_key = 0; - struct rpc_createerr *rce_addr = 0; + struct rpc_createerr *rce_addr = NULL; if (thr_main()) return (&rpc_createerr); if ((rce_addr = - (struct rpc_createerr *)thr_getspecific(rce_key)) != 0) { + (struct rpc_createerr *)thr_getspecific(rce_key)) != NULL) { mutex_lock(&tsd_lock); if (thr_keycreate(&rce_key, free) != 0) { mutex_unlock(&tsd_lock); diff --git a/lib/libc/rpc/rpcdname.c b/lib/libc/rpc/rpcdname.c index 7abb3dc3ef..aeed0de218 100644 --- a/lib/libc/rpc/rpcdname.c +++ b/lib/libc/rpc/rpcdname.c @@ -29,7 +29,6 @@ * * @(#)rpcdname.c 1.7 91/03/11 Copyr 1989 Sun Micro * $FreeBSD: src/lib/libc/rpc/rpcdname.c,v 1.5 2004/10/16 06:11:35 obrien Exp $ - * $DragonFly: src/lib/libc/rpc/rpcdname.c,v 1.3 2005/11/13 12:27:04 swildner Exp $ */ /* @@ -43,7 +42,7 @@ #include #include "un-namespace.h" -static char *default_domain = 0; +static char *default_domain = NULL; static char * get_default_domain(void) @@ -56,7 +55,7 @@ get_default_domain(void) return (0); if ((int) strlen(temp) > 0) { default_domain = (char *)malloc((strlen(temp)+(unsigned)1)); - if (default_domain == 0) + if (default_domain == NULL) return (0); strcpy(default_domain, temp); return (default_domain); @@ -73,7 +72,7 @@ get_default_domain(void) int __rpc_get_default_domain(char **domain) { - if ((*domain = get_default_domain()) != 0) + if ((*domain = get_default_domain()) != NULL) return (0); return (-1); } diff --git a/lib/libc/stdio/fputwc.c b/lib/libc/stdio/fputwc.c index 7d3973250b..2fc90ba67c 100644 --- a/lib/libc/stdio/fputwc.c +++ b/lib/libc/stdio/fputwc.c @@ -1,5 +1,4 @@ /* $NetBSD: fputwc.c,v 1.4 2005/06/12 05:21:27 lukem Exp $ */ -/* $DragonFly: src/lib/libc/stdio/fputwc.c,v 1.1 2005/07/25 00:37:41 joerg Exp $ */ /*- * Copyright (c)2001 Citrus Project, @@ -60,7 +59,7 @@ __fputwc_unlock(wchar_t wc, FILE *fp) _SET_ORIENTATION(fp, 1); wcio = WCIO_GET(fp); - if (wcio == 0) { + if (wcio == NULL) { errno = ENOMEM; return WEOF; } diff --git a/lib/libc/stdio/ungetwc.c b/lib/libc/stdio/ungetwc.c index bb1e5f4e8f..0373a94808 100644 --- a/lib/libc/stdio/ungetwc.c +++ b/lib/libc/stdio/ungetwc.c @@ -1,5 +1,4 @@ /* $NetBSD: ungetwc.c,v 1.3 2005/06/12 05:21:27 lukem Exp $ */ -/* $DragonFly: src/lib/libc/stdio/ungetwc.c,v 1.1 2005/07/25 00:37:41 joerg Exp $ */ /*- * Copyright (c)2001 Citrus Project, @@ -59,7 +58,7 @@ ungetwc(wint_t wc, FILE *fp) /* XXX should we flush ungetc buffer? */ wcio = WCIO_GET(fp); - if (wcio == 0) { + if (wcio == NULL) { FUNLOCKFILE(fp); errno = ENOMEM; /* XXX */ return WEOF; diff --git a/lib/libc/stdlib/_strtol.h b/lib/libc/stdlib/_strtol.h index ea605640d1..c593b61180 100644 --- a/lib/libc/stdlib/_strtol.h +++ b/lib/libc/stdlib/_strtol.h @@ -1,5 +1,3 @@ -/* $DragonFly: src/lib/libc/stdlib/_strtol.h,v 1.1 2005/03/17 15:09:01 joerg Exp $ */ - /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -147,7 +145,7 @@ _FUNCNAME(const char *nptr, char **endptr, int base) } } } - if (endptr != 0) + if (endptr != NULL) /* LINTED interface specification */ *endptr = __DECONST(char *, (any ? s - 1 : nptr)); return(acc); diff --git a/lib/libc/stdlib/_strtoul.h b/lib/libc/stdlib/_strtoul.h index 2a89c1da2d..598aa50314 100644 --- a/lib/libc/stdlib/_strtoul.h +++ b/lib/libc/stdlib/_strtoul.h @@ -1,5 +1,3 @@ -/* $DragonFly: src/lib/libc/stdlib/_strtoul.h,v 1.1 2005/03/17 15:09:01 joerg Exp $ */ - /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -114,7 +112,7 @@ _FUNCNAME(const char *nptr, char **endptr, int base) } if (neg && any > 0) acc = -acc; - if (endptr != 0) + if (endptr != NULL) /* LINTED interface specification */ *endptr = __DECONST(char *, (any ? s - 1 : nptr)); return(acc); diff --git a/lib/libc/stdlib/tsearch.c b/lib/libc/stdlib/tsearch.c index ffefef9f5b..94615257aa 100644 --- a/lib/libc/stdlib/tsearch.c +++ b/lib/libc/stdlib/tsearch.c @@ -10,7 +10,6 @@ * * $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $ * $FreeBSD: src/lib/libc/stdlib/tsearch.c,v 1.4 2003/01/05 02:43:18 tjr Exp $ - * $DragonFly: src/lib/libc/stdlib/tsearch.c,v 1.6 2005/11/24 17:18:30 swildner Exp $ */ #define _SEARCH_PRIVATE @@ -47,7 +46,7 @@ tsearch(const void *vkey, void **vrootp, } q = malloc(sizeof(node_t)); /* T5: key not found */ - if (q != 0) { /* make new node */ + if (q != NULL) { /* make new node */ *rootp = q; /* link new node to old */ /* LINTED const castaway ok */ q->key = __DECONST(void *, vkey); /* initialize new node */ diff --git a/lib/libc/uuid/uuid_to_string.c b/lib/libc/uuid/uuid_to_string.c index 32e166e192..17ef12e88a 100644 --- a/lib/libc/uuid/uuid_to_string.c +++ b/lib/libc/uuid/uuid_to_string.c @@ -25,7 +25,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc/uuid/uuid_to_string.c,v 1.3 2005/01/03 02:56:15 marcel Exp $ - * $DragonFly: src/lib/libc/uuid/uuid_to_string.c,v 1.1 2007/06/16 19:57:14 dillon Exp $ */ #include @@ -50,7 +49,7 @@ uuid_to_string(const uuid_t *u, char **s, uint32_t *status) *status = uuid_s_ok; /* Why allow a NULL-pointer here? */ - if (s == 0) + if (s == NULL) return; if (u == NULL) { diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c index 39033b9f80..f39a5aa143 100644 --- a/lib/libc/xdr/xdr_mem.c +++ b/lib/libc/xdr/xdr_mem.c @@ -30,7 +30,6 @@ * @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC * $NetBSD: xdr_mem.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $ * $FreeBSD: src/lib/libc/xdr/xdr_mem.c,v 1.13 2004/10/16 06:32:43 obrien Exp $ - * $DragonFly: src/lib/libc/xdr/xdr_mem.c,v 1.4 2005/12/05 00:47:57 swildner Exp $ */ /* @@ -212,7 +211,7 @@ xdrmem_setpos(XDR *xdrs, u_int pos) static int32_t * xdrmem_inline_aligned(XDR *xdrs, u_int len) { - int32_t *buf = 0; + int32_t *buf = NULL; if (xdrs->x_handy >= len) { xdrs->x_handy -= len; diff --git a/lib/libcompat/4.1/getpw.c b/lib/libcompat/4.1/getpw.c index 1565105a1e..f0490143fc 100644 --- a/lib/libcompat/4.1/getpw.c +++ b/lib/libcompat/4.1/getpw.c @@ -30,7 +30,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/libcompat/4.1/getpw.c,v 1.5 1999/08/28 00:04:12 peter Exp $ - * $DragonFly: src/lib/libcompat/4.1/getpw.c,v 1.2 2003/06/17 04:26:48 dillon Exp $ */ #include @@ -52,7 +51,7 @@ getpw(uid, buf) pw = getpwuid(uid); endpwent(); - if(pw == 0) return -1; + if(pw == NULL) return -1; strncpy(buf, pw->pw_name, L_cuserid); return 0; diff --git a/lib/libcompat/4.3/rexec.c b/lib/libcompat/4.3/rexec.c index cf0836a1eb..5503a326ff 100644 --- a/lib/libcompat/4.3/rexec.c +++ b/lib/libcompat/4.3/rexec.c @@ -198,14 +198,14 @@ next: } break; case PASSWD: - if ((*aname == 0 || strcmp(*aname, "anonymous")) && + if ((*aname == NULL || strcmp(*aname, "anonymous")) && fstat(fileno(cfile), &stb) >= 0 && (stb.st_mode & 077) != 0) { warnx("Error: .netrc file is readable by others."); warnx("Remove password or make file unreadable by others."); goto bad; } - if (token() && *apass == 0) { + if (token() && *apass == NULL) { char *tmp; tmp = malloc(strlen(tokval) + 1); strcpy(tmp, tokval); @@ -219,7 +219,7 @@ next: warnx("Remove account or make file unreadable by others."); goto bad; } - if (token() && *aacct == 0) { + if (token() && *aacct == NULL) { *aacct = malloc((unsigned) strlen(tokval) + 1); (void) strcpy(*aacct, tokval); } @@ -354,7 +354,7 @@ retry: perror(res0->ai_canonname); return (-1); } - if (fd2p == 0) { + if (fd2p == NULL) { (void) write(s, "", 1); port = 0; } else { @@ -444,7 +444,7 @@ rexec(char **ahost, int rport, const char *name, const char *pass, char *cmd, in char *acct = NULL; hp = gethostbyname(*ahost); - if (hp == 0) { + if (hp == NULL) { herror(*ahost); return (-1); } @@ -471,7 +471,7 @@ retry: perror(hp->h_name); return (-1); } - if (fd2p == 0) { + if (fd2p == NULL) { (void) write(s, "", 1); port = 0; } else { diff --git a/lib/libcompat/regexp/regexp.c b/lib/libcompat/regexp/regexp.c index 290d009895..16b9af83b4 100644 --- a/lib/libcompat/regexp/regexp.c +++ b/lib/libcompat/regexp/regexp.c @@ -1,4 +1,3 @@ -/* $DragonFly: src/lib/libcompat/regexp/regexp.c,v 1.3 2008/09/30 16:57:04 swildner Exp $ */ /* * regcomp and regexec -- regsub and regerror are elsewhere * @@ -596,7 +595,7 @@ regatom(int *flagp) regparse--; /* Look at cur char */ ret = regnode(EXACTLY); - for ( regprev = 0 ; ; ) { + for ( regprev = NULL ; ; ) { ch = *regparse++; /* Get current char */ switch (*regparse) { /* look at next one */ diff --git a/lib/libedit/filecomplete.c b/lib/libedit/filecomplete.c index e0b333c440..d3423f3a69 100644 --- a/lib/libedit/filecomplete.c +++ b/lib/libedit/filecomplete.c @@ -421,7 +421,7 @@ fn_complete(EditLine *el, /* these can be used by function called in completion_matches() */ /* or (*attempted_completion_function)() */ - if (point != 0) + if (point != NULL) *point = li->cursor - li->buffer; if (end != NULL) *end = li->lastchar - li->buffer; @@ -431,7 +431,7 @@ fn_complete(EditLine *el, matches = (*attempted_completion_function) (temp, (int)(cur_off - len), cur_off); } else - matches = 0; + matches = NULL; if (!attempted_completion_function || (over != NULL && !*over && !matches)) matches = completion_matches(temp, complet_func); diff --git a/lib/libevtr/ktrfmt.yy.c b/lib/libevtr/ktrfmt.yy.c index 064bfe442a..b59f1872d2 100644 --- a/lib/libevtr/ktrfmt.yy.c +++ b/lib/libevtr/ktrfmt.yy.c @@ -271,7 +271,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -1142,7 +1142,7 @@ static int yy_get_next_buffer (void) } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1622,7 +1622,7 @@ YY_BUFFER_STATE __ktrfmt_scan_buffer (char * base, yy_size_t size ) b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -1798,7 +1798,7 @@ static int yy_init_globals (void) * This function is called from __ktrfmtlex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index 5aa0cf07b1..063a7d918f 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/libfetch/ftp.c,v 1.102 2008/02/08 09:48:48 des Exp $ - * $DragonFly: src/lib/libfetch/ftp.c,v 1.4 2007/08/05 21:48:12 swildner Exp $ */ /* @@ -931,7 +930,7 @@ ftp_authenticate(conn_t *conn, struct url *url, struct url *purl) if (*pwd == '\0') pwd = getenv("FTP_PASSWORD"); if (pwd == NULL || *pwd == '\0') { - if ((logname = getlogin()) == 0) + if ((logname = getlogin()) == NULL) logname = FTP_ANONYMOUS_USER; if ((len = snprintf(pbuf, MAXLOGNAME + 1, "%s@", logname)) < 0) len = 0; diff --git a/lib/libipsec/pfkey.c b/lib/libipsec/pfkey.c index ee881bc363..895c4af00a 100644 --- a/lib/libipsec/pfkey.c +++ b/lib/libipsec/pfkey.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/lib/libipsec/pfkey.c,v 1.1.2.2 2001/07/03 11:01:14 ume Exp $ */ -/* $DragonFly: src/lib/libipsec/pfkey.c,v 1.4 2003/11/13 02:39:42 drhodus Exp $ */ /* $KAME: pfkey.c,v 1.39 2001/03/05 18:22:17 thorpej Exp $ */ /* @@ -1642,7 +1641,7 @@ pfkey_recv(so) /* read real message */ reallen = PFKEY_UNUNIT64(buf.sadb_msg_len); - if ((newmsg = CALLOC(reallen, struct sadb_msg *)) == 0) { + if ((newmsg = CALLOC(reallen, struct sadb_msg *)) == NULL) { __ipsec_set_strerror(strerror(errno)); return NULL; } diff --git a/lib/libipx/ipx_addr.c b/lib/libipx/ipx_addr.c index 8abeaaaaec..0429146b60 100644 --- a/lib/libipx/ipx_addr.c +++ b/lib/libipx/ipx_addr.c @@ -34,7 +34,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libipx/ipx_addr.c,v 1.2.8.1 2001/03/05 06:21:40 kris Exp $ - * $DragonFly: src/lib/libipx/ipx_addr.c,v 1.4 2005/08/04 17:27:09 drhodus Exp $ * * @(#)ipx_addr.c */ @@ -69,7 +68,7 @@ ipx_addr(const char *name) else { hostname = strchr(buf, '.'); if ((cp = strchr(buf, ':')) && - ((hostname && cp < hostname) || (hostname == 0))) { + ((hostname && cp < hostname) || (hostname == NULL))) { hostname = cp; separator = ':'; } else @@ -80,7 +79,7 @@ ipx_addr(const char *name) addr = zero_addr; Field(buf, addr.x_net.c_net, 4); - if (hostname == 0) + if (hostname == NULL) return (addr); /* No separator means net only */ socketname = strchr(hostname, separator); diff --git a/lib/libkcore/kcore_proc.c b/lib/libkcore/kcore_proc.c index 9a1539765f..ee4e0e82b6 100644 --- a/lib/libkcore/kcore_proc.c +++ b/lib/libkcore/kcore_proc.c @@ -30,8 +30,6 @@ * 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. - * - * $DragonFly: src/lib/libkcore/kcore_proc.c,v 1.2 2007/04/29 01:36:03 dillon Exp $ */ #include /* MUST BE FIRST */ @@ -64,7 +62,7 @@ kcore_get_procs(struct kcore_data *kc, struct kinfo_proc **procs, size_t *len) } if (nlen == 0) { procs = NULL; - len = 0; + len = NULL; } *procs = malloc(sizeof(struct kinfo_proc) * nlen); if (*procs == NULL) diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 6069b8ccf5..c486eef059 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -36,7 +36,6 @@ * * @(#)kvm.c 8.2 (Berkeley) 2/13/94 * $FreeBSD: src/lib/libkvm/kvm.c,v 1.12.2.3 2002/09/13 14:53:43 nectar Exp $ - * $DragonFly: src/lib/libkvm/kvm.c,v 1.12 2008/02/13 00:12:46 corecode Exp $ */ #include /* MUST BE FIRST */ @@ -163,7 +162,7 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, int flag, char *errout) kd->argv = 0; kd->flags = 0; - if (uf == 0) + if (uf == NULL) uf = getbootfile(); else if (strlen(uf) >= MAXPATHLEN) { _kvm_err(kd, kd->program, "exec file name too long"); @@ -173,7 +172,7 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, int flag, char *errout) _kvm_err(kd, kd->program, "bad flags arg"); goto failed; } - if (mf == 0) + if (mf == NULL) mf = _PATH_MEM; if ((kd->pmfd = open(mf, flag, 0)) < 0) { @@ -250,7 +249,7 @@ failed: /* * Copy out the error if doing sane error semantics. */ - if (errout != 0) + if (errout != NULL) strlcpy(errout, kd->errbuf, _POSIX2_LINE_MAX); (void)kvm_close(kd); return (0); diff --git a/lib/libkvm/kvm_file.c b/lib/libkvm/kvm_file.c index 09ef27ddff..0b18810497 100644 --- a/lib/libkvm/kvm_file.c +++ b/lib/libkvm/kvm_file.c @@ -32,7 +32,6 @@ * * @(#)kvm_file.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libkvm/kvm_file.c,v 1.11 2000/02/18 16:39:00 peter Exp $ - * $DragonFly: src/lib/libkvm/kvm_file.c,v 1.5 2007/05/13 18:33:56 swildner Exp $ */ /* @@ -94,7 +93,7 @@ kvm_deadfiles(kvm_t *kd, int op, int arg, long filehead_o, int nfiles) /* * followed by an array of file structures */ - for (fp = filehead.lh_first; fp != 0; fp = fp->f_list.le_next) { + for (fp = filehead.lh_first; fp != NULL; fp = fp->f_list.le_next) { if (buflen > sizeof (struct file)) { if (KREAD(kd, (long)fp, ((struct file *)where))) { _kvm_err(kd, kd->program, "can't read kfp"); diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index 5f63ba2589..888ec32b01 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -36,7 +36,6 @@ * * @(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libkvm/kvm_i386.c,v 1.11.2.1 2001/09/21 04:01:51 peter Exp $ - * $DragonFly: src/lib/libkvm/kvm_i386.c,v 1.3 2007/04/29 01:36:04 dillon Exp $ */ /* @@ -250,7 +249,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) * If we are initializing (kernel page table descriptor pointer * not yet set) then return pa == va to avoid infinite recursion. */ - if (PTD == 0) { + if (PTD == NULL) { s = _kvm_pa2off(kd, va, pa); if (s == 0) { _kvm_err(kd, kd->program, diff --git a/lib/libkvm/kvm_minidump_i386.c b/lib/libkvm/kvm_minidump_i386.c index a49ff204ba..7a5937605f 100644 --- a/lib/libkvm/kvm_minidump_i386.c +++ b/lib/libkvm/kvm_minidump_i386.c @@ -139,7 +139,7 @@ _kvm_minidump_initvtop(kvm_t *kd) off_t off; vmst = _kvm_malloc(kd, sizeof(*vmst)); - if (vmst == 0) { + if (vmst == NULL) { _kvm_err(kd, kd->program, "cannot allocate vm"); return (-1); } diff --git a/lib/libkvm/kvm_minidump_x86_64.c b/lib/libkvm/kvm_minidump_x86_64.c index 71d57447d9..ad87c85127 100644 --- a/lib/libkvm/kvm_minidump_x86_64.c +++ b/lib/libkvm/kvm_minidump_x86_64.c @@ -138,7 +138,7 @@ _kvm_minidump_initvtop(kvm_t *kd) off_t off; vmst = _kvm_malloc(kd, sizeof(*vmst)); - if (vmst == 0) { + if (vmst == NULL) { _kvm_err(kd, kd->program, "cannot allocate vm"); return (-1); } diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index 2ccef66a35..2928eb775a 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -35,7 +35,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libkvm/kvm_proc.c,v 1.25.2.3 2002/08/24 07:27:46 kris Exp $ - * $DragonFly: src/lib/libkvm/kvm_proc.c,v 1.18 2008/06/05 18:06:30 swildner Exp $ * * @(#)kvm_proc.c 8.3 (Berkeley) 9/23/93 */ @@ -542,7 +541,7 @@ _kvm_realloc(kvm_t *kd, void *p, size_t n) { void *np = (void *)realloc(p, n); - if (np == 0) { + if (np == NULL) { free(p); _kvm_err(kd, kd->program, "out of memory"); } @@ -639,7 +638,7 @@ kvm_argv(kvm_t *kd, pid_t pid, u_long addr, int narg, int maxcnt) * that crosses a page boundary. We copy the next part of the string * into to "np" and eventually convert the pointer. */ - while (argv < kd->argv + narg && *argv != 0) { + while (argv < kd->argv + narg && *argv != NULL) { /* get the address that the current argv string is on */ addr = (u_long)*argv & ~(PAGE_SIZE - 1); @@ -665,7 +664,7 @@ kvm_argv(kvm_t *kd, pid_t pid, u_long addr, int narg, int maxcnt) /* pointer to end of string if we found it in this page */ ep = memchr(cp, '\0', cc); - if (ep != 0) + if (ep != NULL) cc = ep - cp + 1; /* * at this point, cc is the count of the chars that we are @@ -707,7 +706,7 @@ kvm_argv(kvm_t *kd, pid_t pid, u_long addr, int narg, int maxcnt) * to the target process, but when we close it off, we set * it to point in our address space. */ - if (ep != 0) { + if (ep != NULL) { *argv++ = ap; ap = np; } else { @@ -720,7 +719,7 @@ kvm_argv(kvm_t *kd, pid_t pid, u_long addr, int narg, int maxcnt) * We're stopping prematurely. Terminate the * current string. */ - if (ep == 0) { + if (ep == NULL) { *np = '\0'; *argv++ = ap; } @@ -728,7 +727,7 @@ kvm_argv(kvm_t *kd, pid_t pid, u_long addr, int narg, int maxcnt) } } /* Make sure argv is terminated. */ - *argv = 0; + *argv = NULL; return (kd->argv); } @@ -807,9 +806,9 @@ kvm_doargv(kvm_t *kd, const struct kinfo_proc *kp, int nchr, /* * For live kernels, make sure this process didn't go away. */ - if (ap != 0 && (kvm_ishost(kd) || kvm_isvkernel(kd)) && + if (ap != NULL && (kvm_ishost(kd) || kvm_isvkernel(kd)) && !proc_verify(kd, kp)) - ap = 0; + ap = NULL; return (ap); } @@ -866,7 +865,7 @@ kvm_getargv(kvm_t *kd, const struct kinfo_proc *kp, int nchr) sizeof(char *) * argc); } } while (p < buf + bufsz); - bufp[i++] = 0; + bufp[i++] = NULL; return (bufp); } } diff --git a/lib/libkvm/kvm_sparc.c b/lib/libkvm/kvm_sparc.c index 23f0d567cd..1b1930ef9d 100644 --- a/lib/libkvm/kvm_sparc.c +++ b/lib/libkvm/kvm_sparc.c @@ -36,7 +36,6 @@ * * @(#)kvm_sparc.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libkvm/kvm_sparc.c,v 1.3 1999/12/27 07:14:58 peter Exp $ - * $DragonFly: src/lib/libkvm/kvm_sparc.c,v 1.4 2007/04/29 01:36:04 dillon Exp $ */ /* @@ -92,7 +91,7 @@ _kvm_initvtop(kvm_t *kd) struct nlist nlist[2]; vm = (struct vmstate *)_kvm_malloc(kd, sizeof(*vm)); - if (vm == 0) + if (vm == NULL) return (-1); kd->vmst = vm; diff --git a/lib/libkvm/kvm_x86_64.c b/lib/libkvm/kvm_x86_64.c index eb15a91476..a1499eefa4 100644 --- a/lib/libkvm/kvm_x86_64.c +++ b/lib/libkvm/kvm_x86_64.c @@ -250,7 +250,7 @@ _kvm_vatop(kvm_t *kd, u_long va, off_t *pa) * If we are initializing (kernel page table descriptor pointer * not yet set) then return pa == va to avoid infinite recursion. */ - if (vm->PML4 == 0) { + if (vm->PML4 == NULL) { s = _kvm_pa2off(kd, va, pa); if (s == 0) { _kvm_err(kd, kd->program, diff --git a/lib/libm/src/e_j0.c b/lib/libm/src/e_j0.c index c1203ca7cd..d7abd31475 100644 --- a/lib/libm/src/e_j0.c +++ b/lib/libm/src/e_j0.c @@ -57,6 +57,7 @@ * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0. */ +#include #include #include "math_private.h" @@ -273,7 +274,7 @@ pzero(double x) double z,r,s; int32_t ix; - p = q = 0; + p = q = NULL; GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; if(ix>=0x40200000) {p = pR8; q= pS8;} @@ -371,7 +372,7 @@ qzero(double x) double s,r,z; int32_t ix; - p = q = 0; + p = q = NULL; GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; if(ix>=0x40200000) {p = qR8; q= qS8;} diff --git a/lib/libm/src/e_j0f.c b/lib/libm/src/e_j0f.c index d0a97df806..510756d7fe 100644 --- a/lib/libm/src/e_j0f.c +++ b/lib/libm/src/e_j0f.c @@ -15,6 +15,7 @@ * $NetBSD: e_j0f.c,v 1.10 2007/08/20 16:01:38 drochner Exp $ */ +#include #include #include "math_private.h" @@ -236,7 +237,7 @@ pzerof(float x) float z,r,s; int32_t ix; - p = q = 0; + p = q = NULL; GET_FLOAT_WORD(ix,x); ix &= 0x7fffffff; if(ix>=0x41000000) {p = pR8; q= pS8;} @@ -334,7 +335,7 @@ qzerof(float x) float s,r,z; int32_t ix; - p = q = 0; + p = q = NULL; GET_FLOAT_WORD(ix,x); ix &= 0x7fffffff; if(ix>=0x41000000) {p = qR8; q= qS8;} diff --git a/lib/libm/src/e_j1.c b/lib/libm/src/e_j1.c index c66d26d999..b5ee297735 100644 --- a/lib/libm/src/e_j1.c +++ b/lib/libm/src/e_j1.c @@ -57,6 +57,7 @@ * by method mentioned above. */ +#include #include #include "math_private.h" @@ -267,7 +268,7 @@ pone(double x) double z,r,s; int32_t ix; - p = q = 0; + p = q = NULL; GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; if(ix>=0x40200000) {p = pr8; q= ps8;} @@ -366,7 +367,7 @@ qone(double x) double s,r,z; int32_t ix; - p = q = 0; + p = q = NULL; GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; if(ix>=0x40200000) {p = qr8; q= qs8;} diff --git a/lib/libm/src/e_j1f.c b/lib/libm/src/e_j1f.c index f595bf1d2f..f5bc513c8c 100644 --- a/lib/libm/src/e_j1f.c +++ b/lib/libm/src/e_j1f.c @@ -15,6 +15,7 @@ * $NetBSD: e_j1f.c,v 1.11 2007/08/20 16:01:38 drochner Exp $ */ +#include #include #include "math_private.h" @@ -228,7 +229,7 @@ ponef(float x) float z,r,s; int32_t ix; - p = q = 0; + p = q = NULL; GET_FLOAT_WORD(ix,x); ix &= 0x7fffffff; if(ix>=0x41000000) {p = pr8; q= ps8;} @@ -327,7 +328,7 @@ qonef(float x) float s,r,z; int32_t ix; - p = q = 0; + p = q = NULL; GET_FLOAT_WORD(ix,x); ix &= 0x7fffffff; /* [inf, 8] (8 41000000) */ diff --git a/lib/libpuffs/null.c b/lib/libpuffs/null.c index 42f8d9fdb6..0a67340af1 100644 --- a/lib/libpuffs/null.c +++ b/lib/libpuffs/null.c @@ -402,7 +402,7 @@ puffs_null_node_fsync(struct puffs_usermount *pu, puffs_cookie_t opc, return errno; if (S_ISDIR(sb.st_mode)) { DIR *dirp; - if ((dirp = opendir(PNPATH(pn))) == 0) + if ((dirp = opendir(PNPATH(pn))) == NULL) return errno; fd = dirfd(dirp); if (fd == -1) diff --git a/lib/libstand/cd9660.c b/lib/libstand/cd9660.c index ed5cbc7ed0..195d975ecf 100644 --- a/lib/libstand/cd9660.c +++ b/lib/libstand/cd9660.c @@ -30,7 +30,6 @@ * * $NetBSD: cd9660.c,v 1.5 1997/06/26 19:11:33 drochner Exp $ * $FreeBSD: src/lib/libstand/cd9660.c,v 1.4.2.4 2001/12/21 22:17:44 jhb Exp $ - * $DragonFly: src/lib/libstand/cd9660.c,v 1.6 2005/12/11 02:27:26 swildner Exp $ */ /* @@ -287,13 +286,13 @@ dirmatch(struct open_file *f, const char *path, struct iso_directory_record *dp, static int cd9660_open(const char *path, struct open_file *f) { - struct file *fp = 0; + struct file *fp = NULL; void *buf; struct iso_primary_descriptor *vd; size_t buf_size, read, dsize, off; daddr_t bno, boff; struct iso_directory_record rec; - struct iso_directory_record *dp = 0; + struct iso_directory_record *dp = NULL; int rc, first, use_rrip, lenskip; /* First find the volume descriptor */ diff --git a/lib/libstand/nfs.c b/lib/libstand/nfs.c index 1ee2fd3c06..a0e1936b81 100644 --- a/lib/libstand/nfs.c +++ b/lib/libstand/nfs.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/lib/libstand/nfs.c,v 1.2.6.3 2000/09/10 01:33:25 ps Exp $ */ -/* $DragonFly: src/lib/libstand/nfs.c,v 1.4 2005/12/11 02:27:26 swildner Exp $ */ /* $NetBSD: nfs.c,v 1.2 1998/01/24 12:43:09 drochner Exp $ */ /*- @@ -411,7 +410,7 @@ nfs_open(const char *upath, struct open_file *f) fa->fa_nlink = htonl(2); currfd = &nfs_root_node; - newfd = 0; + newfd = NULL; cp = path = strdup(upath); if (path == NULL) { @@ -497,7 +496,7 @@ nfs_open(const char *upath, struct open_file *f) } free(newfd); - newfd = 0; + newfd = NULL; continue; } @@ -505,7 +504,7 @@ nfs_open(const char *upath, struct open_file *f) if (currfd != &nfs_root_node) free(currfd); currfd = newfd; - newfd = 0; + newfd = NULL; } error = 0; diff --git a/lib/libstand/strtol.c b/lib/libstand/strtol.c index f6c0358bd3..dbd0a85c5f 100644 --- a/lib/libstand/strtol.c +++ b/lib/libstand/strtol.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * @(#)strtol.c 8.1 (Berkeley) 6/4/93 - * $DragonFly: src/lib/libstand/strtol.c,v 1.4 2005/12/11 02:27:26 swildner Exp $ */ #include "stand.h" @@ -123,7 +122,7 @@ strtol(const char *nptr, char **endptr, int base) errno = ERANGE; } else if (neg) acc = -acc; - if (endptr != 0) + if (endptr != NULL) *endptr = (char *)(any ? s - 1 : nptr); return (acc); } diff --git a/lib/libtelnet/auth.c b/lib/libtelnet/auth.c index 1156e35129..da0d025720 100644 --- a/lib/libtelnet/auth.c +++ b/lib/libtelnet/auth.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/crypto/telnet/libtelnet/auth.c,v 1.3.2.5 2002/04/13 10:59:07 markm Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/auth.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ * * @(#)auth.c 8.3 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/libtelnet/auth.c,v 1.3.2.5 2002/04/13 10:59:07 markm Exp $ @@ -96,7 +95,7 @@ extern rsaencpwd_printsub(); int auth_debug_mode = 0; static const char *Name = "Noname"; static int Server = 0; -static Authenticator *authenticated = 0; +static Authenticator *authenticated = NULL; static int authenticating = 0; static int validuser = 0; static unsigned char _auth_send_data[256]; @@ -202,7 +201,7 @@ auth_init(const char *name, int server) Name = name; i_support = 0; - authenticated = 0; + authenticated = NULL; authenticating = 0; while (ap->type) { if (!ap->init || (*ap->init)(ap, server)) { diff --git a/lib/libtelnet/encrypt.c b/lib/libtelnet/encrypt.c index 49f513be82..8684ce3607 100644 --- a/lib/libtelnet/encrypt.c +++ b/lib/libtelnet/encrypt.c @@ -32,7 +32,6 @@ * * @(#)encrypt.c 8.2 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/libtelnet/encrypt.c,v 1.3.2.2 2002/04/13 10:59:07 markm Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/encrypt.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ /* @@ -188,8 +187,8 @@ encrypt_init(const char *name, int server) remote_supports_encrypt = remote_supports_decrypt = 0; encrypt_mode = 0; decrypt_mode = 0; - encrypt_output = 0; - decrypt_input = 0; + encrypt_output = NULL; + decrypt_input = NULL; str_suplen = 4; @@ -245,18 +244,18 @@ EncryptDisable(char *type, char *mode) printf("Usage: encrypt disable [input|output]\n"); encrypt_list_types(); } else if ((ep = (Encryptions *)genget(type, (char **)encryptions, - sizeof(Encryptions))) == 0) { + sizeof(Encryptions))) == NULL) { printf("%s: invalid encryption type\n", type); } else if (Ambiguous((char **)ep)) { printf("Ambiguous type '%s'\n", type); } else { - if ((mode == 0) || (isprefix(mode, "input") ? 1 : 0)) { + if ((mode == NULL) || (isprefix(mode, "input") ? 1 : 0)) { if (decrypt_mode == ep->type) EncryptStopInput(); i_wont_support_decrypt |= typemask(ep->type); ret = 1; } - if ((mode == 0) || (isprefix(mode, "output"))) { + if ((mode == NULL) || (isprefix(mode, "output"))) { if (encrypt_mode == ep->type) EncryptStopOutput(); i_wont_support_encrypt |= typemask(ep->type); @@ -278,17 +277,17 @@ EncryptType(char *type, char *mode) printf("Usage: encrypt type [input|output]\n"); encrypt_list_types(); } else if ((ep = (Encryptions *)genget(type, (char **)encryptions, - sizeof(Encryptions))) == 0) { + sizeof(Encryptions))) == NULL) { printf("%s: invalid encryption type\n", type); } else if (Ambiguous((char **)ep)) { printf("Ambiguous type '%s'\n", type); } else { - if ((mode == 0) || isprefix(mode, "input")) { + if ((mode == NULL) || isprefix(mode, "input")) { decrypt_mode = ep->type; i_wont_support_decrypt &= ~typemask(ep->type); ret = 1; } - if ((mode == 0) || isprefix(mode, "output")) { + if ((mode == NULL) || isprefix(mode, "output")) { encrypt_mode = ep->type; i_wont_support_encrypt &= ~typemask(ep->type); ret = 1; @@ -660,7 +659,7 @@ encrypt_session_key( Session_Key *key, int server) void encrypt_end(void) { - decrypt_input = 0; + decrypt_input = NULL; if (encrypt_debug_mode) printf(">>>%s: Input is back to clear text\r\n", Name); if (encrypt_verbose) @@ -862,7 +861,7 @@ encrypt_send_end(void) * Encrypt the output buffer now because it will not be done by * netflush... */ - encrypt_output = 0; + encrypt_output = NULL; if (encrypt_debug_mode) printf(">>>%s: Output is back to clear text\r\n", Name); if (encrypt_verbose) diff --git a/lib/libtelnet/genget.c b/lib/libtelnet/genget.c index d9404925a2..3a8ac518d0 100644 --- a/lib/libtelnet/genget.c +++ b/lib/libtelnet/genget.c @@ -32,9 +32,9 @@ * * @(#)genget.c 8.2 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/libtelnet/genget.c,v 1.2.8.2 2002/04/13 10:59:07 markm Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/genget.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ +#include #include #include "misc-proto.h" @@ -74,11 +74,11 @@ genget(char *name, char **table, int stlen) char **c, **found; int n; - if (name == 0) + if (name == NULL) return 0; - found = 0; - for (c = table; *c != 0; c = (char **)((char *)c + stlen)) { + found = NULL; + for (c = table; *c != NULL; c = (char **)((char *)c + stlen)) { if ((n = isprefix(name, *c)) == 0) continue; if (n < 0) /* exact match */ diff --git a/lib/libtelnet/kerberos5.c b/lib/libtelnet/kerberos5.c index b7a404d71c..dff9678854 100644 --- a/lib/libtelnet/kerberos5.c +++ b/lib/libtelnet/kerberos5.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/crypto/telnet/libtelnet/kerberos5.c,v 1.1.1.1.8.2 2003/04/24 19:13:59 nectar Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/kerberos5.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ /* @@ -447,7 +446,7 @@ kerberos5_is(Authenticator *ap, unsigned char *data, int cnt) Data(ap, KRB_RESPONSE, outbuf.data, outbuf.length); } if (krb5_unparse_name(context, ticket->client, &name)) - name = 0; + name = NULL; if(UserNameRequested && krb5_kuserok(context, ticket->client, diff --git a/lib/libtelnet/krb4encpwd.c b/lib/libtelnet/krb4encpwd.c index 0eb969cf73..0924c56411 100644 --- a/lib/libtelnet/krb4encpwd.c +++ b/lib/libtelnet/krb4encpwd.c @@ -32,7 +32,6 @@ * * @(#)krb4encpwd.c 8.3 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/libtelnet/krb4encpwd.c,v 1.3.2.1 2002/04/13 10:59:07 markm Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/krb4encpwd.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ #ifdef KRB4_ENCPWD @@ -208,7 +207,7 @@ krb4encpwd_is(ap, data, cnt) memmove((void *)auth.dat, (void *)data, auth.length = cnt); gethostname(lhostname, sizeof(lhostname)); - if ((cp = strchr(lhostname, '.')) != 0) *cp = '\0'; + if ((cp = strchr(lhostname, '.')) != NULL) *cp = '\0'; if (r = krb_rd_encpwd_req(&auth, KRB_SERVICE_NAME, lhostname, 0, &adat, NULL, challenge, r_user, r_passwd)) { Data(ap, KRB4_ENCPWD_REJECT, (void *)"Auth failed", -1); @@ -307,7 +306,7 @@ krb4encpwd_reply(ap, data, cnt) UserPassword = user_passwd; Challenge = challenge; strcpy(instance, RemoteHostName); - if ((cp = strchr(instance, '.')) != 0) *cp = '\0'; + if ((cp = strchr(instance, '.')) != NULL) *cp = '\0'; if (r = krb_mk_encpwd_req(&krb_token, KRB_SERVICE_NAME, instance, realm, Challenge, UserNameRequested, user_passwd)) { krb_token.length = 0; diff --git a/lib/libtelnet/misc.c b/lib/libtelnet/misc.c index 1d60dc0d99..2585d2cf1f 100644 --- a/lib/libtelnet/misc.c +++ b/lib/libtelnet/misc.c @@ -32,7 +32,6 @@ * * @(#)misc.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/crypto/telnet/libtelnet/misc.c,v 1.2.8.2 2002/04/13 10:59:07 markm Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/misc.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ #include @@ -49,7 +48,7 @@ char *RemoteHostName; char *LocalHostName; -char *UserNameRequested = 0; +char *UserNameRequested = NULL; int ConnectedCount = 0; #ifndef AUTHENTICATION diff --git a/lib/libtelnet/pk.c b/lib/libtelnet/pk.c index 670b0a2bd9..f28ac8924d 100644 --- a/lib/libtelnet/pk.c +++ b/lib/libtelnet/pk.c @@ -28,7 +28,6 @@ * * * $FreeBSD: src/crypto/telnet/libtelnet/pk.c,v 1.2.2.4 2002/08/24 07:28:35 nsayer Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/pk.c,v 1.5 2005/07/18 16:43:26 joerg Exp $ */ /* public key routines */ @@ -170,7 +169,7 @@ getseed(char *seed, int seedsize) static BIGNUM * itobn(long i) { - BIGNUM *n = 0; + BIGNUM *n = NULL; if ((n = BN_new()) == NULL) errx(1, "could not create BIGNUM: %s", diff --git a/lib/libtelnet/rsaencpwd.c b/lib/libtelnet/rsaencpwd.c index 39551265b2..81d6b6857f 100644 --- a/lib/libtelnet/rsaencpwd.c +++ b/lib/libtelnet/rsaencpwd.c @@ -32,7 +32,6 @@ * * @(#)rsaencpwd.c 8.3 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/libtelnet/rsaencpwd.c,v 1.1.1.1.8.1 2002/04/13 10:59:07 markm Exp $ - * $DragonFly: src/crypto/telnet/libtelnet/rsaencpwd.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ #ifdef RSA_ENCPWD @@ -152,7 +151,7 @@ rsaencpwd_init(ap, server) str_data[3] = TELQUAL_REPLY; memset(key_file, 0, sizeof(key_file)); gethostname(lhostname, sizeof(lhostname)); - if ((cp = strchr(lhostname, '.')) != 0) *cp = '\0'; + if ((cp = strchr(lhostname, '.')) != NULL) *cp = '\0'; strcpy(key_file, "/etc/."); strcat(key_file, lhostname); strcat(key_file, "_privkey"); diff --git a/lib/libthread_xu/thread/thr_private.h b/lib/libthread_xu/thread/thr_private.h index 6633085041..64aabcb743 100644 --- a/lib/libthread_xu/thread/thr_private.h +++ b/lib/libthread_xu/thread/thr_private.h @@ -786,13 +786,13 @@ _thr_isthreaded(void) static inline int _thr_is_inited(void) { - return (_thr_initial != 0); + return (_thr_initial != NULL); } static inline void _thr_check_init(void) { - if (_thr_initial == 0) + if (_thr_initial == NULL) _libpthread_init(0); } diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c index 29a8ab6d52..de25076ce9 100644 --- a/lib/libusbhid/usage.c +++ b/lib/libusbhid/usage.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libusbhid/usage.c,v 1.8 2003/04/09 01:52:48 mdodd Exp $ - * $DragonFly: src/lib/libusbhid/usage.c,v 1.3 2008/11/24 17:15:17 hasso Exp $ */ #include @@ -76,9 +75,9 @@ hid_init(const char *hidname) char line[100], name[100], *p, *n; int no; int lineno; - struct usage_page *curpage = 0; + struct usage_page *curpage = NULL; - if (hidname == 0) + if (hidname == NULL) hidname = _PATH_HIDTABLE; f = fopen(hidname, "r"); @@ -123,7 +122,7 @@ hid_init(const char *hidname) curpage->pagesize++; } else { if (npages >= npagesmax) { - if (pages == 0) { + if (pages == NULL) { npagesmax = 5; pages = malloc(npagesmax * sizeof (struct usage_page)); diff --git a/lib/libvgl/text.c b/lib/libvgl/text.c index 3cc4491094..a96daeaf56 100644 --- a/lib/libvgl/text.c +++ b/lib/libvgl/text.c @@ -26,14 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/libvgl/text.c,v 1.4 1999/11/08 11:37:39 yokota Exp $ - * $DragonFly: src/lib/libvgl/text.c,v 1.2 2003/06/17 04:26:52 dillon Exp $ */ #include #include #include "vgl.h" -static VGLText *VGLTextFont = 0; +static VGLText *VGLTextFont = NULL; extern byte VGLFont[]; diff --git a/lib/libypclnt/ypclnt_passwd.c b/lib/libypclnt/ypclnt_passwd.c index c95ed38b59..d17a4b95c2 100644 --- a/lib/libypclnt/ypclnt_passwd.c +++ b/lib/libypclnt/ypclnt_passwd.c @@ -65,7 +65,7 @@ int ypclnt_havepasswdd(ypclnt_t *ypclnt) { struct netconfig *nc = NULL; - void *localhandle = 0; + void *localhandle = NULL; CLIENT *clnt = NULL; int ret; @@ -139,7 +139,7 @@ yppasswd_local(ypclnt_t *ypclnt, const struct passwd *pwd) struct master_yppasswd yppwd; struct rpc_err rpcerr; struct netconfig *nc = NULL; - void *localhandle = 0; + void *localhandle = NULL; CLIENT *clnt = NULL; int ret, *result; diff --git a/lib/pam_module/pam_login_access/login_access.c b/lib/pam_module/pam_login_access/login_access.c index 2ea59884c2..0d90fdfe04 100644 --- a/lib/pam_module/pam_login_access/login_access.c +++ b/lib/pam_module/pam_login_access/login_access.c @@ -117,7 +117,7 @@ list_match(char *list, const char *item, * the match is affected by any exceptions. */ - for (tok = strtok(list, sep); tok != 0; tok = strtok(NULL, sep)) { + for (tok = strtok(list, sep); tok != NULL; tok = strtok(NULL, sep)) { if (strcasecmp(tok, "EXCEPT") == 0) /* EXCEPT: give up */ break; if ((match = (*match_fn)(tok, item)) != 0) /* YES */ @@ -128,7 +128,7 @@ list_match(char *list, const char *item, if (match != NO) { while ((tok = strtok(NULL, sep)) && strcasecmp(tok, "EXCEPT")) /* VOID */ ; - if (tok == 0 || list_match(NULL, item, match_fn) == NO) + if (tok == NULL || list_match(NULL, item, match_fn) == NO) return (match); } return (NO); diff --git a/libexec/bootpd/tools/bootptest/print-bootp.c b/libexec/bootpd/tools/bootptest/print-bootp.c index 3521ff45e2..cc8ac63765 100644 --- a/libexec/bootpd/tools/bootptest/print-bootp.c +++ b/libexec/bootpd/tools/bootptest/print-bootp.c @@ -24,7 +24,6 @@ * There is an e-mail list for tcpdump: * * $FreeBSD: src/libexec/bootpd/tools/bootptest/print-bootp.c,v 1.6.2.1 2001/10/14 21:39:54 iedowse Exp $ - * $DragonFly: src/libexec/bootpd/tools/bootptest/print-bootp.c,v 1.2 2003/06/17 04:27:07 dillon Exp $ */ #include @@ -109,8 +108,8 @@ bootp_print(struct bootp *bp, int length, u_short sport, u_short dport) else if (bp->bp_op == BOOTREPLY) e = (char *) EDST(eh); else - e = 0; - if (e == 0 || bcmp((char *) bp->bp_chaddr, e, 6)) + e = NULL; + if (e == NULL || bcmp((char *) bp->bp_chaddr, e, 6)) dump_hex(bp->bp_chaddr, bp->bp_hlen); } /* Only print interesting fields */ diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 3bf820f7cc..623ce4ce53 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -32,7 +32,6 @@ * * @(#)ftpd.c 8.4 (Berkeley) 4/16/94 * $FreeBSD: src/libexec/ftpd/ftpd.c,v 1.213 2008/12/23 01:23:09 cperciva Exp $ - * $DragonFly: src/libexec/ftpd/ftpd.c,v 1.7 2005/10/28 18:06:57 joerg Exp $ */ /* @@ -1653,7 +1652,7 @@ retrieve(char *cmd, char *name) int (*closefunc)(FILE *); time_t start; - if (cmd == 0) { + if (cmd == NULL) { fin = fopen(name, "r"), closefunc = fclose; st.st_size = 0; } else { @@ -1667,14 +1666,14 @@ retrieve(char *cmd, char *name) if (fin == NULL) { if (errno != 0) { perror_reply(550, name); - if (cmd == 0) { + if (cmd == NULL) { LOGCMD("get", name); } } return; } byte_count = -1; - if (cmd == 0) { + if (cmd == NULL) { if (fstat(fileno(fin), &st) < 0) { perror_reply(550, name); goto done; @@ -1720,14 +1719,14 @@ retrieve(char *cmd, char *name) goto done; time(&start); send_data(fin, dout, st.st_blksize, st.st_size, - restart_point == 0 && cmd == 0 && S_ISREG(st.st_mode)); - if (cmd == 0 && guest && stats && byte_count > 0) + restart_point == 0 && cmd == NULL && S_ISREG(st.st_mode)); + if (cmd == NULL && guest && stats && byte_count > 0) logxfer(name, byte_count, start); fclose(dout); data = -1; pdata = -1; done: - if (cmd == 0) + if (cmd == NULL) LOGBYTES("get", name, byte_count); (*closefunc)(fin); } diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c index 4c2f3c3035..036f2bbeb8 100644 --- a/libexec/ftpd/popen.c +++ b/libexec/ftpd/popen.c @@ -35,7 +35,6 @@ * * @(#)popen.c 8.3 (Berkeley) 4/6/94 * $FreeBSD: src/libexec/ftpd/popen.c,v 1.26 2004/11/18 13:46:29 yar Exp $ - * $DragonFly: src/libexec/ftpd/popen.c,v 1.3 2006/01/12 13:43:10 corecode Exp $ */ #include @@ -181,7 +180,7 @@ ftpd_pclose(FILE *iop) * pclose returns -1 if stream is not associated with a * `popened' command, or, if already `pclosed'. */ - if (pids == 0 || pids[fdes = fileno(iop)] == 0) + if (pids == NULL || pids[fdes = fileno(iop)] == 0) return (-1); fclose(iop); omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c index 7c8b086d2b..3b02be4301 100644 --- a/libexec/getty/subr.c +++ b/libexec/getty/subr.c @@ -32,7 +32,6 @@ * * @(#)from: subr.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/libexec/getty/subr.c,v 1.16.2.1 2001/05/12 10:16:51 kris Exp $ - * $DragonFly: src/libexec/getty/subr.c,v 1.4 2004/03/26 00:30:12 cpressey Exp $ */ /* @@ -78,7 +77,7 @@ gettable(const char *name, char *buf) static int firsttime = 1; dba[0] = _PATH_GETTYTAB; - dba[1] = 0; + dba[1] = NULL; if (firsttime) { /* diff --git a/libexec/rbootd/bpf.c b/libexec/rbootd/bpf.c index d69b2aaf0c..f59778a952 100644 --- a/libexec/rbootd/bpf.c +++ b/libexec/rbootd/bpf.c @@ -45,7 +45,6 @@ * * @(#)bpf.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/libexec/rbootd/bpf.c,v 1.10 1999/08/28 00:09:44 peter Exp $ - * $DragonFly: src/libexec/rbootd/bpf.c,v 1.2 2003/06/17 04:27:07 dillon Exp $ */ #include @@ -250,7 +249,7 @@ BpfGetIntfName(errmsg) ifrp = ibuf; ifend = (struct ifreq *)((char *)ibuf + ifc.ifc_len); - mp = 0; + mp = NULL; minunit = 666; for (; ifrp < ifend; ++ifrp) { if (ioctl(fd, SIOCGIFFLAGS, (char *)ifrp) < 0) { @@ -280,7 +279,7 @@ BpfGetIntfName(errmsg) } (void) close(fd); - if (mp == 0) { + if (mp == NULL) { (void) strcpy(errbuf, "bpf: no interfaces found"); return(NULL); } diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c index cb3726aa1c..991836d1b2 100644 --- a/libexec/rlogind/rlogind.c +++ b/libexec/rlogind/rlogind.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1983, 1988, 1989, 1993 The Regents of the University of California. All rights reserved. * @(#)rlogind.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/libexec/rlogind/rlogind.c,v 1.29.2.5 2000/12/07 15:02:31 ru Exp $ - * $DragonFly: src/libexec/rlogind/rlogind.c,v 1.5 2007/05/18 17:05:12 dillon Exp $ */ /* @@ -608,7 +607,7 @@ setup_term(int fd) #endif env[0] = term; - env[1] = 0; + env[1] = NULL; environ = env; } diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index c742274a02..951ec8d094 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -499,7 +499,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) } char buf[MAXPATHLEN]; - if (aux_info[AT_EXECPATH] != 0) { + if (aux_info[AT_EXECPATH] != NULL) { char *kexecpath; kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr; diff --git a/libexec/telnetd/state.c b/libexec/telnetd/state.c index 3e00f906a9..7c607db756 100644 --- a/libexec/telnetd/state.c +++ b/libexec/telnetd/state.c @@ -32,7 +32,6 @@ * * @(#)state.c 8.5 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/telnetd/state.c,v 1.4.2.3 2002/04/13 10:59:08 markm Exp $ - * $DragonFly: src/crypto/telnet/telnetd/state.c,v 1.3 2006/01/17 23:50:35 dillon Exp $ */ #include @@ -449,7 +448,7 @@ void willoption(int option) { int changeok = 0; - void (*func)(void) = 0; + void (*func)(void) = NULL; /* * process input from peer. @@ -1403,7 +1402,7 @@ suboption(void) return; cp = varp = (char *)subpointer; - valp = 0; + valp = NULL; while (!SB_EOF()) { c = SB_GET(); @@ -1432,7 +1431,7 @@ suboption(void) unsetenv(varp); } cp = varp = (char *)subpointer; - valp = 0; + valp = NULL; break; case ENV_ESC: diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c index bb87e43322..741e9e50a1 100644 --- a/libexec/telnetd/sys_term.c +++ b/libexec/telnetd/sys_term.c @@ -370,7 +370,7 @@ spcset(int func, cc_t *valp, cc_t **valpp) default: *valp = 0; - *valpp = 0; + *valpp = NULL; return(SLC_NOSUPPORT); } } @@ -1024,7 +1024,7 @@ init_env(void) envp = envinit; if ((*envp = getenv("TZ"))) *envp++ -= 3; - *envp = 0; + *envp = NULL; environ = envinit; } @@ -1251,7 +1251,7 @@ addarg(char **argv, const char *val) cpp = &argv[(long)argv[-1] - 10]; } *cpp++ = strdup(val); - *cpp = 0; + *cpp = NULL; return(argv); } diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index f5d4c8baaa..fac41472af 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -32,7 +32,6 @@ * * @(#)telnetd.c 8.4 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/telnetd/telnetd.c,v 1.11.2.5 2002/04/13 10:59:09 markm Exp $ - * $DragonFly: src/crypto/telnet/telnetd/telnetd.c,v 1.3 2006/01/17 23:50:35 dillon Exp $ */ #include "telnetd.h" @@ -889,11 +888,11 @@ telnet(int f, int p, char *host) IM = Getstr("im", &cp); if (HN && *HN) (void) strlcpy(host_name, HN, sizeof(host_name)); - if (IM == 0) + if (IM == NULL) IM = strdup(""); } else { IM = strdup(DEFAULT_IM); - HE = 0; + HE = NULL; } edithost(HE, host_name); if (hostinfo && *IM) diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index e6646ba9df..569e61fa53 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)tftpd.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/libexec/tftpd/tftpd.c,v 1.15.2.5 2003/04/06 19:42:56 dwmalone Exp $ - * $DragonFly: src/libexec/tftpd/tftpd.c,v 1.3 2003/11/20 14:32:17 eirikn Exp $ */ /* @@ -387,7 +386,7 @@ again: for (pf = formats; pf->f_mode; pf++) if (strcmp(pf->f_mode, mode) == 0) break; - if (pf->f_mode == 0) { + if (pf->f_mode == NULL) { nak(EBADOP); exit(1); } diff --git a/sbin/disklabel32/disklabel.c b/sbin/disklabel32/disklabel.c index 5e22f6d156..e5158fb17f 100644 --- a/sbin/disklabel32/disklabel.c +++ b/sbin/disklabel32/disklabel.c @@ -161,7 +161,7 @@ main(int argc, char *argv[]) struct disklabel32 *lp; FILE *t; int ch, f = 0, flag, error = 0; - char *name = 0; + char *name = NULL; while ((ch = getopt(argc, argv, OPTIONS)) != -1) switch (ch) { @@ -233,7 +233,7 @@ main(int argc, char *argv[]) } else { if (op == UNSPEC) op = READ; - xxboot = bootxx = 0; + xxboot = bootxx = NULL; } #else if (op == UNSPEC) @@ -605,7 +605,7 @@ makebootarea(char *boot, struct disklabel32 *dp, int f) * only if it does already contain some data. (Otherwise, * the xxboot provides a template.) */ - if ((tmpbuf = (char *)malloc((int)dp->d_secsize)) == 0) + if ((tmpbuf = (char *)malloc((int)dp->d_secsize)) == NULL) err(4, "%s", xxboot); memcpy((void *)tmpbuf, (void *)boot, (int)dp->d_secsize); #endif /* i386 */ @@ -643,7 +643,7 @@ makebootarea(char *boot, struct disklabel32 *dp, int f) /* XXX assume d_secsize is a power of two */ bootsize = (bootsize + dp->d_secsize-1) & ~(dp->d_secsize-1); bootbuf = (char *)malloc((size_t)bootsize); - if (bootbuf == 0) + if (bootbuf == NULL) err(4, "%s", xxboot); if (read(b, bootbuf, bootsize) < 0) { free(bootbuf); @@ -856,7 +856,7 @@ getasciilabel(FILE *f, struct disklabel32 *lp) lp->d_sbsize = SBSIZE; /* XXX */ while (fgets(line, sizeof(line) - 1, f)) { lineno++; - if ((cp = strchr(line,'\n')) != 0) + if ((cp = strchr(line,'\n')) != NULL) *cp = '\0'; cp = skip(line); if (cp == NULL) @@ -1608,7 +1608,7 @@ setbootflag(struct disklabel32 *lp) char part; u_long boffset; - if (bootbuf == 0) + if (bootbuf == NULL) return; boffset = bootsize / lp->d_secsize; for (i = 0; i < lp->d_npartitions; i++) { diff --git a/sbin/disklabel64/disklabel64.c b/sbin/disklabel64/disklabel64.c index f13f9c97d2..202359468b 100644 --- a/sbin/disklabel64/disklabel64.c +++ b/sbin/disklabel64/disklabel64.c @@ -187,7 +187,7 @@ main(int argc, char *argv[]) struct disklabel64 *lp; FILE *t; int ch, f = 0, flag, error = 0; - char *name = 0; + char *name = NULL; while ((ch = getopt(argc, argv, OPTIONS)) != -1) switch (ch) { @@ -878,7 +878,7 @@ getasciilabel(FILE *f, struct disklabel64 *lp) bzero(&part_offset_type, sizeof(part_offset_type)); while (fgets(line, sizeof(line) - 1, f)) { lineno++; - if ((cp = strchr(line,'\n')) != 0) + if ((cp = strchr(line,'\n')) != NULL) *cp = '\0'; cp = skip(line); if (cp == NULL) diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c index 095b63c760..c4531831d2 100644 --- a/sbin/dump/itime.c +++ b/sbin/dump/itime.c @@ -170,7 +170,7 @@ putdumptime(void) flock(fd, LOCK_EX); fname = disk; free((char *)ddatev); - ddatev = 0; + ddatev = NULL; nddates = 0; readdumptimes(df); if (fseek(df, 0L, 0) < 0) diff --git a/sbin/fsck/fsutil.c b/sbin/fsck/fsutil.c index 56b2efa58d..9e7c3e00a9 100644 --- a/sbin/fsck/fsutil.c +++ b/sbin/fsck/fsutil.c @@ -155,7 +155,7 @@ unrawname(const char *name) const char *dp; struct stat stb; - if ((dp = strrchr(name, '/')) == 0) + if ((dp = strrchr(name, '/')) == NULL) return (name); if (stat(name, &stb) < 0) return (name); @@ -173,7 +173,7 @@ rawname(const char *name) static char rawbuf[32]; const char *dp; - if ((dp = strrchr(name, '/')) == 0) + if ((dp = strrchr(name, '/')) == NULL) return (0); snprintf(rawbuf, 32, "%.*s/r%s", (int)(dp - name), name, dp + 1); return (rawbuf); diff --git a/sbin/fsck/inode.c b/sbin/fsck/inode.c index 16f1fbf8dd..da6a6b43ec 100644 --- a/sbin/fsck/inode.c +++ b/sbin/fsck/inode.c @@ -32,7 +32,6 @@ * * @(#)inode.c 8.8 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/fsck/inode.c,v 1.20 2000/02/28 20:02:41 mckusick Exp $ - * $DragonFly: src/sbin/fsck/inode.c,v 1.11 2006/10/12 04:04:03 dillon Exp $ */ #include @@ -518,7 +517,7 @@ pinode(ufs1_ino_t ino) return; dp = ginode(ino); printf(" OWNER="); - if ((pw = getpwuid((int)dp->di_uid)) != 0) + if ((pw = getpwuid((int)dp->di_uid)) != NULL) printf("%s ", pw->pw_name); else printf("%u ", (unsigned)dp->di_uid); diff --git a/sbin/fsck/pass4.c b/sbin/fsck/pass4.c index 9682183fc2..cafed55653 100644 --- a/sbin/fsck/pass4.c +++ b/sbin/fsck/pass4.c @@ -32,7 +32,6 @@ * * @(#)pass4.c 8.4 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/fsck/pass4.c,v 1.7.2.1 2001/01/23 23:11:07 iedowse Exp $ - * $DragonFly: src/sbin/fsck/pass4.c,v 1.7 2006/10/12 04:04:03 dillon Exp $ */ #include @@ -136,7 +135,7 @@ pass4check(struct inodesc *idesc) free((char *)dlp); break; } - if (dlp == 0) { + if (dlp == NULL) { clrbmap(blkno); n_blks--; } diff --git a/sbin/fsck/pass5.c b/sbin/fsck/pass5.c index 9ea40e4579..3a0ff69e03 100644 --- a/sbin/fsck/pass5.c +++ b/sbin/fsck/pass5.c @@ -32,7 +32,6 @@ * * @(#)pass5.c 8.9 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/fsck/pass5.c,v 1.17.2.2 2002/11/26 04:46:59 julian Exp $ - * $DragonFly: src/sbin/fsck/pass5.c,v 1.5 2005/11/06 12:13:53 swildner Exp $ */ #include @@ -76,7 +75,7 @@ pass5(void) } } if (fs->fs_maxcontig > 1) { - char *doit = 0; + char *doit = NULL; if (fs->fs_contigsumsize < 1) { doit = "CREAT"; diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c index 466903f9df..1e39c2d2d2 100644 --- a/sbin/fsck/preen.c +++ b/sbin/fsck/preen.c @@ -32,7 +32,6 @@ * * @(#)preen.c 8.5 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/fsck/preen.c,v 1.16 1999/12/30 16:32:40 peter Exp $ - * $DragonFly: src/sbin/fsck/preen.c,v 1.10 2006/10/19 21:22:13 pavalos Exp $ */ #include @@ -87,12 +86,12 @@ checkfstab(int do_preen, int maxrun, int (*docheck)(struct fstab *), _PATH_FSTAB); return (8); } - while ((fsp = getfsent()) != 0) { + while ((fsp = getfsent()) != NULL) { if ((auxdata = (*docheck)(fsp)) == 0) continue; if (do_preen == 0 || (passno == 1 && fsp->fs_passno == 1)) { - if ((name = blockcheck(fsp->fs_spec)) != 0) { + if ((name = blockcheck(fsp->fs_spec)) != NULL) { if ((sumstatus = (*chkit)(name, fsp->fs_file, auxdata, 0)) != 0) return (sumstatus); @@ -128,7 +127,7 @@ checkfstab(int do_preen, int maxrun, int (*docheck)(struct fstab *), for (dk = disks; dk; dk = dk->next) if (dk->pid == pid) break; - if (dk == 0) { + if (dk == NULL) { printf("Unknown pid %d\n", pid); continue; } @@ -180,7 +179,7 @@ checkfstab(int do_preen, int maxrun, int (*docheck)(struct fstab *), } } if (sumstatus) { - if (badlist == 0) + if (badlist == NULL) return (sumstatus); fprintf(stderr, "THE FOLLOWING FILE SYSTEM%s HAD AN %s\n\t", badlist->next ? "S" : "", "UNEXPECTED INCONSISTENCY:"); diff --git a/sbin/fsck/utilities.c b/sbin/fsck/utilities.c index 19b1f4accb..c095a36e3e 100644 --- a/sbin/fsck/utilities.c +++ b/sbin/fsck/utilities.c @@ -32,7 +32,6 @@ * * @(#)utilities.c 8.6 (Berkeley) 5/19/95 * $FreeBSD: src/sbin/fsck/utilities.c,v 1.11.2.3 2001/01/23 23:11:07 iedowse Exp $ - * $DragonFly: src/sbin/fsck/utilities.c,v 1.10 2006/10/12 04:04:03 dillon Exp $ */ #include @@ -139,7 +138,7 @@ bufinit(void) pbp = pdirbp = NULL; bufp = malloc((unsigned int)sblock.fs_bsize); - if (bufp == 0) + if (bufp == NULL) errx(EEXIT, "cannot allocate buffer pool"); cgblk.b_un.b_buf = bufp; initbarea(&cgblk); diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c index 77b8ad0d23..01024ab69e 100644 --- a/sbin/fsck_msdosfs/dir.c +++ b/sbin/fsck_msdosfs/dir.c @@ -280,7 +280,7 @@ finishDosDirSection(void) np = p->next; freeDirTodo(p); } - pendingDirectories = 0; + pendingDirectories = NULL; for (d = rootDir; d; d = nd) { if ((nd = d->child) != NULL) { d->child = 0; diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c index 80abcb4bc3..8ea6f83d63 100644 --- a/sbin/fsdb/fsdbutil.c +++ b/sbin/fsdb/fsdbutil.c @@ -28,7 +28,6 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sbin/fsdb/fsdbutil.c,v 1.9.2.2 2002/03/20 13:39:02 joerg Exp $ - * $DragonFly: src/sbin/fsdb/fsdbutil.c,v 1.7 2006/04/03 01:58:49 dillon Exp $ */ #include @@ -257,7 +256,7 @@ printblocks(ino_t inum, struct ufs1_dinode *dp) return; bufp = malloc((unsigned int)sblock.fs_bsize); - if (bufp == 0) + if (bufp == NULL) errx(EEXIT, "cannot allocate indirect block buffer"); printf("Indirect blocks:\n"); for (i = 0; i < NIADDR; i++) diff --git a/sbin/ifconfig/af_inet.c b/sbin/ifconfig/af_inet.c index 525fb6f5ef..0d74a422dc 100644 --- a/sbin/ifconfig/af_inet.c +++ b/sbin/ifconfig/af_inet.c @@ -126,10 +126,10 @@ in_getaddr(const char *s, int which) if (inet_aton(s, &sin->sin_addr)) return; - if ((hp = gethostbyname(s)) != 0) + if ((hp = gethostbyname(s)) != NULL) bcopy(hp->h_addr, (char *)&sin->sin_addr, MIN(hp->h_length, sizeof(sin->sin_addr))); - else if ((np = getnetbyname(s)) != 0) + else if ((np = getnetbyname(s)) != NULL) sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY); else errx(1, "%s: bad value", s); diff --git a/sbin/init/init.c b/sbin/init/init.c index 4ed62a7d36..1b1c44d6bc 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -675,7 +675,7 @@ single_user(void) write(2, banner, sizeof banner - 1); for (;;) { clear = getpass("Password:"); - if (clear == 0 || *clear == '\0') + if (clear == NULL || *clear == '\0') _exit(0); password = crypt(clear, pp->pw_passwd); bzero(clear, _PASSWORD_LEN); @@ -718,7 +718,7 @@ single_user(void) * If the default one doesn't work, try the Bourne shell. */ argv[0] = "-sh"; - argv[1] = 0; + argv[1] = NULL; execv(shell, __DECONST(char **, argv)); emergency("can't exec %s for single user: %m", shell); execv(_PATH_BSHELL, __DECONST(char **, argv)); @@ -737,7 +737,7 @@ single_user(void) return (state_func_t) single_user; } - requested_transition = 0; + requested_transition = NULL; do { if ((wpid = waitpid(-1, &status, WUNTRACED)) != -1) collect_child(wpid); @@ -798,7 +798,7 @@ runcom(void) argv[0] = "sh"; argv[1] = _PATH_RUNCOM; argv[2] = runcom_mode == AUTOBOOT ? "autoboot" : 0; - argv[3] = 0; + argv[3] = NULL; sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL); @@ -822,7 +822,7 @@ runcom(void) /* * Copied from single_user(). This is a bit paranoid. */ - requested_transition = 0; + requested_transition = NULL; do { if ((wpid = waitpid(-1, &status, WUNTRACED)) != -1) collect_child(wpid); @@ -881,7 +881,7 @@ start_session_db(void) { if (session_db && (*session_db->close)(session_db)) emergency("session database close: %s", strerror(errno)); - if ((session_db = dbopen(NULL, O_RDWR, 0, DB_HASH, NULL)) == 0) { + if ((session_db = dbopen(NULL, O_RDWR, 0, DB_HASH, NULL)) == NULL) { emergency("session database open: %s", strerror(errno)); return (1); } @@ -956,7 +956,7 @@ construct_argv(char *command) char **argv = malloc(((strlen(command) + 1) / 2 + 1) * sizeof (char *)); - if ((argv[argc++] = strk(command)) == 0) { + if ((argv[argc++] = strk(command)) == NULL) { free(argv); return (NULL); } @@ -1027,10 +1027,10 @@ new_session(session_t *sprev, int session_index, struct ttyent *typ) return (0); } - sp->se_next = 0; - if (sprev == 0) { + sp->se_next = NULL; + if (sprev == NULL) { sessions = sp; - sp->se_prev = 0; + sp->se_prev = NULL; } else { sprev->se_next = sp; sp->se_prev = sprev; @@ -1055,11 +1055,11 @@ setupargv(session_t *sp, struct ttyent *typ) sprintf(sp->se_getty, "%s %s", typ->ty_getty, typ->ty_name); sp->se_getty_argv_space = strdup(sp->se_getty); sp->se_getty_argv = construct_argv(sp->se_getty_argv_space); - if (sp->se_getty_argv == 0) { + if (sp->se_getty_argv == NULL) { warning("can't parse getty for port %s", sp->se_device); free(sp->se_getty); free(sp->se_getty_argv_space); - sp->se_getty = sp->se_getty_argv_space = 0; + sp->se_getty = sp->se_getty_argv_space = NULL; return (0); } if (sp->se_window) { @@ -1067,18 +1067,18 @@ setupargv(session_t *sp, struct ttyent *typ) free(sp->se_window_argv_space); free(sp->se_window_argv); } - sp->se_window = sp->se_window_argv_space = 0; - sp->se_window_argv = 0; + sp->se_window = sp->se_window_argv_space = NULL; + sp->se_window_argv = NULL; if (typ->ty_window) { sp->se_window = strdup(typ->ty_window); sp->se_window_argv_space = strdup(sp->se_window); sp->se_window_argv = construct_argv(sp->se_window_argv_space); - if (sp->se_window_argv == 0) { + if (sp->se_window_argv == NULL) { warning("can't parse window for port %s", sp->se_device); free(sp->se_window_argv_space); free(sp->se_window); - sp->se_window = sp->se_window_argv_space = 0; + sp->se_window = sp->se_window_argv_space = NULL; return (0); } } @@ -1127,7 +1127,7 @@ read_ttys(void) snext = sp->se_next; free_session(sp); } - sessions = 0; + sessions = NULL; if (start_session_db()) return (state_func_t) single_user; @@ -1178,10 +1178,10 @@ start_window_system(session_t *sp) strcpy(term, "TERM="); strncat(term, sp->se_type, sizeof(term) - 6); env[0] = term; - env[1] = 0; + env[1] = NULL; } else - env[0] = 0; + env[0] = NULL; execve(sp->se_window_argv[0], sp->se_window_argv, env); stall("can't exec window system '%s' for port %s: %m", sp->se_window_argv[0], sp->se_device); @@ -1242,10 +1242,10 @@ start_getty(session_t *sp) strcpy(term, "TERM="); strncat(term, sp->se_type, sizeof(term) - 6); env[0] = term; - env[1] = 0; + env[1] = NULL; } else - env[0] = 0; + env[0] = NULL; execve(sp->se_getty_argv[0], sp->se_getty_argv, env); stall("can't exec getty '%s' for port %s: %m", sp->se_getty_argv[0], sp->se_device); @@ -1317,7 +1317,7 @@ transition_handler(int sig) requested_transition = catatonia; break; default: - requested_transition = 0; + requested_transition = NULL; break; } } @@ -1331,7 +1331,7 @@ multi_user(void) pid_t pid; session_t *sp; - requested_transition = 0; + requested_transition = NULL; /* * If the administrator has not set the security level to -1 @@ -1389,7 +1389,7 @@ clean_ttys(void) while ((typ = getttyent()) != NULL) { ++session_index; - for (sprev = 0, sp = sessions; sp; sprev = sp, sp = sp->se_next) + for (sprev = NULL, sp = sessions; sp; sprev = sp, sp = sp->se_next) if (strcmp(typ->ty_name, sp->se_device + devlen) == 0) break; @@ -1587,7 +1587,7 @@ runshutdown(void) argv[2] = "reboot"; else argv[2] = "single"; - argv[3] = 0; + argv[3] = NULL; sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL); @@ -1688,7 +1688,7 @@ strk(char *p) while (c == ' ' || c == '\t' ) c = *++t; if (!c) { - t = 0; + t = NULL; return 0; } q = t; @@ -1698,7 +1698,7 @@ strk(char *p) while (c && c != '\'') c = *++t; if (!c) /* unterminated string */ - q = t = 0; + q = t = NULL; else *t++ = 0; } else { @@ -1706,7 +1706,7 @@ strk(char *p) c = *++t; *t++ = 0; if (!c) - t = 0; + t = NULL; } return q; } diff --git a/sbin/ip6fw/ip6fw.c b/sbin/ip6fw/ip6fw.c index d2bd4221e5..0d0ddf3e81 100644 --- a/sbin/ip6fw/ip6fw.c +++ b/sbin/ip6fw/ip6fw.c @@ -49,7 +49,6 @@ * * $Id: ip6fw.c,v 1.1.2.2.2.2 1999/05/14 05:13:50 shin Exp $ * $FreeBSD: src/sbin/ip6fw/ip6fw.c,v 1.1.2.9 2003/04/05 10:54:51 ume Exp $ - * $DragonFly: src/sbin/ip6fw/ip6fw.c,v 1.9 2005/11/06 12:29:11 swildner Exp $ */ #include @@ -551,7 +550,7 @@ fill_ip6(struct in6_addr *ipno, struct in6_addr *mask, int *acp, char ***avp) { int ac = *acp; char **av = *avp; - char *p = 0, md = 0; + char *p = NULL, md = 0; int i; if (ac && !strncmp(*av,"any",strlen(*av))) { @@ -1324,7 +1323,7 @@ main(int ac, char **av) /* pipe through preprocessor (cpp or m4) */ int pipedes[2]; - args[i] = 0; + args[i] = NULL; if (pipe(pipedes) == -1) err(EX_OSERR, "cannot create pipe"); diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 12ddb7508d..a742d2add6 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -1766,7 +1766,7 @@ lookup_host (char *host, struct in_addr *ipaddr) static void fill_ip(ipfw_insn_ip *cmd, char *av) { - char *p = 0, md = 0; + char *p = NULL, md = 0; u_int32_t i; cmd->o.len &= ~F_LEN_MASK; /* zero len */ @@ -3546,7 +3546,7 @@ ipfw_readfile(int ac, char *av[]) /* pipe through preprocessor (cpp or m4) */ int pipedes[2]; - args[i] = 0; + args[i] = NULL; if (pipe(pipedes) == -1) err(EX_OSERR, "cannot create pipe"); diff --git a/sbin/iscontrol/config.c b/sbin/iscontrol/config.c index 45494df840..a729ad4b69 100644 --- a/sbin/iscontrol/config.c +++ b/sbin/iscontrol/config.c @@ -280,7 +280,7 @@ getConfig(FILE *fd, char *key, char **Ar, int *nargs) done: if(*nargs > 0) - *ar = 0; + *ar = NULL; *nargs = ar - Ar; return ar - Ar; } diff --git a/sbin/iscontrol/iscontrol.c b/sbin/iscontrol/iscontrol.c index 6c1428fcf7..c337da6610 100644 --- a/sbin/iscontrol/iscontrol.c +++ b/sbin/iscontrol/iscontrol.c @@ -148,7 +148,7 @@ main(int cc, char **vv) if((p = strrchr(pname, '/')) != NULL) pname = p + 1; - kw = ta = 0; + kw = ta = NULL; disco = 0; while((ch = getopt(cc, vv, OPTIONS)) != -1) { diff --git a/sbin/mkinitrd/mini_init/oinit.c b/sbin/mkinitrd/mini_init/oinit.c index 16745644dd..8dca57aebd 100644 --- a/sbin/mkinitrd/mini_init/oinit.c +++ b/sbin/mkinitrd/mini_init/oinit.c @@ -122,7 +122,7 @@ runcom(char **argv_orig) argv[0] = "sh"; argv[1] = _PATH_RUNCOM; argv[2] = "autoboot" ; - argv[3] = 0; + argv[3] = NULL; sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL); diff --git a/sbin/mount_portal/conf.c b/sbin/mount_portal/conf.c index 46d10a278f..90720afca6 100644 --- a/sbin/mount_portal/conf.c +++ b/sbin/mount_portal/conf.c @@ -37,7 +37,6 @@ * @(#)conf.c 8.2 (Berkeley) 3/27/94 * * $FreeBSD: src/sbin/mount_portal/conf.c,v 1.8 1999/08/28 00:13:35 peter Exp $ - * $DragonFly: src/sbin/mount_portal/conf.c,v 1.5 2005/11/06 12:36:40 swildner Exp $ */ #include @@ -186,7 +185,7 @@ palloc(char *cline, int lno) p->p_argc++; } } - *ap = 0; + *ap = NULL; #ifdef DEBUG for (c = 0; c < p->p_argc; c++) @@ -209,7 +208,7 @@ palloc(char *cline, int lno) } else { p->p_rxvalid = 1; } - curp = 0; /* XXX */ + curp = NULL; /* XXX */ } else { p->p_rxvalid = 0; } @@ -303,7 +302,7 @@ conf_read(qelem *q, char *conf) if (fp) { conf_file = conf; /* XXX */ readfp(q, fp); - conf_file = 0; /* XXX */ + conf_file = NULL; /* XXX */ fclose(fp); } else { syslog(LOG_ERR, "open config file \"%s\": %s", conf, strerror(errno)); diff --git a/sbin/mount_portal/pt_tcp.c b/sbin/mount_portal/pt_tcp.c index 4357d2093e..a9b9d3ec06 100644 --- a/sbin/mount_portal/pt_tcp.c +++ b/sbin/mount_portal/pt_tcp.c @@ -37,7 +37,6 @@ * @(#)pt_tcp.c 8.5 (Berkeley) 4/28/95 * * $FreeBSD: src/sbin/mount_portal/pt_tcp.c,v 1.9 1999/08/28 00:13:38 peter Exp $ - * $DragonFly: src/sbin/mount_portal/pt_tcp.c,v 1.5 2005/11/06 12:36:40 swildner Exp $ */ #include @@ -79,7 +78,7 @@ portal_tcp(struct portal_cred *pcr, char *key, char **v, int kso __unused, struct sockaddr_in sain; q = strchr(p, '/'); - if (q == 0 || (size_t)(q - p) >= sizeof(host)) + if (q == NULL || (size_t)(q - p) >= sizeof(host)) return (EINVAL); *q = '\0'; strcpy(host, p); @@ -104,14 +103,14 @@ portal_tcp(struct portal_cred *pcr, char *key, char **v, int kso __unused, } hp = gethostbyname(host); - if (hp != 0) { + if (hp != NULL) { ipp = (struct in_addr **) hp->h_addr_list; } else { ina.s_addr = inet_addr(host); if (ina.s_addr == INADDR_NONE) return (EINVAL); ip[0] = &ina; - ip[1] = 0; + ip[1] = NULL; ipp = ip; } #ifdef DEBUG diff --git a/sbin/mount_portal/pt_tcplisten.c b/sbin/mount_portal/pt_tcplisten.c index f0c0ac8561..2293d2ebfe 100644 --- a/sbin/mount_portal/pt_tcplisten.c +++ b/sbin/mount_portal/pt_tcplisten.c @@ -38,7 +38,6 @@ * * @(#)pt_tcp.c 8.3 (Berkeley) 3/27/94 * - * $DragonFly: src/sbin/mount_portal/pt_tcplisten.c,v 1.5 2005/11/06 12:36:40 swildner Exp $ * pt_tcp.c,v 1.1.1.1 1994/05/26 06:34:34 rgrimes Exp */ @@ -87,7 +86,7 @@ portal_tcplisten(struct portal_cred *pcr, char *key, char **v, struct sockaddr_in sain; q = strchr(p, '/'); - if (q == 0 || (size_t)(q - p) >= sizeof(host)) + if (q == NULL || (size_t)(q - p) >= sizeof(host)) return (EINVAL); *q = '\0'; snprintf(host, sizeof(host), "%s", p); @@ -104,14 +103,14 @@ portal_tcplisten(struct portal_cred *pcr, char *key, char **v, any = 1; } else { hp = gethostbyname(host); - if (hp != 0) { + if (hp != NULL) { ipp = (struct in_addr **) hp->h_addr_list; } else { ina.s_addr = inet_addr(host); if (ina.s_addr == INADDR_NONE) return (EINVAL); ip[0] = &ina; - ip[1] = 0; + ip[1] = NULL; ipp = ip; } } diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 18f72aef92..a252f9a9d9 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1989, 1993 The Regents of the University of California. All rights reserved. * @(#)mountd.c 8.15 (Berkeley) 5/1/95 * $FreeBSD: src/sbin/mountd/mountd.c,v 1.39.2.5 2002/09/13 15:57:43 joerg Exp $ - * $DragonFly: src/sbin/mountd/mountd.c,v 1.9 2008/02/05 20:49:51 dillon Exp $ */ #include @@ -1061,7 +1060,7 @@ get_exportlist(void) grp = grp->gr_next; } if (netgrp) { - if (hst == 0) { + if (hst == NULL) { syslog(LOG_ERR, "null hostname in netgroup %s, skipping", cp); grp->gr_type = GT_IGNORE; diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index fcf1c3a73b..a79ad4a101 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -31,7 +31,6 @@ * @(#) Copyright (c) 1989, 1993 The Regents of the University of California. All rights reserved. * @(#)ping.c 8.1 (Berkeley) 6/5/93 * $FreeBSD: src/sbin/ping6/ping6.c,v 1.30 2007/04/19 15:41:00 mtm Exp $ - * $DragonFly: src/sbin/ping6/ping6.c,v 1.10 2008/09/04 10:13:10 hasso Exp $ */ /* BSDI ping.c,v 2.3 1996/01/21 17:56:50 jch Exp */ @@ -232,7 +231,7 @@ u_short naflags; /* for ancillary data(advanced API) */ struct msghdr smsghdr; struct iovec smsgiov; -char *scmsg = 0; +char *scmsg = NULL; volatile sig_atomic_t seenalrm; volatile sig_atomic_t seenint; @@ -819,7 +818,7 @@ main(int argc, char **argv) /* set IP6 packet options */ if (ip6optlen) { - if ((scmsg = (char *)malloc(ip6optlen)) == 0) + if ((scmsg = (char *)malloc(ip6optlen)) == NULL) errx(1, "can't allocate enough memory"); smsghdr.msg_control = (caddr_t)scmsg; smsghdr.msg_controllen = ip6optlen; diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c index fc4b555e98..a1995f366b 100644 --- a/sbin/quotacheck/quotacheck.c +++ b/sbin/quotacheck/quotacheck.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1980, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)quotacheck.c 8.3 (Berkeley) 1/29/94 * $FreeBSD: src/sbin/quotacheck/quotacheck.c,v 1.11 1999/08/28 00:14:01 peter Exp $ - * $DragonFly: src/sbin/quotacheck/quotacheck.c,v 1.10 2006/10/19 21:22:13 pavalos Exp $ */ /* @@ -335,7 +334,7 @@ update(char *fsname, char *quotafile, int type) id++, offset += sizeof(struct ufs_dqblk)) { if (fread((char *)&dqbuf, sizeof(struct ufs_dqblk), 1, qfi) == 0) dqbuf = zerodqbuf; - if ((fup = lookup(id, type)) == 0) + if ((fup = lookup(id, type)) == NULL) fup = &zerofileusage; if (dqbuf.dqb_curinodes == fup->fu_curinodes && dqbuf.dqb_curblocks == fup->fu_curblocks) { @@ -465,7 +464,7 @@ lookup(u_long id, int type) { struct fileusage *fup; - for (fup = fuhead[type][id & (FUHASH-1)]; fup != 0; fup = fup->fu_next) + for (fup = fuhead[type][id & (FUHASH-1)]; fup != NULL; fup = fup->fu_next) if (fup->fu_id == id) return (fup); return (NULL); diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c index 5d3047e2a7..456e9c22de 100644 --- a/sbin/restore/utilities.c +++ b/sbin/restore/utilities.c @@ -32,7 +32,6 @@ * * @(#)utilities.c 8.5 (Berkeley) 4/28/95 * $FreeBSD: src/sbin/restore/utilities.c,v 1.8.2.2 2001/07/30 10:30:08 dd Exp $ - * $DragonFly: src/sbin/restore/utilities.c,v 1.7 2005/11/06 12:49:25 swildner Exp $ */ #include @@ -61,7 +60,7 @@ pathcheck(char *name) char *start; start = strchr(name, '/'); - if (start == 0) + if (start == NULL) return; for (cp = start; *cp != '\0'; cp++) { if (*cp != '/') diff --git a/sbin/route/route.c b/sbin/route/route.c index b1236bbbe6..629725722e 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -428,9 +428,9 @@ routename(struct sockaddr *sa) char * netname(struct sockaddr *sa) { - const char *cp = 0; + const char *cp = NULL; static char line[MAXHOSTNAMELEN + 1]; - struct netent *np = 0; + struct netent *np = NULL; u_long net, mask; u_long i; int subnetshift; @@ -579,7 +579,7 @@ newroute(int argc, char **argv) const char *err_str, *dest = "", *gateway = ""; int ishost = 0, proxy = 0, ret, attempts, oerrno, flags = RTF_STATIC; int key; - struct hostent *hp = 0; + struct hostent *hp = NULL; if (uid != 0) { errx(EX_NOPERM, "must be root to alter routing table"); diff --git a/sbin/routed/if.c b/sbin/routed/if.c index 8fbc2f3971..5060b825b9 100644 --- a/sbin/routed/if.c +++ b/sbin/routed/if.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/if.c,v 1.6.2.1 2000/08/14 17:00:03 sheldonh Exp $ - * $DragonFly: src/sbin/routed/if.c,v 1.5 2005/03/16 21:21:34 cpressey Exp $ */ #include "defs.h" @@ -106,20 +105,20 @@ if_link(struct interface *ifp) ifp->int_prev = &ifnet; ifp->int_next = ifnet; - if (ifnet != 0) + if (ifnet != NULL) ifnet->int_prev = &ifp->int_next; ifnet = ifp; hifp = AHASH(ifp->int_addr); ifp->int_ahash_prev = hifp; - if ((ifp->int_ahash = *hifp) != 0) + if ((ifp->int_ahash = *hifp) != NULL) (*hifp)->int_ahash_prev = &ifp->int_ahash; *hifp = ifp; if (ifp->int_if_flags & IFF_BROADCAST) { hifp = BHASH(ifp->int_brdaddr); ifp->int_bhash_prev = hifp; - if ((ifp->int_bhash = *hifp) != 0) + if ((ifp->int_bhash = *hifp) != NULL) (*hifp)->int_bhash_prev = &ifp->int_bhash; *hifp = ifp; } @@ -127,7 +126,7 @@ if_link(struct interface *ifp) if (ifp->int_state & IS_REMOTE) { ifp->int_rlink_prev = &remote_if; ifp->int_rlink = remote_if; - if (remote_if != 0) + if (remote_if != NULL) remote_if->int_rlink_prev = &ifp->int_rlink; remote_if = ifp; } @@ -135,11 +134,11 @@ if_link(struct interface *ifp) hifp = nhash(ifp->int_name); if (ifp->int_state & IS_ALIAS) { /* put aliases on the end of the hash chain */ - while (*hifp != 0) + while (*hifp != NULL) hifp = &(*hifp)->int_nhash; } ifp->int_nhash_prev = hifp; - if ((ifp->int_nhash = *hifp) != 0) + if ((ifp->int_nhash = *hifp) != NULL) (*hifp)->int_nhash_prev = &ifp->int_nhash; *hifp = ifp; } @@ -152,7 +151,7 @@ ifwithaddr(naddr addr, int bcast, /* notice IFF_BROADCAST address */ int remote) /* include IS_REMOTE interfaces */ { - struct interface *ifp, *possible = 0; + struct interface *ifp, *possible = NULL; remote = (remote == 0) ? IS_REMOTE : 0; @@ -192,7 +191,7 @@ ifwithname(char *name, /* "ec0" or whatever */ struct interface *ifp; for (;;) { - for (ifp = *nhash(name); ifp != 0; ifp = ifp->int_nhash) { + for (ifp = *nhash(name); ifp != NULL; ifp = ifp->int_nhash) { /* If the network address is not specified, * ignore any alias interfaces. Otherwise, look * for the interface with the target name and address. @@ -219,7 +218,7 @@ ifwithindex(u_short idx, int rescan_ok) struct interface *ifp; for (;;) { - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + for (ifp = ifnet; NULL != ifp; ifp = ifp->int_next) { if (ifp->int_index == idx) return ifp; } @@ -244,7 +243,7 @@ iflookup(naddr addr) { struct interface *ifp, *maybe; - maybe = 0; + maybe = NULL; for (;;) { for (ifp = ifnet; ifp; ifp = ifp->int_next) { if (ifp->int_if_flags & IFF_POINTOPOINT) { @@ -260,13 +259,13 @@ iflookup(naddr addr) /* Look for the longest approximate match. */ if (on_net(addr, ifp->int_net, ifp->int_mask) - && (maybe == 0 + && (maybe == NULL || ifp->int_mask > maybe->int_mask)) maybe = ifp; } } - if (maybe != 0 + if (maybe != NULL || IF_RESCAN_DELAY()) return maybe; @@ -309,7 +308,7 @@ ripv1_mask_net(naddr addr, /* in network byte order */ if (addr == 0) /* default always has 0 mask */ return mask; - if (ifp != 0 && ifp->int_ripv1_mask != HOST_MASK) { + if (ifp != NULL && ifp->int_ripv1_mask != HOST_MASK) { /* If the target network is that of the associated interface * on which it arrived, then use the netmask of the interface. */ @@ -323,7 +322,7 @@ ripv1_mask_net(naddr addr, /* in network byte order */ * such interface, prefer the interface with the longest * match. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { if (on_net(addr, ifp->int_std_net, ifp->int_std_mask) && ifp->int_ripv1_mask > mask && ifp->int_ripv1_mask != HOST_MASK) @@ -334,7 +333,7 @@ ripv1_mask_net(naddr addr, /* in network byte order */ /* check special definitions */ if (mask == 0) { - for (r1p = r1nets; r1p != 0; r1p = r1p->r1net_next) { + for (r1p = r1nets; r1p != NULL; r1p = r1p->r1net_next) { if (on_net(addr, r1p->r1net_net, r1p->r1net_match) && r1p->r1net_mask > mask) mask = r1p->r1net_mask; @@ -395,7 +394,7 @@ check_dup(naddr addr, /* IP address, so network byte order */ { struct interface *ifp; - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + for (ifp = ifnet; NULL != ifp; ifp = ifp->int_next) { if (ifp->int_mask != mask) continue; @@ -429,7 +428,7 @@ check_remote(struct interface *ifp) return 1; rt = rtfind(ifp->int_addr); - if (rt != 0 + if (rt != NULL && rt->rt_ifp != 0 &&on_net(ifp->int_addr, rt->rt_ifp->int_net, rt->rt_ifp->int_mask)) @@ -485,7 +484,7 @@ ifdel(struct interface *ifp) if (!(ifp->int_state & IS_ALIAS)) { /* delete aliases when the main interface dies */ - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + for (ifp1 = ifnet; NULL != ifp1; ifp1 = ifp1->int_next) { if (ifp1 != ifp && !strcmp(ifp->int_name, ifp1->int_name)) ifdel(ifp1); @@ -569,7 +568,7 @@ if_bad(struct interface *ifp) trace_if("Chg", ifp); if (!(ifp->int_state & IS_ALIAS)) { - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + for (ifp1 = ifnet; NULL != ifp1; ifp1 = ifp1->int_next) { if (ifp1 != ifp && !strcmp(ifp->int_name, ifp1->int_name)) if_bad(ifp1); @@ -605,7 +604,7 @@ if_ok(struct interface *ifp, ifp->int_data.ts = 0; if (!(ifp->int_state & IS_ALIAS)) { - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + for (ifp1 = ifnet; NULL != ifp1; ifp1 = ifp1->int_next) { if (ifp1 != ifp && !strcmp(ifp->int_name, ifp1->int_name)) if_ok(ifp1, type); @@ -701,7 +700,7 @@ ifinit(void) : CHECK_QUIET_INTERVAL); /* mark all interfaces so we can get rid of those that disappear */ - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) + for (ifp = ifnet; NULL != ifp; ifp = ifp->int_next) ifp->int_state &= ~(IS_CHECKED | IS_DUP); /* Fetch the interface list, without too many system calls @@ -925,7 +924,7 @@ ifinit(void) ifp = ifwithname(ifs.int_name, ((ifs.int_state & IS_ALIAS) ? ifs.int_addr : 0)); - if (ifp != 0) { + if (ifp != NULL) { ifp->int_state |= IS_CHECKED; if (0 != ((ifp->int_if_flags ^ ifs.int_if_flags) @@ -946,11 +945,11 @@ ifinit(void) trace_act("interface %s has changed", ifp->int_name); ifdel(ifp); - ifp = 0; + ifp = NULL; } } - if (ifp != 0) { + if (ifp != NULL) { /* The primary representative of an alias worries * about how things are working. */ @@ -1069,7 +1068,7 @@ ifinit(void) */ ifp = check_dup(ifs.int_addr,ifs.int_dstaddr,ifs.int_mask, ifs.int_if_flags); - if (ifp != 0) { + if (ifp != NULL) { /* Ignore duplicates of itself, caused by having * IP aliases on the same network. */ @@ -1120,7 +1119,7 @@ ifinit(void) if (!(prev_complaints & COMP_NETMASK) && !(ifp->int_if_flags & IFF_POINTOPOINT) && ifp->int_addr != RIP_DEFAULT) { - for (ifp1 = ifnet; 0 != ifp1; ifp1 = ifp1->int_next) { + for (ifp1 = ifnet; NULL != ifp1; ifp1 = ifp1->int_next) { if (ifp1->int_mask == ifp->int_mask) continue; if (ifp1->int_if_flags & IFF_POINTOPOINT) @@ -1173,15 +1172,15 @@ ifinit(void) if (advertise_mhome || (tot_interfaces > 1 && mhome - && (ifp = ifwithaddr(myaddr, 0, 0)) != 0 + && (ifp = ifwithaddr(myaddr, 0, 0)) != NULL && foundloopback)) { advertise_mhome = 1; rt = rtget(myaddr, HOST_MASK); - if (rt != 0) { + if (rt != NULL) { if (rt->rt_ifp != ifp || rt->rt_router != loopaddr) { rtdelete(rt); - rt = 0; + rt = NULL; } else { loop_rts.rts_ifp = ifp; loop_rts.rts_metric = 0; @@ -1190,14 +1189,14 @@ ifinit(void) &loop_rts, 0); } } - if (rt == 0) { + if (rt == NULL) { loop_rts.rts_ifp = ifp; loop_rts.rts_metric = 0; rtadd(myaddr, HOST_MASK, RS_MHOME, &loop_rts); } } - for (ifp = ifnet; ifp != 0; ifp = ifp1) { + for (ifp = ifnet; ifp != NULL; ifp = ifp1) { ifp1 = ifp->int_next; /* because we may delete it */ /* Forget any interfaces that have disappeared. @@ -1222,7 +1221,7 @@ ifinit(void) have_ripv1_in = 1; } - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { /* Ensure there is always a network route for interfaces, * after any dead interfaces have been deleted, which * might affect routes for point-to-point links. @@ -1241,11 +1240,11 @@ ifinit(void) */ del_static(ifp->int_addr, HOST_MASK, 0, 0); rt = rtget(ifp->int_addr, HOST_MASK); - if (rt != 0 && rt->rt_router != loopaddr) { + if (rt != NULL && rt->rt_router != loopaddr) { rtdelete(rt); - rt = 0; + rt = NULL; } - if (rt != 0) { + if (rt != NULL) { if (!(rt->rt_state & RS_LOCAL) || rt->rt_metric > ifp->int_metric) { ifp1 = ifp; @@ -1268,15 +1267,15 @@ ifinit(void) } /* add the authority routes */ - for (intnetp = intnets; intnetp!=0; intnetp = intnetp->intnet_next) { + for (intnetp = intnets; intnetp!=NULL; intnetp = intnetp->intnet_next) { rt = rtget(intnetp->intnet_addr, intnetp->intnet_mask); - if (rt != 0 + if (rt != NULL && !(rt->rt_state & RS_NO_NET_SYN) && !(rt->rt_state & RS_NET_INT)) { rtdelete(rt); - rt = 0; + rt = NULL; } - if (rt == 0) { + if (rt == NULL) { loop_rts.rts_ifp = 0; loop_rts.rts_metric = intnetp->intnet_metric-1; rtadd(intnetp->intnet_addr, intnetp->intnet_mask, @@ -1302,14 +1301,14 @@ check_net_syn(struct interface *ifp) if (have_ripv1_out || have_ripv1_in) { ifp->int_state |= IS_NEED_NET_SYN; rt = rtget(ifp->int_std_addr, ifp->int_std_mask); - if (rt != 0 + if (rt != NULL && 0 == (rt->rt_state & RS_NO_NET_SYN) && (!(rt->rt_state & RS_NET_SYN) || rt->rt_metric > ifp->int_metric)) { rtdelete(rt); - rt = 0; + rt = NULL; } - if (rt == 0) { + if (rt == NULL) { new.rts_ifp = ifp; new.rts_gate = ifp->int_addr; new.rts_router = ifp->int_addr; @@ -1323,7 +1322,7 @@ check_net_syn(struct interface *ifp) rt = rtget(ifp->int_std_addr, ifp->int_std_mask); - if (rt != 0 + if (rt != NULL && (rt->rt_state & RS_NET_SYN) && rt->rt_ifp == ifp) rtbad_sub(rt); @@ -1378,21 +1377,21 @@ addrouteforif(struct interface *ifp) */ del_static(dst, ifp->int_mask, 0, 0); rt = rtget(dst, ifp->int_mask); - if (rt != 0) { + if (rt != NULL) { if ((rt->rt_ifp != ifp || rt->rt_router != ifp->int_addr) && (!(ifp->int_state & IS_DUP) || rt->rt_ifp == 0 || (rt->rt_ifp->int_state & IS_BROKE))) { rtdelete(rt); - rt = 0; + rt = NULL; } else { rtchange(rt, ((rt->rt_state | RS_IF) & ~(RS_NET_SYN | RS_LOCAL)), &new, 0); } } - if (rt == 0) { + if (rt == NULL) { if (ifp->int_transitions++ > 0) trace_act("re-install interface %s", ifp->int_name); diff --git a/sbin/routed/input.c b/sbin/routed/input.c index 43a3ddd211..47725d61c7 100644 --- a/sbin/routed/input.c +++ b/sbin/routed/input.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/input.c,v 1.7.2.1 2001/08/01 09:01:45 obrien Exp $ - * $DragonFly: src/sbin/routed/input.c,v 1.4 2004/12/18 21:43:40 swildner Exp $ */ #include "defs.h" @@ -102,9 +101,9 @@ read_rip(int sock, if (aifp->int_addr == from.sin_addr.s_addr) break; } - if (aifp == 0) { + if (aifp == NULL) { aifp = ifwithname(inbuf.ifname, 0); - if (aifp == 0) { + if (aifp == NULL) { msglim(&bad_name, from.sin_addr.s_addr, "impossible interface name %.*s", IFNAMSIZ, inbuf.ifname); @@ -117,13 +116,13 @@ read_rip(int sock, /* If it came via the wrong interface, do not * trust it. */ - aifp = 0; + aifp = NULL; } } #else aifp = iflookup(from.sin_addr.s_addr); #endif - if (sifp == 0) + if (sifp == NULL) sifp = aifp; input(&from, sifp, aifp, &inbuf.pbuf.rip, cc); @@ -150,13 +149,13 @@ input(struct sockaddr_in *from, /* received from this IP address */ struct interface *ifp1; naddr gate, mask, v1_mask, dst, ddst_h = 0; struct auth *ap; - struct tgate *tg = 0; + struct tgate *tg = NULL; struct tgate_net *tn; int i, j; /* Notice when we hear from a remote gateway */ - if (aifp != 0 + if (aifp != NULL && (aifp->int_state & IS_REMOTE)) aifp->int_act_time = now.tv_sec; @@ -202,7 +201,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ case RIPCMD_REQUEST: /* For mere requests, be a little sloppy about the source */ - if (aifp == 0) + if (aifp == NULL) aifp = sifp; /* Are we talking to ourself or a remote gateway? @@ -229,7 +228,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ * the router does not depend on us. */ if (rip_sock < 0 - || (aifp != 0 + || (aifp != NULL && IS_RIP_OUT_OFF(aifp->int_state))) { trace_pkt(" discard request while RIP off"); return; @@ -259,20 +258,20 @@ input(struct sockaddr_in *from, /* received from this IP address */ } if (rip->rip_vers == RIPv2 - && (aifp == 0 || (aifp->int_state & IS_NO_RIPV1_OUT))) { + && (aifp == NULL || (aifp->int_state & IS_NO_RIPV1_OUT))) { v12buf.buf->rip_vers = RIPv2; /* If we have a secret but it is a cleartext secret, * do not disclose our secret unless the other guy * already knows it. */ ap = find_auth(aifp); - if (ap != 0 && ap->type == RIP_AUTH_PW + if (ap != NULL && ap->type == RIP_AUTH_PW && n->n_family == RIP_AF_AUTH && !ck_passwd(aifp,rip,lim,FROM_NADDR,&use_auth)) - ap = 0; + ap = NULL; } else { v12buf.buf->rip_vers = RIPv1; - ap = 0; + ap = NULL; } clr_ws_buf(&v12buf, ap); @@ -292,7 +291,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ */ if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, - rip->rip_vers, ap != 0); + rip->rip_vers, ap != NULL); return; } @@ -304,7 +303,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ * to keep an unwary host that is just starting * from picking us as a router. */ - if (aifp == 0) { + if (aifp == NULL) { trace_pkt("ignore distant router"); return; } @@ -328,7 +327,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ v12buf.n->n_family = RIP_AF_INET; v12buf.n->n_dst = RIP_DEFAULT; i = aifp->int_d_metric; - if (0 != (rt = rtget(RIP_DEFAULT, 0))) + if (NULL != (rt = rtget(RIP_DEFAULT, 0))) i = MIN(i, (rt->rt_metric +aifp->int_metric+1)); v12buf.n->n_metric = htonl(i); @@ -345,7 +344,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ supply(from, aifp, OUT_UNICAST, 0, (aifp->int_state & IS_NO_RIPV1_OUT) ? RIPv2 : RIPv1, - ap != 0); + ap != NULL); return; } @@ -387,7 +386,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ if (v12buf.buf->rip_vers != RIPv1) v12buf.n->n_mask = mask; - if (rt == 0) { + if (rt == NULL) { /* we do not have the answer */ v12buf.n->n_metric = HOPCNT_INFINITY; } else { @@ -397,7 +396,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ v12buf.n->n_family = RIP_AF_INET; v12buf.n->n_dst = dst; v12buf.n->n_metric = (rt->rt_metric+1 - + ((aifp!=0) + + ((aifp!=NULL) ? aifp->int_metric : 1)); if (v12buf.n->n_metric > HOPCNT_INFINITY) @@ -405,7 +404,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ if (v12buf.buf->rip_vers != RIPv1) { v12buf.n->n_tag = rt->rt_tag; v12buf.n->n_mask = mask; - if (aifp != 0 + if (aifp != NULL && on_net(rt->rt_gate, aifp->int_net, aifp->int_mask) @@ -423,7 +422,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ /* Send the answer about specific routes. */ - if (ap != 0 && ap->type == RIP_AUTH_MD5) + if (ap != NULL && ap->type == RIP_AUTH_MD5) end_md5_auth(&v12buf, ap); if (from->sin_port != htons(RIP_PORT)) { @@ -458,7 +457,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ naddr_ntoa(FROM_NADDR)); return; } - if (aifp == 0) { + if (aifp == NULL) { msglog("trace command from unknown router %s", naddr_ntoa(FROM_NADDR)); return; @@ -515,7 +514,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ * via broadcast or point-to-point networks, and from * those listed in /etc/gateways. */ - if (aifp == 0) { + if (aifp == NULL) { msglim(&unk_router, FROM_NADDR, " discard response from %s" " via unexpected interface", @@ -560,7 +559,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ tg = tgates; while (tg->tgate_addr != FROM_NADDR) { tg = tg->tgate_next; - if (tg == 0) { + if (tg == NULL) { trace_pkt(" discard RIP response" " from untrusted router %s", naddr_ntoa(FROM_NADDR)); @@ -704,7 +703,7 @@ input(struct sockaddr_in *from, /* received from this IP address */ * of the defense against RS_NET_SYN. */ if (have_ripv1_out - && (((rt = rtget(dst,mask)) == 0 + && (((rt = rtget(dst,mask)) == NULL || !(rt->rt_state & RS_NET_SYN))) && (v1_mask = ripv1_mask_net(dst,0)) > mask) { ddst_h = v1_mask & -v1_mask; @@ -769,7 +768,7 @@ input_route(naddr dst, /* network order */ * If our interface is broken, switch to using the other guy. */ ifp1 = ifwithaddr(dst, 1, 1); - if (ifp1 != 0 + if (ifp1 != NULL && (!(ifp1->int_state & IS_BROKE) || (ifp1->int_state & IS_PASSIVE))) return; @@ -780,7 +779,7 @@ input_route(naddr dst, /* network order */ /* Consider adding the route if we do not already have it. */ - if (rt == 0) { + if (rt == NULL) { /* Ignore unknown routes being poisoned. */ if (new->rts_metric == HOPCNT_INFINITY) diff --git a/sbin/routed/main.c b/sbin/routed/main.c index 3560950453..617ad70a80 100644 --- a/sbin/routed/main.c +++ b/sbin/routed/main.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/main.c,v 1.11.2.1 2000/08/14 17:00:03 sheldonh Exp $ - * $DragonFly: src/sbin/routed/main.c,v 1.4 2005/03/16 21:21:34 cpressey Exp $ */ #include "defs.h" @@ -575,7 +574,7 @@ fix_select(void) if (sock_max <= rip_sock) sock_max = rip_sock+1; } - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + for (ifp = ifnet; NULL != ifp; ifp = ifp->int_next) { if (ifp->int_rip_sock >= 0) { FD_SET(ifp->int_rip_sock, &fdbits); if (sock_max <= ifp->int_rip_sock) @@ -687,7 +686,7 @@ rip_off(void) /* get non-broadcast sockets to listen to queries. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { if (ifp->int_state & IS_REMOTE) continue; if (ifp->int_rip_sock < 0) { @@ -738,7 +737,7 @@ rip_on(struct interface *ifp) * multicasts for this interface. */ if (rip_sock >= 0) { - if (ifp != 0) + if (ifp != NULL) rip_mcast_on(ifp); return; } @@ -756,7 +755,7 @@ rip_on(struct interface *ifp) * since that would let two daemons bind to the broadcast * socket. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { if (ifp->int_rip_sock >= 0) { close(ifp->int_rip_sock); ifp->int_rip_sock = -1; @@ -764,20 +763,20 @@ rip_on(struct interface *ifp) } rip_sock = get_rip_sock(INADDR_ANY, 1); - rip_sock_mcast = 0; + rip_sock_mcast = NULL; /* Do not advertise anything until we have heard something */ if (next_bcast.tv_sec < now.tv_sec+MIN_WAITTIME) next_bcast.tv_sec = now.tv_sec+MIN_WAITTIME; - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { ifp->int_query_time = NEVER; rip_mcast_on(ifp); } ifinit_timer.tv_sec = now.tv_sec; - } else if (ifp != 0 + } else if (ifp != NULL && !(ifp->int_state & IS_REMOTE) && ifp->int_rip_sock < 0) { /* RIP is off, so ensure there are sockets on which @@ -797,7 +796,7 @@ rtmalloc(size_t size, const char *msg) { void *p = malloc(size); - if (p == 0) + if (p == NULL) logbad(1,"malloc(%lu) failed in %s", (u_long)size, msg); return p; } @@ -892,7 +891,7 @@ msglim(struct msg_limit *lim, naddr addr, const char *p, ...) /* Reuse a slot at most once every 10 minutes. */ if (lim->reuse > now.tv_sec) { - ms = 0; + ms = NULL; } else { ms = ms1; lim->reuse = now.tv_sec + 10*60; @@ -904,13 +903,13 @@ msglim(struct msg_limit *lim, naddr addr, const char *p, ...) * most once an hour. */ if (ms->until > now.tv_sec) - ms = 0; + ms = NULL; break; } if (ms->until < ms1->until) ms = ms1; } - if (ms != 0) { + if (ms != NULL) { ms->addr = addr; ms->until = now.tv_sec + 60*60; /* 60 minutes */ diff --git a/sbin/routed/output.c b/sbin/routed/output.c index efb8ea92be..3e8d10c58e 100644 --- a/sbin/routed/output.c +++ b/sbin/routed/output.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/output.c,v 1.5.2.1 2000/08/14 17:00:03 sheldonh Exp $ - * $DragonFly: src/sbin/routed/output.c,v 1.5 2005/03/16 21:21:34 cpressey Exp $ */ #include "defs.h" @@ -174,7 +173,7 @@ output(enum output_type type, LOGERR("setsockopt(rip_sock," "IP_MULTICAST_IF)"); errno = serrno; - ifp = 0; + ifp = NULL; return -1; } rip_sock_mcast = ifp; @@ -197,11 +196,11 @@ output(enum output_type type, res = sendto(soc, buf, size, flags, (struct sockaddr *)&in, sizeof(in)); if (res < 0 - && (ifp == 0 || !(ifp->int_state & IS_BROKE))) { + && (ifp == NULL || !(ifp->int_state & IS_BROKE))) { serrno = errno; msglog("%s sendto(%s%s%s.%d): %s", msg, - ifp != 0 ? ifp->int_name : "", - ifp != 0 ? ", " : "", + ifp != NULL ? ifp->int_name : "", + ifp != NULL ? ", " : "", inet_ntoa(in.sin_addr), ntohs(in.sin_port), strerror(errno)); @@ -224,10 +223,10 @@ find_auth(struct interface *ifp) int i; - if (ifp == 0) + if (ifp == NULL) return 0; - res = 0; + res = NULL; ap = ifp->int_auth; for (i = 0; i < MAX_AUTH_KEYS; i++, ap++) { /* stop looking after the last key */ @@ -240,13 +239,13 @@ find_auth(struct interface *ifp) if ((u_long)ap->end < (u_long)clk.tv_sec) { /* note best expired password as a fall-back */ - if (res == 0 || (u_long)ap->end > (u_long)res->end) + if (res == NULL || (u_long)ap->end > (u_long)res->end) res = ap; continue; } /* note key with the best future */ - if (res == 0 || (u_long)res->end < (u_long)ap->end) + if (res == NULL || (u_long)res->end < (u_long)ap->end) res = ap; } return res; @@ -265,7 +264,7 @@ clr_ws_buf(struct ws_buf *wb, /* (start to) install authentication if appropriate */ - if (ap == 0) + if (ap == NULL) return; na = (struct netauth*)wb->n; @@ -327,11 +326,11 @@ supply_write(struct ws_buf *wb) case NO_OUT_RIPV2: break; default: - if (ws.a != 0 && ws.a->type == RIP_AUTH_MD5) + if (ws.a != NULL && ws.a->type == RIP_AUTH_MD5) end_md5_auth(wb,ws.a); if (output(wb->type, &ws.to, ws.ifp, wb->buf, ((char *)wb->n - (char*)wb->buf)) < 0 - && ws.ifp != 0) + && ws.ifp != NULL) if_sick(ws.ifp); ws.npackets++; break; @@ -687,7 +686,7 @@ supply(struct sockaddr_in *dst, ws.to_std_mask = std_mask(ws.to.sin_addr.s_addr); ws.to_std_net = ntohl(ws.to.sin_addr.s_addr) & ws.to_std_mask; - if (ifp != 0) { + if (ifp != NULL) { ws.to_mask = ifp->int_mask; ws.to_net = ifp->int_net; if (on_net(ws.to.sin_addr.s_addr, ws.to_net, ws.to_mask)) @@ -705,7 +704,7 @@ supply(struct sockaddr_in *dst, if (flash) ws.state |= WS_ST_FLASH; - if ((ws.ifp = ifp) == 0) { + if ((ws.ifp = ifp) == NULL) { ws.metric = 1; } else { /* Adjust the advertised metric by the outgoing interface @@ -746,18 +745,18 @@ supply(struct sockaddr_in *dst, if ((ws.state & WS_ST_QUERY) || !(ws.state & WS_ST_TO_ON_NET)) { ws.state |= (WS_ST_AG | WS_ST_SUPER_AG); - } else if (ifp == 0 || !(ifp->int_state & IS_NO_AG)) { + } else if (ifp == NULL || !(ifp->int_state & IS_NO_AG)) { ws.state |= WS_ST_AG; if (type != OUT_BROADCAST - && (ifp == 0 + && (ifp == NULL || !(ifp->int_state & IS_NO_SUPER_AG))) ws.state |= WS_ST_SUPER_AG; } } ws.a = (vers == RIPv2) ? find_auth(ifp) : 0; - if (!passwd_ok && ws.a != 0 && ws.a->type == RIP_AUTH_PW) - ws.a = 0; + if (!passwd_ok && ws.a != NULL && ws.a->type == RIP_AUTH_PW) + ws.a = NULL; clr_ws_buf(&v12buf,ws.a); clr_ws_buf(&v2buf,ws.a); @@ -765,7 +764,7 @@ supply(struct sockaddr_in *dst, * a better, real default route. */ if (supplier && (def_metric = ifp->int_d_metric) != 0) { - if (0 == (rt = rtget(RIP_DEFAULT, 0)) + if (NULL == (rt = rtget(RIP_DEFAULT, 0)) || rt->rt_metric+ws.metric >= def_metric) { ws.state |= WS_ST_DEFAULT; ag_check(0, 0, 0, 0, def_metric, def_metric, @@ -840,7 +839,7 @@ rip_bcast(int flash) flash ? "dynamic update" : "all routes", rtime.tv_sec + ((float)rtime.tv_usec)/1000000.0); - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { /* Skip interfaces not doing RIP. * Do try broken interfaces to see if they have healed. */ diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c index dda7ee0931..1d5c29920c 100644 --- a/sbin/routed/parms.c +++ b/sbin/routed/parms.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/parms.c,v 1.7.2.1 2000/08/14 17:00:03 sheldonh Exp $ - * $DragonFly: src/sbin/routed/parms.c,v 1.4 2004/12/18 21:43:40 swildner Exp $ */ #include "defs.h" @@ -62,7 +61,7 @@ get_parms(struct interface *ifp) /* get all relevant parameters */ - for (parmp = parms; parmp != 0; parmp = parmp->parm_next) { + for (parmp = parms; parmp != NULL; parmp = parmp->parm_next) { if (parmp->parm_name[0] == '\0' || !strcmp(ifp->int_name, parmp->parm_name) || (parmp->parm_name[0] == '\n' @@ -178,7 +177,7 @@ gwkludge(void) fp = fopen(_PATH_GATEWAYS, "r"); - if (fp == 0) + if (fp == NULL) return; if (0 > fstat(fileno(fp), &sb)) { @@ -208,7 +207,7 @@ gwkludge(void) cp = parse_parms(lptr, (sb.st_uid == 0 && !(sb.st_mode&(S_IRWXG|S_IRWXO)))); - if (cp != 0) + if (cp != NULL) msglog("%s in line %d of "_PATH_GATEWAYS, cp, lnum); continue; @@ -314,7 +313,7 @@ gwkludge(void) state |= IS_NO_RIP; ifp = check_dup(gate,dst,netmask,0); - if (ifp != 0) { + if (ifp != NULL) { msglog("duplicate "_PATH_GATEWAYS" entry \"%s\"",lptr); continue; } @@ -349,7 +348,7 @@ gwkludge(void) /* After all of the parameter lines have been read, * apply them to any remote interfaces. */ - for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next) { + for (ifp = ifnet; NULL != ifp; ifp = ifp->int_next) { get_parms(ifp); tot_interfaces++; @@ -418,7 +417,7 @@ exit: return -1; *buf = '\0'; /* terminate copy of token */ - if (delimp != 0) + if (delimp != NULL) *delimp = c; /* return delimiter */ *linep = pc-1; /* say where we ended */ return 0; @@ -536,13 +535,13 @@ get_passwd(char *tgt, if (delim == '|') { val0 = ++val; - if (0 != (p = parse_ts(&k.start,&val,val0,&delim, + if (NULL != (p = parse_ts(&k.start,&val,val0,&delim, buf,sizeof(buf)))) return p; if (delim != '|') return "missing second timestamp"; val0 = ++val; - if (0 != (p = parse_ts(&k.end,&val,val0,&delim, + if (NULL != (p = parse_ts(&k.end,&val,val0,&delim, buf,sizeof(buf)))) return p; if ((u_long)k.start > (u_long)k.end) { @@ -585,7 +584,7 @@ parse_parms(char *line, struct r1net *r1netp; struct tgate *tg; naddr addr, mask; - char delim, *val0 = 0, *tgt, *val, *p; + char delim, *val0 = NULL, *tgt, *val, *p; const char *msg; char buf[BUFSIZ], buf2[BUFSIZ]; int i; @@ -852,7 +851,7 @@ check_parms(struct parm *new) /* compare with existing sets of parameters */ for (parmpp = &parms; - (parmp = *parmpp) != 0; + (parmp = *parmpp) != NULL; parmpp = &parmp->parm_next) { if (strcmp(new->parm_name, parmp->parm_name)) continue; @@ -925,7 +924,7 @@ getnet(char *name, /* Detect and separate "1.2.3.4/24" */ - if (0 != (mname = strrchr(name,'/'))) { + if (NULL != (mname = strrchr(name,'/'))) { i = (int)(mname - name); if (i > (int)sizeof(hname)-1) /* name too long */ return 0; @@ -936,7 +935,7 @@ getnet(char *name, } np = getnetbyname(name); - if (np != 0) { + if (np != NULL) { in.s_addr = (naddr)np->n_net; if (0 == (in.s_addr & 0xff000000)) in.s_addr <<= 8; diff --git a/sbin/routed/radix.c b/sbin/routed/radix.c index 8f781f5ed7..1a4f4e6698 100644 --- a/sbin/routed/radix.c +++ b/sbin/routed/radix.c @@ -33,7 +33,6 @@ * @(#)radix.c 8.4 (Berkeley) 11/2/94 * * $FreeBSD: src/sbin/routed/radix.c,v 1.5 1999/09/05 17:49:11 peter Exp $ - * $DragonFly: src/sbin/routed/radix.c,v 1.3 2004/02/04 17:40:01 joerg Exp $ */ /* @@ -167,7 +166,7 @@ rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) caddr_t netmask = 0; if (m_arg) { - if ((x = rn_addmask(m_arg, 1, head->rnh_treetop->rn_off)) == 0) + if ((x = rn_addmask(m_arg, 1, head->rnh_treetop->rn_off)) == NULL) return (0); netmask = x->rn_key; } @@ -188,7 +187,7 @@ rn_satisfies_leaf(char *trial, char *cplim; int length = min(*(u_char *)cp, *(u_char *)cp2); - if (cp3 == 0) + if (cp3 == NULL) cp3 = rn_ones; else length = min(length, *(u_char *)cp3); @@ -443,7 +442,7 @@ rn_addmask(void *n_arg, int search, int skip) *addmask_key = last_zeroed = mlen; x = rn_search(addmask_key, rn_masktop); if (Bcmp(addmask_key, x->rn_key, mlen) != 0) - x = 0; + x = NULL; if (x || search) return (x); x = (struct radix_node *)rtmalloc(max_keylen + 2*sizeof(*x), @@ -498,7 +497,7 @@ rn_new_radix_mask(struct radix_node *tt, struct radix_mask *m; MKGet(m); - if (m == 0) { + if (m == NULL) { log(LOG_ERR, "Mask for route not entered\n"); return (0); } @@ -521,7 +520,7 @@ rn_addroute(void *v_arg, struct radix_node treenodes[2]) { caddr_t v = (caddr_t)v_arg, netmask = (caddr_t)n_arg; - struct radix_node *t, *x = 0, *tt; + struct radix_node *t, *x = NULL, *tt; struct radix_node *saved_tt, *top = head->rnh_treetop; short b = 0, b_leaf = 0; int keyduplicated; @@ -536,7 +535,7 @@ rn_addroute(void *v_arg, * nodes and possibly save time in calculating indices. */ if (netmask) { - if ((x = rn_addmask(netmask, 0, top->rn_off)) == 0) + if ((x = rn_addmask(netmask, 0, top->rn_off)) == NULL) return (0); b_leaf = x->rn_b; b = -1 - x->rn_b; @@ -614,7 +613,7 @@ rn_addroute(void *v_arg, for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) if (m->rm_b >= b_leaf) break; - t->rn_mklist = m; *mp = 0; + t->rn_mklist = m; *mp = NULL; } on2: /* Add new route to highest possible ancestor's list */ @@ -676,21 +675,21 @@ rn_delete(void *v_arg, vlen = *(u_char *)v; saved_tt = tt; top = x; - if (tt == 0 || + if (tt == NULL || Bcmp(v + head_off, tt->rn_key + head_off, vlen - head_off)) return (0); /* * Delete our route from mask lists. */ if (netmask) { - if ((x = rn_addmask(netmask, 1, head_off)) == 0) + if ((x = rn_addmask(netmask, 1, head_off)) == NULL) return (0); netmask = x->rn_key; while (tt->rn_mask != netmask) - if ((tt = tt->rn_dupedkey) == 0) + if ((tt = tt->rn_dupedkey) == NULL) return (0); } - if (tt->rn_mask == 0 || (saved_m = m = tt->rn_mklist) == 0) + if (tt->rn_mask == 0 || (saved_m = m = tt->rn_mklist) == NULL) goto on1; if (tt->rn_flags & RNF_NORMAL) { if (m->rm_leaf != tt || m->rm_refs > 0) { @@ -719,7 +718,7 @@ rn_delete(void *v_arg, MKFree(m); break; } - if (m == 0) { + if (m == NULL) { log(LOG_ERR, "rn_delete: couldn't find our annotation\n"); if (tt->rn_flags & RNF_NORMAL) return (0); /* Dangling ref to us */ diff --git a/sbin/routed/rdisc.c b/sbin/routed/rdisc.c index 0e15d4ae36..44e556ff2b 100644 --- a/sbin/routed/rdisc.c +++ b/sbin/routed/rdisc.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/rdisc.c,v 1.5.2.1 2000/08/14 17:00:04 sheldonh Exp $ - * $DragonFly: src/sbin/routed/rdisc.c,v 1.4 2005/03/16 21:21:34 cpressey Exp $ */ #include "defs.h" @@ -306,7 +305,7 @@ rdisc_age(naddr bad_gate) /* If switching from client to server, get rid of old * default routes. */ - if (cur_drp != 0) + if (cur_drp != NULL) rdisc_sort(); rdisc_adv(); return; @@ -458,7 +457,7 @@ rdisc_sort(void) /* Find the best discovered route. */ - new_drp = 0; + new_drp = NULL; for (drp = drs; drp < &drs[MAX_ADS]; drp++) { if (drp->dr_ts == 0) continue; @@ -483,7 +482,7 @@ rdisc_sort(void) * bad routers. * Avoid sick interfaces. */ - if (new_drp == 0 + if (new_drp == NULL || (!((new_st ^ drp->dr_ifp->int_state) & IS_SICK) && (new_pref < drp->dr_pref || (new_pref == drp->dr_pref @@ -505,11 +504,11 @@ rdisc_sort(void) /* Stop using discovered routes if they are all bad */ - if (new_drp == 0) { + if (new_drp == NULL) { trace_act("turn off Router Discovery client"); rdisc_ok = 0; - if (rt != 0 + if (rt != NULL && (rt->rt_state & RS_RDISC)) { new = rt->rt_spares[0]; new.rts_metric = HOPCNT_INFINITY; @@ -520,7 +519,7 @@ rdisc_sort(void) } } else { - if (cur_drp == 0) { + if (cur_drp == NULL) { trace_act("turn on Router Discovery client" " using %s via %s", naddr_ntoa(new_drp->dr_gate), @@ -542,7 +541,7 @@ rdisc_sort(void) new.rts_router = new_drp->dr_gate; new.rts_metric = HOPCNT_INFINITY-1; new.rts_time = now.tv_sec; - if (rt != 0) { + if (rt != NULL) { rtchange(rt, rt->rt_state | RS_RDISC, &new, 0); } else { rtadd(RIP_DEFAULT, 0, RS_RDISC, &new); @@ -604,7 +603,7 @@ parse_ad(naddr from, life = 0; } - for (new_drp = 0, drp = drs; drp < &drs[MAX_ADS]; drp++) { + for (new_drp = NULL, drp = drs; drp < &drs[MAX_ADS]; drp++) { /* accept new info for a familiar entry */ if (drp->dr_gate == gate) { @@ -618,7 +617,7 @@ parse_ad(naddr from, if (drp->dr_ts == 0) { new_drp = drp; /* use unused entry */ - } else if (new_drp == 0) { + } else if (new_drp == NULL) { /* look for an entry worse than the new one to * reuse. */ @@ -643,7 +642,7 @@ parse_ad(naddr from, } /* forget it if all of the current entries are better */ - if (new_drp == 0) + if (new_drp == NULL) return; new_drp->dr_ifp = ifp; @@ -751,7 +750,7 @@ send_rdisc(union ad_u *p, &tgt_mcast, sizeof(tgt_mcast))) { LOGERR("setsockopt(rdisc_sock," "IP_MULTICAST_IF)"); - rdisc_sock_mcast = 0; + rdisc_sock_mcast = NULL; return; } rdisc_sock_mcast = ifp; @@ -768,13 +767,13 @@ send_rdisc(union ad_u *p, if (0 > sendto(rdisc_sock, p, p_size, flags, (struct sockaddr *)&in, sizeof(in))) { - if (ifp == 0 || !(ifp->int_state & IS_BROKE)) + if (ifp == NULL || !(ifp->int_state & IS_BROKE)) msglog("sendto(%s%s%s): %s", - ifp != 0 ? ifp->int_name : "", - ifp != 0 ? ", " : "", + ifp != NULL ? ifp->int_name : "", + ifp != NULL ? ", " : "", inet_ntoa(in.sin_addr), strerror(errno)); - if (ifp != 0) + if (ifp != NULL) if_sick(ifp); } } @@ -925,7 +924,7 @@ ck_icmp(const char *act, trace_rdisc(act, from, to, ifp, p, len); - if (ifp == 0) + if (ifp == NULL) trace_pkt("unknown interface for router-discovery %s" " from %s to %s", type, naddr_ntoa(from), naddr_ntoa(to)); @@ -987,7 +986,7 @@ read_d(void) #ifdef USE_PASSIFNAME ifp = ifwithname(buf.ifname, 0); - if (ifp == 0) + if (ifp == NULL) msglim(&bad_name, from.sin_addr.s_addr, "impossible rdisc if_ name %.*s", IFNAMSIZ, buf.ifname); @@ -1000,7 +999,7 @@ read_d(void) #endif ifp = ck_icmp("Recv", from.sin_addr.s_addr, ifp, buf.pkt.ip.ip_dst.s_addr, p, cc); - if (ifp == 0) + if (ifp == NULL) continue; if (ifwithaddr(from.sin_addr.s_addr, 0, 0)) { trace_pkt(" " diff --git a/sbin/routed/rtquery/rtquery.c b/sbin/routed/rtquery/rtquery.c index 317d0eaf31..6502e5ec91 100644 --- a/sbin/routed/rtquery/rtquery.c +++ b/sbin/routed/rtquery/rtquery.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/rtquery/rtquery.c,v 1.13 1999/08/28 00:14:21 peter Exp $ - * $DragonFly: src/sbin/routed/rtquery/rtquery.c,v 1.4 2004/12/18 21:43:46 swildner Exp $ */ char copyright[] = @@ -169,7 +168,7 @@ main(int argc, rflag = getnet(optarg, &OMSG.rip_nets[0]); if (!rflag) { struct hostent *hp = gethostbyname(optarg); - if (hp == 0) { + if (hp == NULL) { fprintf(stderr, "%s: %s:", pgmname, optarg); herror(0); @@ -346,7 +345,7 @@ trace_loop(char *argv[]) } res = 1; - while (*argv != 0) { + while (*argv != NULL) { if (out(*argv++) <= 0) res = 0; } @@ -410,9 +409,9 @@ query_loop(char *argv[], int argc) } /* ask the first (valid) host */ - seen = 0; + seen = NULL; while (0 > out(*argv++)) { - if (*argv == 0) + if (*argv == NULL) exit(-1); answered++; } @@ -438,13 +437,13 @@ query_loop(char *argv[], int argc) * because a router might respond with a * different source address. */ - for (sp = seen; sp != 0; sp = sp->next) { + for (sp = seen; sp != NULL; sp = sp->next) { if (sp->addr.s_addr == from.sin_addr.s_addr) break; } - if (sp == 0) { + if (sp == NULL) { sp = malloc(sizeof(*sp)); - if (sp == 0) { + if (sp == NULL) { fprintf(stderr, "rtquery: malloc failed\n"); exit(1); @@ -469,7 +468,7 @@ query_loop(char *argv[], int argc) /* After a pause in responses, probe another host. * This reduces the intermingling of answers. */ - while (*argv != 0 && 0 > out(*argv++)) + while (*argv != NULL && 0 > out(*argv++)) answered++; /* continue until no more packets arrive @@ -513,7 +512,7 @@ out(const char *host) #endif if (!inet_aton(host, &router.sin_addr)) { hp = gethostbyname(host); - if (hp == 0) { + if (hp == NULL) { herror(host); return -1; } @@ -612,7 +611,7 @@ rip_input(struct sockaddr_in *from, } else { hp = gethostbyaddr(&from->sin_addr, sizeof(struct in_addr), AF_INET); - if (hp == 0) { + if (hp == NULL) { printf("%s:", inet_ntoa(from->sin_addr)); } else { @@ -684,7 +683,7 @@ rip_input(struct sockaddr_in *from, if ((in.s_addr & ~mask) == 0) { np = getnetbyaddr((long)in.s_addr, AF_INET); - if (np != 0) + if (np != NULL) name = np->n_name; else if (in.s_addr == 0) name = "default"; @@ -694,7 +693,7 @@ rip_input(struct sockaddr_in *from, || mask == 0xffffffff)) { hp = gethostbyaddr(&in, sizeof(in), AF_INET); - if (hp != 0) + if (hp != NULL) name = hp->h_name; } } @@ -757,11 +756,11 @@ rip_input(struct sockaddr_in *from, if (n->n_nhop != 0) { in.s_addr = n->n_nhop; if (nflag) - hp = 0; + hp = NULL; else hp = gethostbyaddr(&in, sizeof(in), AF_INET); printf(" nhop=%-15s%s", - (hp != 0) ? hp->h_name : inet_ntoa(in), + (hp != NULL) ? hp->h_name : inet_ntoa(in), (IMSG.rip_vers == RIPv1) ? " ?" : ""); } if (n->n_tag != 0) @@ -806,7 +805,7 @@ getnet(char *name, /* Detect and separate "1.2.3.4/24" */ - if (0 != (mname = strrchr(name,'/'))) { + if (NULL != (mname = strrchr(name,'/'))) { i = (int)(mname - name); if (i > (int)sizeof(hname)-1) /* name too long */ return 0; @@ -817,7 +816,7 @@ getnet(char *name, } nentp = getnetbyname(name); - if (nentp != 0) { + if (nentp != NULL) { in.s_addr = nentp->n_net; } else if (inet_aton(name, &in) == 1) { in.s_addr = ntohl(in.s_addr); @@ -825,7 +824,7 @@ getnet(char *name, return 0; } - if (mname == 0) { + if (mname == NULL) { mask = std_mask(in.s_addr); if ((~mask & in.s_addr) != 0) mask = 0xffffffff; @@ -896,7 +895,7 @@ parse_quote(char **linep, --lim; } exit: - if (delimp != 0) + if (delimp != NULL) *delimp = c; *linep = pc-1; if (lim != 0) diff --git a/sbin/routed/table.c b/sbin/routed/table.c index b6b175c833..f821d46e82 100644 --- a/sbin/routed/table.c +++ b/sbin/routed/table.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/table.c,v 1.9.2.2 2000/08/14 17:00:04 sheldonh Exp $ - * $DragonFly: src/sbin/routed/table.c,v 1.6 2005/03/16 21:21:34 cpressey Exp $ */ #include "defs.h" @@ -100,9 +99,9 @@ struct ag_info ag_slots[NUM_AG_SLOTS], *ag_avail, *ag_corsest, *ag_finest; /* #define DEBUG_AG */ #ifdef DEBUG_AG #define CHECK_AG() {int acnt = 0; struct ag_info *cag; \ - for (cag = ag_avail; cag != 0; cag = cag->ag_fine) \ + for (cag = ag_avail; cag != NULL; cag = cag->ag_fine) \ acnt++; \ - for (cag = ag_corsest; cag != 0; cag = cag->ag_fine) \ + for (cag = ag_corsest; cag != NULL; cag = cag->ag_fine) \ acnt++; \ if (acnt != NUM_AG_SLOTS) { \ fflush(stderr); \ @@ -140,7 +139,7 @@ ag_out(struct ag_info *ag, * ensures that the twins are seen before the parent is emitted. */ ag_cors = ag->ag_cors; - if (ag_cors != 0 + if (ag_cors != NULL && ag_cors->ag_mask == ag->ag_mask<<1 && ag_cors->ag_dst_h == (ag->ag_dst_h & ag_cors->ag_mask)) { ag_cors->ag_state |= ((ag_cors->ag_dst_h == ag->ag_dst_h) @@ -209,7 +208,7 @@ ag_flush(naddr lim_dst_h, /* flush routes to here */ for (ag = ag_finest; - ag != 0 && ag->ag_mask >= lim_mask; + ag != NULL && ag->ag_mask >= lim_mask; ag = ag_cors) { ag_cors = ag->ag_cors; @@ -224,7 +223,7 @@ ag_flush(naddr lim_dst_h, /* flush routes to here */ else for ( ; ; ag_cors = ag_cors->ag_cors) { /* Look for a route that can suppress the * current route */ - if (ag_cors == 0) { + if (ag_cors == NULL) { /* failed, so output it and look for * another route to work on */ @@ -323,9 +322,9 @@ ag_check(naddr dst, /* Search for the right slot in the aggregation table. */ - ag_cors = 0; + ag_cors = NULL; ag = ag_corsest; - while (ag != 0) { + while (ag != NULL) { if (ag->ag_mask >= mask) break; @@ -338,7 +337,7 @@ ag_check(naddr dst, * This check keeps poor routes (e.g. with large hop counts) * from preventing suppression of finer routes. */ - if (ag_cors != 0 + if (ag_cors != NULL && ag->ag_dst_h < dst && (ag->ag_state & AGS_SUPPRESS) && ag_cors->ag_pref <= ag->ag_pref @@ -379,7 +378,7 @@ ag_check(naddr dst, * times around this loop, it could be the even twin promoted * from the even/odd pair of twins of the finer route. */ - while (ag != 0 + while (ag != NULL && ag->ag_mask == mask && ((ag->ag_dst_h ^ dst) & (mask<<1)) == 0) { @@ -546,7 +545,7 @@ ag_check(naddr dst, mask <<= 1; dst &= mask; - if (ag_cors == 0) { + if (ag_cors == NULL) { ag = ag_corsest; break; } @@ -562,7 +561,7 @@ ag_check(naddr dst, * In case we moved toward coarser masks, * get back where we belong */ - if (ag != 0 + if (ag != NULL && ag->ag_mask < mask) { ag_cors = ag; ag = ag->ag_fine; @@ -570,20 +569,20 @@ ag_check(naddr dst, /* Empty the target slot */ - if (ag != 0 && ag->ag_mask == mask) { + if (ag != NULL && ag->ag_mask == mask) { ag_flush(ag->ag_dst_h, ag->ag_mask, out); - ag = (ag_cors == 0) ? ag_corsest : ag_cors->ag_fine; + ag = (ag_cors == NULL) ? ag_corsest : ag_cors->ag_fine; } #ifdef DEBUG_AG fflush(stderr); - if (ag == 0 && ag_cors != ag_finest) + if (ag == NULL && ag_cors != ag_finest) abort(); - if (ag_cors == 0 && ag != ag_corsest) + if (ag_cors == NULL && ag != ag_corsest) abort(); - if (ag != 0 && ag->ag_cors != ag_cors) + if (ag != NULL && ag->ag_cors != ag_cors) abort(); - if (ag_cors != 0 && ag_cors->ag_fine != ag) + if (ag_cors != NULL && ag_cors->ag_fine != ag) abort(); CHECK_AG(); #endif @@ -604,12 +603,12 @@ ag_check(naddr dst, nag->ag_seqno = seqnum; nag->ag_fine = ag; - if (ag != 0) + if (ag != NULL) ag->ag_cors = nag; else ag_finest = nag; nag->ag_cors = ag_cors; - if (ag_cors == 0) + if (ag_cors == NULL) ag_corsest = nag; else ag_cors->ag_fine = nag; @@ -793,11 +792,11 @@ kern_find(naddr dst, naddr mask, struct khash ***ppk) { struct khash *k, **pk; - for (pk = &KHASH(dst,mask); (k = *pk) != 0; pk = &k->k_next) { + for (pk = &KHASH(dst,mask); (k = *pk) != NULL; pk = &k->k_next) { if (k->k_dst == dst && k->k_mask == mask) break; } - if (ppk != 0) + if (ppk != NULL) *ppk = pk; return k; } @@ -809,7 +808,7 @@ kern_add(naddr dst, naddr mask) struct khash *k, **pk; k = kern_find(dst, mask, &pk); - if (k != 0) + if (k != NULL) return k; k = (struct khash *)rtmalloc(sizeof(*k), "kern_add"); @@ -841,12 +840,12 @@ kern_check_static(struct khash *k, memset(&new, 0, sizeof(new)); new.rts_ifp = ifp; new.rts_gate = k->k_gate; - new.rts_router = (ifp != 0) ? ifp->int_addr : loopaddr; + new.rts_router = (ifp != NULL) ? ifp->int_addr : loopaddr; new.rts_metric = k->k_metric; new.rts_time = now.tv_sec; rt = rtget(k->k_dst, k->k_mask); - if (rt != 0) { + if (rt != NULL) { if (!(rt->rt_state & RS_STATIC)) rtchange(rt, rt->rt_state | RS_STATIC, &new, 0); } else { @@ -939,9 +938,9 @@ rtm_add(struct rt_msghdr *rtm, && INFO_AUTHOR(info)->sa_family == AF_INET) ifp = iflookup(S_ADDR(INFO_AUTHOR(info))); else - ifp = 0; + ifp = NULL; if (supplier - && (ifp == 0 || !(ifp->int_state & IS_REDIRECT_OK))) { + && (ifp == NULL || !(ifp->int_state & IS_REDIRECT_OK))) { /* Routers are not supposed to listen to redirects, * so delete it if it came via an unknown interface * or the interface does not have special permission. @@ -980,7 +979,7 @@ rtm_add(struct rt_msghdr *rtm, * Find the interface toward the gateway. */ ifp = iflookup(k->k_gate); - if (ifp == 0) + if (ifp == NULL) msglog("static route %s --> %s impossibly lacks ifp", addrname(S_ADDR(INFO_DST(info)), mask, 0), naddr_ntoa(k->k_gate)); @@ -1019,7 +1018,7 @@ get_info_gate(struct sockaddr **sap, struct sockaddr_dl *sdl = (struct sockaddr_dl *)*sap; struct interface *ifp; - if (sdl == 0) + if (sdl == NULL) return 0; if ((sdl)->sdl_family == AF_INET) return 1; @@ -1027,7 +1026,7 @@ get_info_gate(struct sockaddr **sap, return 0; ifp = ifwithindex(sdl->sdl_index, 1); - if (ifp == 0) + if (ifp == NULL) return 0; in->sin_addr.s_addr = ifp->int_addr; @@ -1060,7 +1059,7 @@ flush_kern(void) for (i = 0; i < KHASH_SIZE; i++) { - for (k = khash_bins[i]; k != 0; k = k->k_next) { + for (k = khash_bins[i]; k != NULL; k = k->k_next) { k->k_state |= KS_CHECK; } } @@ -1135,7 +1134,7 @@ flush_kern(void) } for (i = 0; i < KHASH_SIZE; i++) { - for (k = khash_bins[i]; k != 0; k = k->k_next) { + for (k = khash_bins[i]; k != NULL; k = k->k_next) { if (k->k_state & KS_CHECK) { msglog("%s --> %s disappeared from kernel", addrname(k->k_dst, k->k_mask, 0), @@ -1198,7 +1197,7 @@ read_rt(void) || m.r.rtm.rtm_type == RTM_DELADDR) { ifp = ifwithindex(m.ifm.ifm_index, m.r.rtm.rtm_type != RTM_DELADDR); - if (ifp == 0) + if (ifp == NULL) trace_act("note %s with flags %#x" " for unknown interface index #%d", rtm_type_name(m.r.rtm.rtm_type), @@ -1217,7 +1216,7 @@ read_rt(void) * off or on. */ if (ifinit_timer.tv_sec-now.tv_sec>=CHECK_BAD_INTERVAL - || ifp == 0 + || ifp == NULL || ((ifp->int_if_flags ^ m.ifm.ifm_flags) & IFF_UP) != 0) ifinit_timer.tv_sec = now.tv_sec; @@ -1325,7 +1324,7 @@ kern_out(struct ag_info *ag) */ if (ag->ag_metric == HOPCNT_INFINITY) { k = kern_find(htonl(ag->ag_dst_h), ag->ag_mask, 0); - if (k == 0) + if (k == NULL) return; } else { k = kern_add(htonl(ag->ag_dst_h), ag->ag_mask); @@ -1482,7 +1481,7 @@ fix_kern(void) ag_flush(0,0,kern_out); for (i = 0; i < KHASH_SIZE; i++) { - for (pk = &khash_bins[i]; (k = *pk) != 0; ) { + for (pk = &khash_bins[i]; (k = *pk) != NULL; ) { /* Do not touch static routes */ if (k->k_state & KS_STATIC) { kern_check_static(k,0); @@ -1556,7 +1555,7 @@ del_static(naddr dst, * and add a replacement. */ k = kern_find(dst, mask, 0); - if (k != 0 && (gate == 0 || k->k_gate == gate)) { + if (k != NULL && (gate == 0 || k->k_gate == gate)) { k->k_state &= ~(KS_STATIC | KS_DYNAMIC | KS_CHECK); k->k_state |= KS_DELETE; if (gone) { @@ -1566,7 +1565,7 @@ del_static(naddr dst, } rt = rtget(dst, mask); - if (rt != 0 && (rt->rt_state & RS_STATIC)) + if (rt != NULL && (rt->rt_state & RS_STATIC)) rtbad(rt); } @@ -1583,7 +1582,7 @@ del_redirects(naddr bad_gate, for (i = 0; i < KHASH_SIZE; i++) { - for (k = khash_bins[i]; k != 0; k = k->k_next) { + for (k = khash_bins[i]; k != NULL; k = k->k_next) { if (!(k->k_state & KS_DYNAMIC) || (k->k_state & KS_STATIC)) continue; @@ -1814,7 +1813,7 @@ rtswitch(struct rt_entry *rt, return; /* find the best alternative among the spares */ - if (rts == 0) + if (rts == NULL) rts = rts_better(rt); /* Do not bother if it is not worthwhile. @@ -1843,7 +1842,7 @@ rtdelete(struct rt_entry *rt) trace_add_del("Del", rt); k = kern_find(rt->rt_dst, rt->rt_mask, 0); - if (k != 0) { + if (k != NULL) { k->k_state |= KS_DELETE; need_kern.tv_sec = now.tv_sec; } @@ -1896,7 +1895,7 @@ rtbad_sub(struct rt_entry *rt) u_int state; - ifp1 = 0; + ifp1 = NULL; state = 0; if (rt->rt_state & RS_LOCAL) { @@ -1904,7 +1903,7 @@ rtbad_sub(struct rt_entry *rt) * If so, see if it is used by any other interfaces, such * as a point-to-point interface with the same local address. */ - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { /* Retain it if another interface needs it. */ if (ifp->int_addr == rt->rt_ifp->int_addr) { @@ -1921,7 +1920,7 @@ rtbad_sub(struct rt_entry *rt) * interface that justifies it. */ if (rt->rt_state & RS_NET_SYN) { - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) { + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) { if ((ifp->int_state & IS_NEED_NET_SYN) && rt->rt_mask == ifp->int_std_mask && rt->rt_dst == ifp->int_std_addr) { @@ -1934,7 +1933,7 @@ rtbad_sub(struct rt_entry *rt) /* or if there is an authority route that needs it. */ for (intnetp = intnets; - intnetp != 0; + intnetp != NULL; intnetp = intnetp->intnet_next) { if (intnetp->intnet_addr == rt->rt_dst && intnetp->intnet_mask == rt->rt_mask) { @@ -1944,7 +1943,7 @@ rtbad_sub(struct rt_entry *rt) } } - if (ifp1 != 0 || (state & RS_NET_SYN)) { + if (ifp1 != NULL || (state & RS_NET_SYN)) { struct rt_spare new = rt->rt_spares[0]; new.rts_ifp = ifp1; rtchange(rt, ((rt->rt_state & ~(RS_NET_SYN|RS_LOCAL)) | state), diff --git a/sbin/routed/trace.c b/sbin/routed/trace.c index 35eafe5e4d..7fbe7e75d0 100644 --- a/sbin/routed/trace.c +++ b/sbin/routed/trace.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/sbin/routed/trace.c,v 1.5.2.1 2002/11/07 17:19:13 imp Exp $ - * $DragonFly: src/sbin/routed/trace.c,v 1.3 2004/12/18 21:43:40 swildner Exp $ */ #define RIPCMDS @@ -143,7 +142,7 @@ naddr_ntoa(naddr a) const char * saddr_ntoa(struct sockaddr *sa) { - return (sa == 0) ? "?" : naddr_ntoa(S_ADDR(sa)); + return (sa == NULL) ? "?" : naddr_ntoa(S_ADDR(sa)); } @@ -184,7 +183,7 @@ tmsg(const char *p, ...) { va_list args; - if (ftrace != 0) { + if (ftrace != NULL) { lastlog(); va_start(args, p); vfprintf(ftrace, p, args); @@ -203,10 +202,10 @@ trace_close(int zap_stdio) fflush(stdout); fflush(stderr); - if (ftrace != 0 && zap_stdio) { + if (ftrace != NULL && zap_stdio) { if (ftrace != stdout) fclose(ftrace); - ftrace = 0; + ftrace = NULL; fd = open(_PATH_DEVNULL, O_RDWR); if (isatty(STDIN_FILENO)) dup2(fd, STDIN_FILENO); @@ -223,7 +222,7 @@ trace_close(int zap_stdio) void trace_flush(void) { - if (ftrace != 0) { + if (ftrace != NULL) { fflush(ftrace); if (ferror(ftrace)) trace_off("tracing off: %s", strerror(ferror(ftrace))); @@ -237,7 +236,7 @@ trace_off(const char *p, ...) va_list args; - if (ftrace != 0) { + if (ftrace != NULL) { lastlog(); va_start(args, p); vfprintf(ftrace, p, args); @@ -309,16 +308,16 @@ set_tracefile(const char *filename, * is already open or if coming from a trusted source, such as * a signal or the command line. */ - if (filename == 0 || filename[0] == '\0') { - filename = 0; - if (ftrace == 0) { + if (filename == NULL || filename[0] == '\0') { + filename = NULL; + if (ftrace == NULL) { if (inittracename[0] == '\0') { msglog("missing trace file name"); return; } fn = inittracename; } else { - fn = 0; + fn = NULL; } } else if (!strcmp(filename,"dump/../table")) { @@ -353,9 +352,9 @@ set_tracefile(const char *filename, fn = filename; } - if (fn != 0) { + if (fn != NULL) { n_ftrace = fopen(fn, "a"); - if (n_ftrace == 0) { + if (n_ftrace == NULL) { msglog("failed to open trace file \"%s\" %s", fn, strerror(errno)); if (fn == inittracename) @@ -377,9 +376,9 @@ set_tracefile(const char *filename, dup2(fileno(ftrace), STDERR_FILENO); } - if (new_tracelevel == 0 || filename == 0) + if (new_tracelevel == 0 || filename == NULL) new_tracelevel++; - tracelevel_msg(pat, dump != 0 ? dump : (filename != 0)); + tracelevel_msg(pat, dump != 0 ? dump : (filename != NULL)); } @@ -412,7 +411,7 @@ set_tracelevel(void) /* If tracing entirely off, and there was no tracefile specified * on the command line, then leave it off. */ - if (new_tracelevel > tracelevel && ftrace == 0) { + if (new_tracelevel > tracelevel && ftrace == NULL) { if (savetracename[0] != '\0') { set_tracefile(savetracename,sigtrace_pat,0); } else if (inittracename[0] != '\0') { @@ -565,7 +564,7 @@ trace_bits(const struct bits *tbl, } tbl++; } - if (field != 0 && tbl->bits_name != 0) { + if (field != 0 && tbl->bits_name != NULL) { if (c) putc(c, ftrace); fprintf(ftrace, tbl->bits_name, field); @@ -629,7 +628,7 @@ void trace_if(const char *act, struct interface *ifp) { - if (!TRACEACTIONS || ftrace == 0) + if (!TRACEACTIONS || ftrace == NULL) return; lastlog(); @@ -655,7 +654,7 @@ trace_upslot(struct rt_entry *rt, struct rt_spare *rts, struct rt_spare *new) { - if (!TRACEACTIONS || ftrace == 0) + if (!TRACEACTIONS || ftrace == NULL) return; if (rts->rts_gate == new->rts_gate @@ -715,7 +714,7 @@ trace_misc(const char *p, ...) { va_list args; - if (ftrace == 0) + if (ftrace == NULL) return; lastlog(); @@ -732,7 +731,7 @@ trace_act(const char *p, ...) { va_list args; - if (!TRACEACTIONS || ftrace == 0) + if (!TRACEACTIONS || ftrace == NULL) return; lastlog(); @@ -749,7 +748,7 @@ trace_pkt(const char *p, ...) { va_list args; - if (!TRACEPACKETS || ftrace == 0) + if (!TRACEPACKETS || ftrace == NULL) return; lastlog(); @@ -765,7 +764,7 @@ trace_change(struct rt_entry *rt, struct rt_spare *new, const char *label) { - if (ftrace == 0) + if (ftrace == NULL) return; if (rt->rt_metric == new->rts_metric @@ -803,7 +802,7 @@ trace_change(struct rt_entry *rt, void trace_add_del(const char * action, struct rt_entry *rt) { - if (ftrace == 0) + if (ftrace == NULL) return; lastlog(); @@ -852,12 +851,12 @@ trace_dump(void) { struct interface *ifp; - if (ftrace == 0) + if (ftrace == NULL) return; lastlog(); fputs("current daemon state:\n", ftrace); - for (ifp = ifnet; ifp != 0; ifp = ifp->int_next) + for (ifp = ifnet; ifp != NULL; ifp = ifp->int_next) trace_if("", ifp); rn_walktree(rhead, walk_trace, 0); } @@ -874,7 +873,7 @@ trace_rip(const char *dir1, const char *dir2, # define NA ((struct netauth*)n) int i, seen_route; - if (!TRACEPACKETS || ftrace == 0) + if (!TRACEPACKETS || ftrace == NULL) return; lastlog(); diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c index 2bfe9e234d..4cede56e9a 100644 --- a/sbin/slattach/slattach.c +++ b/sbin/slattach/slattach.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1988 Regents of the University of California. All rights reserved. * @(#)slattach.c 4.6 (Berkeley) 6/1/90 * $FreeBSD: src/sbin/slattach/slattach.c,v 1.36 1999/08/28 00:14:25 peter Exp $ - * $DragonFly: src/sbin/slattach/slattach.c,v 1.6 2005/02/02 07:59:48 cpressey Exp $ */ #include @@ -93,9 +92,9 @@ struct termios tty; /* tty configuration/state */ char tty_path[32]; /* path name of the tty (e.g. /dev/tty01) */ char pidfilename[40]; /* e.g. /var/run/slattach.tty01.pid */ -char *redial_cmd = 0; /* command to exec upon shutdown. */ -char *config_cmd = 0; /* command to exec if slip unit changes. */ -char *exit_cmd = 0; /* command to exec before exiting. */ +char *redial_cmd = NULL; /* command to exec upon shutdown. */ +char *config_cmd = NULL; /* command to exec if slip unit changes. */ +char *exit_cmd = NULL; /* command to exec before exiting. */ static void usage(void) diff --git a/sbin/startslip/startslip.c b/sbin/startslip/startslip.c index 9654322861..0119e0d3e1 100644 --- a/sbin/startslip/startslip.c +++ b/sbin/startslip/startslip.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1990, 1991, 1993 The Regents of the University of California. All rights reserved. * @(#)startslip.c 8.1 (Berkeley) 6/5/93 * $FreeBSD: src/sbin/startslip/startslip.c,v 1.31.2.1 2000/05/07 18:26:51 joe Exp $ - * $DragonFly: src/sbin/startslip/startslip.c,v 1.7 2005/02/02 20:27:51 cpressey Exp $ */ #include @@ -109,7 +108,7 @@ main(int argc, char **argv) char *cp, **ap; int ch, disc; FILE *wfd = NULL; - char *dialerstring = 0, buf[BUFSIZ]; + char *dialerstring = NULL, buf[BUFSIZ]; int unitnum, keepal = 0, outfill = 0; char unitname[32]; char *password; diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index 9d413dcee1..3ab2ad993e 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1980, 1989, 1993 The Regents of the University of California. All rights reserved. * @(#)umount.c 8.8 (Berkeley) 5/8/95 * $FreeBSD: src/sbin/umount/umount.c,v 1.28 2001/10/13 02:04:54 iedowse Exp $ - * $DragonFly: src/sbin/umount/umount.c,v 1.4 2005/11/06 12:51:01 swildner Exp $ */ #include @@ -680,7 +679,7 @@ getrealname(char *name, char *realname) size_t baselen; size_t dirlen; - dirname = '\0'; + dirname = NULL; havedir = 0; if (*name == '/') { if (ISDOT(name + 1) || ISDOTDOT(name + 1)) diff --git a/test/interbench/hackbench.c b/test/interbench/hackbench.c index 94e657111f..641dd3d201 100644 --- a/test/interbench/hackbench.c +++ b/test/interbench/hackbench.c @@ -144,7 +144,7 @@ void *hackbench_thread(void *t) char dummy; num_groups = 50; - t = 0; + t = NULL; fdpair(readyfds); fdpair(wakefds); diff --git a/test/stress/stress2/testcases/fts/fts.c b/test/stress/stress2/testcases/fts/fts.c index 80750cce2d..822125a6cb 100644 --- a/test/stress/stress2/testcases/fts/fts.c +++ b/test/stress/stress2/testcases/fts/fts.c @@ -62,7 +62,7 @@ test(void) ftsoptions = 0; args[0] = "."; - args[1] = 0; + args[1] = NULL; if ((fts = fts_open(args, ftsoptions, NULL)) == NULL) err(1, "fts_open"); diff --git a/test/stress/stress2/testcases/run/run.c b/test/stress/stress2/testcases/run/run.c index 16543717bf..2ff9219330 100644 --- a/test/stress/stress2/testcases/run/run.c +++ b/test/stress/stress2/testcases/run/run.c @@ -57,7 +57,7 @@ static char ** mkargv(char *name) { av[0] = name; - av[1] = 0; + av[1] = NULL; return (av); } diff --git a/test/stress/stress2/testcases/shm/shm.c b/test/stress/stress2/testcases/shm/shm.c index 1d576cb4b1..221be5bc92 100644 --- a/test/stress/stress2/testcases/shm/shm.c +++ b/test/stress/stress2/testcases/shm/shm.c @@ -71,7 +71,7 @@ setup(int nb) err(1, "shmget (%s:%d)", __FILE__, __LINE__); } - shm_buf = 0; + shm_buf = NULL; if ((shm_buf = shmat(shmid, NULL, 0)) == (void *) -1) err(1, "sender: shmat (%s:%d)", __FILE__, __LINE__); diff --git a/test/testcases/crypto/aesctr/aesctr.c b/test/testcases/crypto/aesctr/aesctr.c index a7c59b4e71..f5261cdb99 100644 --- a/test/testcases/crypto/aesctr/aesctr.c +++ b/test/testcases/crypto/aesctr/aesctr.c @@ -244,7 +244,7 @@ run(int num) if (debug) printf("%s\n", from); len = strlen(from); - if ((p = malloc(len)) == 0) { + if ((p = malloc(len)) == NULL) { warn("malloc"); goto done; } @@ -259,7 +259,7 @@ run(int num) data[i] = p; } len = length[TST_PLAIN]; - if ((p = malloc(len)) == 0) { + if ((p = malloc(len)) == NULL) { warn("malloc"); return (1); } diff --git a/tools/regression/p1003_1b/sched.c b/tools/regression/p1003_1b/sched.c index b921e3d37a..63ccd46782 100644 --- a/tools/regression/p1003_1b/sched.c +++ b/tools/regression/p1003_1b/sched.c @@ -29,7 +29,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * $FreeBSD: src/tools/regression/p1003_1b/sched.c,v 1.1 2000/02/16 14:28:42 dufault Exp $ - * $DragonFly: src/tools/regression/p1003_1b/sched.c,v 1.3 2007/06/26 23:30:05 josepht Exp $ * */ @@ -110,7 +109,7 @@ int sched(int ac, char *av[]) int n_instances = 10; int sched; - verbose = 0; + verbose = NULL; #if _POSIX_VERSION < 199309 try_anyway("The _POSIX_VERSION predates P1003.1B\n"); diff --git a/tools/test/malloc/main.c b/tools/test/malloc/main.c index a3565f5db7..4a018739a7 100644 --- a/tools/test/malloc/main.c +++ b/tools/test/malloc/main.c @@ -1,7 +1,3 @@ -/* - * $DragonFly: src/tools/test/malloc/main.c,v 1.2 2003/11/07 14:38:38 eirikn Exp $ - */ - #include #include #include @@ -29,7 +25,7 @@ main(int argc, char **argv) } for (j = 0 ; j < 40960/i && j < NBUCKETS; j++) { free(foo[j]); - foo[j] = 0; + foo[j] = NULL; } } @@ -44,7 +40,7 @@ main(int argc, char **argv) for (j = 0 ; j < NBUCKETS ; j++) { if (foo[j]) { free(foo[j]); - foo[j] = 0; + foo[j] = NULL; } } printf("BRK(2)=%x NOPS=%lu NBUCKETS=%lu NSIZE=%lu\n", diff --git a/tools/tools/net80211/stumbler/stumbler.c b/tools/tools/net80211/stumbler/stumbler.c index 34e7469d95..0d4a9b2e4e 100644 --- a/tools/tools/net80211/stumbler/stumbler.c +++ b/tools/tools/net80211/stumbler/stumbler.c @@ -91,7 +91,7 @@ struct node_info { struct node_info* prev; struct node_info* next; -} *nodes = 0; +} *nodes = NULL; void clean_crap() { struct node_info* next; @@ -118,7 +118,7 @@ char* mac2str(unsigned char* mac) { } char* wep2str(int w) { - char* wep = 0; + char* wep = NULL; static char res[14]; switch (w) { @@ -394,9 +394,9 @@ void display_node(struct node_info* node) { int y = 0; int i; char chan[3]; - char* ssid = 0; + char* ssid = NULL; int sig, max, left, noise; - char* wep = 0; + char* wep = NULL; y = node->pos; if (y == -1) // offscreen diff --git a/tools/tools/net80211/w00t/assoc/assoc.c b/tools/tools/net80211/w00t/assoc/assoc.c index aef5552d94..9f8e835403 100644 --- a/tools/tools/net80211/w00t/assoc/assoc.c +++ b/tools/tools/net80211/w00t/assoc/assoc.c @@ -706,7 +706,7 @@ void read_tap(struct params *p) int main(int argc, char *argv[]) { - char* ssid = 0; + char* ssid = NULL; char mac[] = { 0x00, 0x00, 0xde, 0xfa, 0xce, 0xd }; int ch; struct params p; diff --git a/tools/tools/net80211/w00t/expand/expand.c b/tools/tools/net80211/w00t/expand/expand.c index b89e924311..766d08ff81 100644 --- a/tools/tools/net80211/w00t/expand/expand.c +++ b/tools/tools/net80211/w00t/expand/expand.c @@ -323,7 +323,7 @@ void got_mcast(struct params *p, struct ieee80211_frame *wh, int len) void read_wifi(struct params *p) { - static char *buf = 0; + static char *buf = NULL; static int buflen = 4096; struct ieee80211_frame *wh; int rc; diff --git a/tools/tools/net80211/w00t/libw00t/w00t.c b/tools/tools/net80211/w00t/libw00t/w00t.c index 6fd47e5519..2b3da4fa94 100644 --- a/tools/tools/net80211/w00t/libw00t/w00t.c +++ b/tools/tools/net80211/w00t/libw00t/w00t.c @@ -228,7 +228,7 @@ void *get_wifi(void *buf, int *len) int send_ack(int fd, char *mac) { static char buf[2+2+6]; - static char *p = 0; + static char *p = NULL; int rc; if (!p) { diff --git a/tools/tools/net80211/w00t/redir/redir.c b/tools/tools/net80211/w00t/redir/redir.c index 400fcc700b..bde2d9e4a5 100644 --- a/tools/tools/net80211/w00t/redir/redir.c +++ b/tools/tools/net80211/w00t/redir/redir.c @@ -383,7 +383,7 @@ void got_ack(struct params *p) void read_wifi(struct params *p) { - static char *buf = 0; + static char *buf = NULL; static int buflen = 4096; struct ieee80211_frame *wh; int rc; @@ -544,7 +544,7 @@ void read_buddy_data(struct params *p) while (last) { if (!last->next) { last->next = q; - q->next = 0; + q->next = NULL; break; } last = last->next; diff --git a/tools/tools/net80211/wesside/dics/dics.c b/tools/tools/net80211/wesside/dics/dics.c index d5b8fedad3..f03d993a9b 100644 --- a/tools/tools/net80211/wesside/dics/dics.c +++ b/tools/tools/net80211/wesside/dics/dics.c @@ -317,7 +317,7 @@ int main(int argc, char *argv[]) { struct sockaddr_in s_in; struct timeval tv; fd_set rfds; - unsigned char* sip = 0; + unsigned char* sip = NULL; if (argc < 2) { printf("Usage: %s [pps]\n", argv[0]); diff --git a/tools/tools/net80211/wesside/wesside/wesside.c b/tools/tools/net80211/wesside/wesside/wesside.c index 2e3ef66cbd..f6b38aca59 100644 --- a/tools/tools/net80211/wesside/wesside/wesside.c +++ b/tools/tools/net80211/wesside/wesside/wesside.c @@ -117,15 +117,15 @@ struct wep_log { #define LINKTYPE_IEEE802_11 105 #define TCPDUMP_MAGIC 0xA1B2C3D4 -unsigned char* floodip = 0; +unsigned char* floodip = NULL; unsigned short floodport = 6969; unsigned short floodsport = 53; -unsigned char* netip = 0; +unsigned char* netip = NULL; int netip_arg = 0; int max_chan = 11; -unsigned char* rtrmac = 0; +unsigned char* rtrmac = NULL; unsigned char mymac[] = "\x00\x00\xde\xfa\xce\x0d"; unsigned char myip[16] = "192.168.0.123"; @@ -135,7 +135,7 @@ int ttl_val = 0; PTW_attackstate *ptw; -unsigned char *victim_mac = 0; +unsigned char *victim_mac = NULL; int ack_timeout = 100*1000; @@ -520,7 +520,7 @@ void inject(int fd, void *buf, int len) } void send_frame(int tx, unsigned char* buf, int len) { - static unsigned char* lame = 0; + static unsigned char* lame = NULL; static int lamelen = 0; static int lastlen = 0; @@ -1487,7 +1487,7 @@ void got_wep(struct ieee80211_frame* wh, int rd) { // printf("I fink AP relayed it...\n"); set_prga(body, &body[4], fragstate.data, dlen); free(fragstate.data); - fragstate.data = 0; + fragstate.data = NULL; fragstate.waiting_relay = 0; } @@ -2741,7 +2741,7 @@ int main(int argc, char *argv[]) { } chaninfo.s = -1; - victim.ssid = 0; + victim.ssid = NULL; prgainfo.len = 0; memset(&txstate, 0, sizeof(txstate)); diff --git a/tools/tools/net80211/wlanwatch/wlanwatch.c b/tools/tools/net80211/wlanwatch/wlanwatch.c index fc394ac45f..1aba01da11 100644 --- a/tools/tools/net80211/wlanwatch/wlanwatch.c +++ b/tools/tools/net80211/wlanwatch/wlanwatch.c @@ -156,10 +156,10 @@ routename(struct sockaddr *sa) { struct in_addr in; in = ((struct sockaddr_in *)sa)->sin_addr; - cp = 0; + cp = NULL; if (in.s_addr == INADDR_ANY || sa->sa_len < 4) cp = "default"; - if (cp == 0 && !nflag) { + if (cp == NULL && !nflag) { hp = gethostbyaddr((char *)&in, sizeof (struct in_addr), AF_INET); if (hp) { diff --git a/usr.bin/chat/chat.c b/usr.bin/chat/chat.c index d3ce1c987c..35e72ce913 100644 --- a/usr.bin/chat/chat.c +++ b/usr.bin/chat/chat.c @@ -76,7 +76,6 @@ * * * $FreeBSD: src/usr.bin/chat/chat.c,v 1.21 2003/10/31 06:22:03 kientzle Exp $ - * $DragonFly: src/usr.bin/chat/chat.c,v 1.11 2005/01/01 00:13:49 cpressey Exp $ */ #include @@ -1400,7 +1399,7 @@ vfmtmsg(char *buf, int buflen, const char *fmt, va_list args) } } } - str = 0; + str = NULL; base = 0; neg = 0; ++fmt; diff --git a/usr.bin/doscmd/AsyncIO.c b/usr.bin/doscmd/AsyncIO.c index 1f81a2071b..9df8896823 100644 --- a/usr.bin/doscmd/AsyncIO.c +++ b/usr.bin/doscmd/AsyncIO.c @@ -30,7 +30,6 @@ * BSDI AsyncIO.c,v 2.2 1996/04/08 19:32:10 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/AsyncIO.c,v 1.3.2.3 2002/05/21 11:49:47 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/AsyncIO.c,v 1.3 2008/10/16 01:52:32 swildner Exp $ */ #include @@ -103,7 +102,7 @@ printf("%d: Invalid FD\n", fd); setsignal(SIGIO, HandleIO); } - if ((handlers[fd].func = func) != 0) { + if ((handlers[fd].func = func) != NULL) { as->lockcnt = 0; as->arg = arg; as->failure = failure; @@ -116,8 +115,8 @@ printf("%d: Invalid FD\n", fd); } SETASYNC(fd); } else { - as->arg = 0; - as->failure = 0; + as->arg = NULL; + as->failure = NULL; as->lockcnt = 0; CLRASYNC(fd); @@ -153,9 +152,9 @@ printf("Closed file descriptor %d\n", x); f = handlers[x].failure; a = handlers[x].arg; - handlers[x].failure = 0; - handlers[x].func = 0; - handlers[x].arg = 0; + handlers[x].failure = NULL; + handlers[x].func = NULL; + handlers[x].arg = NULL; handlers[x].lockcnt = 0; FD_CLR(x, &fdset); if (f) diff --git a/usr.bin/doscmd/config.c b/usr.bin/doscmd/config.c index 1f0ba5525c..6b81a6e59e 100644 --- a/usr.bin/doscmd/config.c +++ b/usr.bin/doscmd/config.c @@ -30,7 +30,6 @@ * BSDI config.c,v 2.2 1996/04/08 19:32:22 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/config.c,v 1.4.2.1 2002/04/25 11:04:50 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/config.c,v 1.2 2003/06/17 04:29:25 dillon Exp $ */ #include @@ -59,7 +58,7 @@ read_config(FILE *fp) int ac; int bootdrive = -1; - while ((buffer = fgets(_buffer, sizeof(_buffer), fp)) != 0) { + while ((buffer = fgets(_buffer, sizeof(_buffer), fp)) != NULL) { char *comment = strchr(buffer, '#'); char *equal; diff --git a/usr.bin/doscmd/cwd.c b/usr.bin/doscmd/cwd.c index 5e6e198d26..e74338d7b3 100644 --- a/usr.bin/doscmd/cwd.c +++ b/usr.bin/doscmd/cwd.c @@ -30,7 +30,6 @@ * BSDI cwd.c,v 2.2 1996/04/08 19:32:25 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/cwd.c,v 1.6.2.3 2002/04/25 11:04:50 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/cwd.c,v 1.3 2006/08/03 16:40:48 swildner Exp $ */ #include @@ -359,7 +358,7 @@ dos_to_real_path(u_char *dos_path, u_char *real_path, int *drivep) * There are no . or .. entries to worry about either */ - while ((dir = *++dirs) != 0) { + while ((dir = *++dirs) != NULL) { *rp++ = '/'; dos_to_real(dir, rp); while (*rp) @@ -480,7 +479,7 @@ real_to_dos(u_char *real, u_char *dos) } n = n->next; } - if (n == 0) { + if (n == NULL) { ustrcpy(dos, real); return; } @@ -691,7 +690,7 @@ get_entries(u_char *path) if (*p) *p++ = 0; } - *e = 0; + *e = NULL; return (entries); } @@ -706,7 +705,7 @@ get_space(int drive, fsstat_t *fs) struct statfs *buf; int nfs; int i; - struct statfs *me = 0; + struct statfs *me = NULL; if (drive < 0 || drive >= MAX_DRIVE) return (DISK_DRIVE_INVALID); @@ -861,7 +860,7 @@ find_first(u_char *path, int attr, dosdir_t *dir, find_block_t *dta) return (error); expr = new_path; - slash = 0; + slash = NULL; while (*expr != '\0') { if (*expr == '\\' || *expr == '/') slash = expr; @@ -918,7 +917,7 @@ find_next(dosdir_t *dir, find_block_t *dta) debug(D_REDIR, "find_next()\n"); #endif - while ((d = readdir(search->dp)) != 0) { + while ((d = readdir(search->dp)) != NULL) { real_to_dos((u_char *)d->d_name, name); to_dos_fcb(dir->name, name); #if 0 diff --git a/usr.bin/doscmd/doscmd.c b/usr.bin/doscmd/doscmd.c index d5b3dd118d..38fe268ed8 100644 --- a/usr.bin/doscmd/doscmd.c +++ b/usr.bin/doscmd/doscmd.c @@ -30,7 +30,6 @@ * BSDI doscmd.c,v 2.3 1996/04/08 19:32:30 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/doscmd.c,v 1.13.2.6 2002/04/25 11:04:51 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/doscmd.c,v 1.4 2004/01/21 21:48:21 rob Exp $ */ #include @@ -97,7 +96,7 @@ static unsigned ecnt = 0; static char *envs[256]; /* Search path and command name */ -static char *dos_path = 0; +static char *dos_path = NULL; char cmdname[256]; /* referenced from dos.c */ static struct vm86_init_args kargs; @@ -447,7 +446,7 @@ setup_command(int argc, char *argv[], regcontext_t *REGS) put_dosenv("PROMPT=DOS> "); /* terminate environment */ - envs[ecnt] = 0; + envs[ecnt] = NULL; /* XXX ??? */ if (dos_getcwd(drlton('R')) == NULL) @@ -542,7 +541,7 @@ do_args(int argc, char *argv[]) debug_flags |= D_DISK | D_FILE_OPS; break; case 'd': - if ((fp = fopen(optarg, "w")) != 0) { + if ((fp = fopen(optarg, "w")) != NULL) { debugf = fp; setbuf (fp, NULL); } else @@ -564,7 +563,7 @@ do_args(int argc, char *argv[]) break; case 'i': i = 1; - if ((col = strchr(optarg, ':')) != 0) { + if ((col = strchr(optarg, ':')) != NULL) { *col++ = 0; i = strtol(col, 0, 0); } @@ -589,7 +588,7 @@ do_args(int argc, char *argv[]) break; case 'o': i = 1; - if ((col = strchr(optarg, ':')) != 0) { + if ((col = strchr(optarg, ':')) != NULL) { *col++ = 0; i = strtol(col, 0, 0); } @@ -604,7 +603,7 @@ do_args(int argc, char *argv[]) break; case 'p': i = 1; - if ((col = strchr(optarg, ':')) != 0) { + if ((col = strchr(optarg, ':')) != NULL) { *col++ = 0; i = strtol(col, 0, 0); } @@ -847,7 +846,7 @@ typedef struct COQ { struct COQ *next; } COQ; -COQ *coq = 0; +COQ *coq = NULL; void quit(int status) diff --git a/usr.bin/doscmd/int13.c b/usr.bin/doscmd/int13.c index b8a124d907..2e968d79e9 100644 --- a/usr.bin/doscmd/int13.c +++ b/usr.bin/doscmd/int13.c @@ -30,7 +30,6 @@ * BSDI int13.c,v 2.3 1996/04/08 19:32:43 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/int13.c,v 1.4.2.2 2002/04/25 11:04:51 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/int13.c,v 1.2 2003/06/17 04:29:26 dillon Exp $ */ #include @@ -144,7 +143,7 @@ getdisk(int drive) drive += 2; } - if (drive > 25 || diskinfo[drive].path == 0) { + if (drive > 25 || diskinfo[drive].path == NULL) { return(0); } di = &diskinfo[drive]; @@ -194,7 +193,7 @@ init_hdisk(int drive, int cyl, int head, int tracksize, char *file, char *fake_p if (drive < 0) { for (drive = 2; drive < 26; ++drive) { - if (diskinfo[drive].path == 0) + if (diskinfo[drive].path == NULL) break; } } @@ -219,7 +218,7 @@ init_hdisk(int drive, int cyl, int head, int tracksize, char *file, char *fake_p di->sectors = tracksize; di->cylinders = cyl; di->sides = head; - di->sector0 = 0; + di->sector0 = NULL; di->offset = 0; if (fake_ptab) { @@ -367,9 +366,9 @@ init_floppy(int drive, int type, char *file) } if (drive < 0) { - if (diskinfo[0].path == 0) { + if (diskinfo[0].path == NULL) { drive = 0; - } else if (diskinfo[1].path == 0) { + } else if (diskinfo[1].path == NULL) { drive = 1; } else { fprintf(stderr, "Too many floppy drives (only 2 allowed)\n"); @@ -384,7 +383,7 @@ init_floppy(int drive, int type, char *file) if (drive >= nfloppies) nfloppies = drive + 1; - if (diskinfo[drive].path == 0) { + if (diskinfo[drive].path == NULL) { diskinfo[drive] = *di; } @@ -427,7 +426,7 @@ init_floppy(int drive, int type, char *file) } di->fd = -1; di->location = ((table & 0xf0000) << 12) | (table & 0xffff); - di->sector0 = 0; + di->sector0 = NULL; di->offset = 0; ivec[0x1e] = ((ftable & 0xf0000) << 12) | (ftable & 0xffff); @@ -624,7 +623,7 @@ int13(regcontext_t *REGS) cyl = R_CH; } - if ((di = getdisk(drive)) == 0) { + if ((di = getdisk(drive)) == NULL) { debug(D_DISK, "Bad drive: %02x (%d : %d : %d)\n", drive, cyl, side, sector); seterror(INT13_ERR_BAD_COMMAND); @@ -683,7 +682,7 @@ int13(regcontext_t *REGS) cyl = R_CH; } - if ((di = getdisk(drive)) == 0) { + if ((di = getdisk(drive)) == NULL) { debug(D_DISK, "Bad drive: %d (%d : %d : %d)\n", drive, cyl, side, sector); seterror(INT13_ERR_BAD_COMMAND); @@ -740,7 +739,7 @@ int13(regcontext_t *REGS) cyl = R_CH; } - if ((di = getdisk(drive)) == 0) { + if ((di = getdisk(drive)) == NULL) { debug(D_DISK, "Bad drive: %d (%d : %d : %d)\n", drive, cyl, side, sector); seterror(INT13_ERR_BAD_COMMAND); @@ -794,7 +793,7 @@ int13(regcontext_t *REGS) case 0x08: /* Status */ R_AH = 0; - if ((di = getdisk(drive)) == 0) { + if ((di = getdisk(drive)) == NULL) { debug(D_DISK, "Bad drive: %d\n", drive); seterror(INT13_ERR_BAD_COMMAND); break; @@ -826,7 +825,7 @@ int13(regcontext_t *REGS) break; case 0x15: - if ((di = getdisk(drive)) == 0) { + if ((di = getdisk(drive)) == NULL) { R_AH = 0; R_FLAGS |= PSL_C; break; @@ -855,7 +854,7 @@ int13(regcontext_t *REGS) break; case 0x18: /* Determine disk format */ - if ((di = getdisk(drive)) == 0) { + if ((di = getdisk(drive)) == NULL) { R_AH = 0; R_FLAGS |= PSL_C; break; diff --git a/usr.bin/doscmd/int17.c b/usr.bin/doscmd/int17.c index dd43530b56..2abb006cea 100644 --- a/usr.bin/doscmd/int17.c +++ b/usr.bin/doscmd/int17.c @@ -30,7 +30,6 @@ * BSDI int17.c,v 2.2 1996/04/08 19:32:48 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/int17.c,v 1.4.2.3 2002/04/25 11:04:51 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/int17.c,v 1.2 2003/06/17 04:29:26 dillon Exp $ */ #include @@ -113,7 +112,7 @@ lpt_poll(void) pclose(lpt_file[i]); } lpt_fd[i] = -1; - lpt_file[i] = 0; + lpt_file[i] = NULL; } last_count[i] = current_count[i]; @@ -134,7 +133,7 @@ open_printer(int printer) * if printer is direct then open output device. */ if (direct[printer]) { - if ((p = queue[printer]) != 0) { + if ((p = queue[printer]) != NULL) { if ((fd = open(p, O_WRONLY|O_APPEND|O_CREAT, 0666)) < 0) { perror(p); return; @@ -163,7 +162,7 @@ open_printer(int printer) snprintf(command, sizeof(command), "lpr -P %s", printer_name); debug(D_PRINTER, "opening pipe to %s\n", printer_name); - if ((file = popen(command, "w")) == 0) { + if ((file = popen(command, "w")) == NULL) { perror(command); return; } diff --git a/usr.bin/doscmd/intff.c b/usr.bin/doscmd/intff.c index 3a900cb497..3bcbe41d1e 100644 --- a/usr.bin/doscmd/intff.c +++ b/usr.bin/doscmd/intff.c @@ -30,7 +30,6 @@ * BSDI intff.c,v 2.2 1996/04/08 19:32:56 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/intff.c,v 1.7.2.2 2002/04/25 11:04:51 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/intff.c,v 1.2 2003/06/17 04:29:26 dillon Exp $ */ #include @@ -41,8 +40,8 @@ #include "cwd.h" #include "dispatch.h" -static LOL *lol = 0; /* DOS list-of-lists */ -static SDA *sda = 0; /* DOS swappable data area */ +static LOL *lol = NULL; /* DOS list-of-lists */ +static SDA *sda = NULL; /* DOS swappable data area */ /****************************************************************************** ** redirector functions @@ -785,7 +784,7 @@ init_drives(void) /* for all possible drives */ for (drive = 0; drive < 26; ++drive) { - if ((path = dos_getpath(drive)) != 0) /* assigned to a path? */ + if ((path = dos_getpath(drive)) != NULL) /* assigned to a path? */ install_drive(drive, path); /* make it visible to DOS */ } } diff --git a/usr.bin/doscmd/mouse.c b/usr.bin/doscmd/mouse.c index 41fa93f8f8..1065d2c196 100644 --- a/usr.bin/doscmd/mouse.c +++ b/usr.bin/doscmd/mouse.c @@ -30,14 +30,13 @@ * BSDI int33.c,v 2.2 1996/04/08 19:32:54 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/mouse.c,v 1.3.2.1 2002/04/25 11:04:51 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/mouse.c,v 1.2 2003/06/17 04:29:26 dillon Exp $ */ #include "doscmd.h" #include "mouse.h" mouse_t mouse_status; -u_char *mouse_area = 0; +u_char *mouse_area = NULL; int nmice = 1; static void diff --git a/usr.bin/doscmd/port.c b/usr.bin/doscmd/port.c index 579de4a684..f1a3b7068d 100644 --- a/usr.bin/doscmd/port.c +++ b/usr.bin/doscmd/port.c @@ -30,7 +30,6 @@ * BSDI port.c,v 2.2 1996/04/08 19:33:03 bostic Exp * * $FreeBSD: src/usr.bin/doscmd/port.c,v 1.5.2.1 2002/04/25 11:04:51 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/port.c,v 1.6 2005/04/10 20:55:38 drhodus Exp $ */ #include @@ -54,7 +53,7 @@ #define out(port, data) \ asm volatile ("outb %%al,%%dx" : : "a" (data), "d" (port)) -FILE *iolog = 0; +FILE *iolog = NULL; u_long ioports[MAXPORT/32]; #ifdef __DragonFly__ static void @@ -211,9 +210,9 @@ init_io_port_handlers(void) int i; for (i = 0; i < MAXPORT; i++) { - if (portsw[i].p_inb == 0) + if (portsw[i].p_inb == NULL) portsw[i].p_inb = inb_nullport; - if (portsw[i].p_outb == 0) + if (portsw[i].p_outb == NULL) portsw[i].p_outb = outb_nullport; } diff --git a/usr.bin/doscmd/tty.c b/usr.bin/doscmd/tty.c index 09860d85b1..89a8902956 100644 --- a/usr.bin/doscmd/tty.c +++ b/usr.bin/doscmd/tty.c @@ -30,7 +30,6 @@ * BSDI tty.c,v 2.4 1996/04/08 22:03:27 prb Exp * * $FreeBSD: src/usr.bin/doscmd/tty.c,v 1.8.2.2 2002/04/25 11:04:51 tg Exp $ - * $DragonFly: src/usr.bin/doscmd/tty.c,v 1.6 2004/01/26 18:16:18 drhodus Exp $ */ #include @@ -77,13 +76,13 @@ static u_short scan_code = 0x00; int height; int width; int vattr; -const char *xfont = 0; +const char *xfont = NULL; #ifndef NO_X Display *dpy; Window win; XFontStruct *font; -XImage *xi = 0; +XImage *xi = NULL; Visual *visual; unsigned int depth; unsigned long black; @@ -660,7 +659,7 @@ debug_event(int fd __unused, int cond, void *arg __unused, regcontext_t *REGS) icnt += r; ibuf[icnt] = 0; - while ((ep = strchr(ibuf, '\n')) != 0) { + while ((ep = strchr(ibuf, '\n')) != NULL) { int ac; char *_av[16]; char **av; @@ -672,7 +671,7 @@ debug_event(int fd __unused, int cond, void *arg __unused, regcontext_t *REGS) if (!strcasecmp(av[0], "dump")) { if (ac > 1) { char *c; - if ((c = strchr(av[1], ':')) != 0) { + if ((c = strchr(av[1], ':')) != NULL) { ds = strtol(av[1], 0, 16); di = strtol(c+1, 0, 16); } else @@ -708,7 +707,7 @@ debug_event(int fd __unused, int cond, void *arg __unused, regcontext_t *REGS) if (ac > 1) { char *c; - if ((c = strchr(av[1], ':')) != 0) { + if ((c = strchr(av[1], ':')) != NULL) { ds = strtol(av[1], 0, 16); di = strtol(c+1, 0, 16); } else @@ -729,7 +728,7 @@ debug_event(int fd __unused, int cond, void *arg __unused, regcontext_t *REGS) } else if (!strcasecmp(av[0], "force")) { char *p = av[1]; - while ((p = *++av) != 0) { + while ((p = *++av) != NULL) { while (*p) { if (*p >= ' ' && *p <= '~') KbdWrite(ScanCodes[Ascii2Scan[(int)*p] & 0xff].base); diff --git a/usr.bin/ee/new_curse.c b/usr.bin/ee/new_curse.c index 651ef1c947..1d4fce5915 100644 --- a/usr.bin/ee/new_curse.c +++ b/usr.bin/ee/new_curse.c @@ -38,7 +38,6 @@ | All are rights reserved. | | $FreeBSD: src/usr.bin/ee/new_curse.c,v 1.4.2.1 2001/06/10 11:06:06 sobomax Exp $ - | $DragonFly: src/usr.bin/ee/new_curse.c,v 1.4 2005/10/30 23:00:57 swildner Exp $ | */ @@ -2784,7 +2783,7 @@ delwin(WINDOW *window) /* delete the window structure */ free(window->first_line->prev_screen); } if (window == last_window_refreshed) - last_window_refreshed = 0; + last_window_refreshed = NULL; if (window->first_line != NULL) { free(window->first_line->row); diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c index 0a9b9a4f9d..eee5a44181 100644 --- a/usr.bin/find/find.c +++ b/usr.bin/find/find.c @@ -35,7 +35,6 @@ * * @(#)find.c 8.5 (Berkeley) 8/5/94 * $FreeBSD: src/usr.bin/find/find.c,v 1.17 2004/05/28 17:17:15 eik Exp $ - * $DragonFly: src/usr.bin/find/find.c,v 1.6 2005/02/14 20:31:59 cpressey Exp $ */ #include @@ -110,7 +109,7 @@ find_formplan(char *argv[]) */ if (!isoutput) { OPTION *p; - char **argv1 = 0; + char **argv1 = NULL; if (plan == NULL) { p = lookup_option("-print"); diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index f5bbaa5d12..b08a0a562d 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -35,7 +35,6 @@ * * @(#)function.c 8.10 (Berkeley) 5/4/95 * $FreeBSD: src/usr.bin/find/function.c,v 1.52 2004/07/29 03:33:55 tjr Exp $ - * $DragonFly: src/usr.bin/find/function.c,v 1.7 2005/03/13 22:22:42 y0netan1 Exp $ */ #include @@ -221,7 +220,7 @@ nextarg(OPTION *option, char ***argvp) { char *arg; - if ((arg = **argvp) == 0) + if ((arg = **argvp) == NULL) errx(1, "%s: requires additional arguments", option->name); (*argvp)++; return arg; diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c index 17ff1886ea..d303b2c074 100644 --- a/usr.bin/finger/net.c +++ b/usr.bin/finger/net.c @@ -35,7 +35,6 @@ * * @(#)net.c 8.4 (Berkeley) 4/28/95 * $FreeBSD: src/usr.bin/finger/net.c,v 1.12.2.4 2002/12/16 08:41:28 roam Exp $ - * $DragonFly: src/usr.bin/finger/net.c,v 1.5 2004/09/03 19:13:23 dillon Exp $ */ #include @@ -66,7 +65,7 @@ netfinger(char *name) static struct addrinfo hint; host = strrchr(name, '@'); - if (host == 0) + if (host == NULL) return; *host++ = '\0'; signal(SIGALRM, cleanup); @@ -90,7 +89,7 @@ netfinger(char *name) else printf("[%s]\n", ai0->ai_canonname); - for (ai = ai0; ai != 0; ai = ai->ai_next) { + for (ai = ai0; ai != NULL; ai = ai->ai_next) { if (multi) trying(ai); diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c index 0fcfd8994b..1ff93bf45e 100644 --- a/usr.bin/fmt/fmt.c +++ b/usr.bin/fmt/fmt.c @@ -123,7 +123,6 @@ * been tested on my FreeBSD machine. Your mileage may vary. * * $FreeBSD: src/usr.bin/fmt/fmt.c,v 1.12.2.2 2002/01/14 09:48:26 ru Exp $ - * $DragonFly: src/usr.bin/fmt/fmt.c,v 1.2 2003/06/17 04:29:26 dillon Exp $ */ /* Copyright (c) 1997 Gareth McCaughan. All rights reserved. @@ -223,7 +222,7 @@ static int grok_mail_headers=0; /* treat embedded mail headers magically? */ static int format_troff=0; /* Format troff? */ static int n_errors=0; /* Number of failed files. Return on exit. */ -static char *output_buffer=0; /* Output line will be built here */ +static char *output_buffer=NULL; /* Output line will be built here */ static size_t x; /* Horizontal position in output line */ static size_t x0; /* Ditto, ignoring leading whitespace */ static size_t pending_spaces; /* Spaces to add before next word */ @@ -574,7 +573,7 @@ static void center_stream(FILE *stream, const char *name) { char *line; size_t length; - while ((line=get_line(stream, &length)) != 0) { + while ((line=get_line(stream, &length)) != NULL) { size_t l=length; while (l>0 && isspace(*line)) { ++line; --l; } length=l; diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index f31303a622..6b28fe80eb 100644 --- a/usr.bin/gzip/gzip.c +++ b/usr.bin/gzip/gzip.c @@ -1,5 +1,4 @@ /* $NetBSD: gzip.c,v 1.94 2009/04/12 10:31:14 lukem Exp $ */ -/* $DragonFly: src/usr.bin/gzip/gzip.c,v 1.7 2007/12/06 19:54:52 hasso Exp $ */ /* * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green @@ -1812,7 +1811,7 @@ handle_dir(char *dir) FTSENT *entry; path_argv[0] = dir; - path_argv[1] = 0; + path_argv[1] = NULL; fts = fts_open(path_argv, FTS_PHYSICAL | FTS_NOCHDIR, NULL); if (fts == NULL) { warn("couldn't fts_open %s", dir); diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c index c7b970acd8..a6a3205b8c 100644 --- a/usr.bin/indent/lexi.c +++ b/usr.bin/indent/lexi.c @@ -259,7 +259,7 @@ lexi(void) /* * This loop will check if the token is a keyword. */ - for (p = specials; (j = p->rwd) != 0; p++) { + for (p = specials; (j = p->rwd) != NULL; p++) { const char *q = s_token; /* point at scanned token */ if (*j++ != *q++ || *j++ != *q++) continue; /* This test depends on the fact that @@ -598,6 +598,6 @@ addkey(char *key, int val) * ignored */ p->rwd = key; p->rwcode = val; - p[1].rwd = 0; + p[1].rwd = NULL; p[1].rwcode = 0; } diff --git a/usr.bin/indent/pr_comment.c b/usr.bin/indent/pr_comment.c index 69fd2ca68c..fc5ffb3610 100644 --- a/usr.bin/indent/pr_comment.c +++ b/usr.bin/indent/pr_comment.c @@ -94,7 +94,7 @@ pr_comment(void) int one_liner = 1; /* true iff this comment is a one-liner */ adj_max_col = max_col; ps.just_saw_decl = 0; - last_bl = 0; /* no blanks found so far */ + last_bl = NULL; /* no blanks found so far */ ps.box_com = false; /* at first, assume that we are not in * a boxed comment or some other * comment that should not be touched */ @@ -190,7 +190,7 @@ pr_comment(void) ps.use_ff = true; /* fix so dump_line uses a form feed */ dump_line(); - last_bl = 0; + last_bl = NULL; *e_com++ = ' '; *e_com++ = '*'; *e_com++ = ' '; @@ -386,7 +386,7 @@ pr_comment(void) e_com = t; s_com[0] = s_com[1] = s_com[2] = ' '; } - if (last_bl == 0) { /* we have seen no blanks */ + if (last_bl == NULL) { /* we have seen no blanks */ last_bl = e_com; /* fake it */ *e_com++ = ' '; } @@ -402,7 +402,7 @@ pr_comment(void) *e_com++ = ' '; t_ptr = last_bl + 1; - last_bl = 0; + last_bl = NULL; if (t_ptr >= e_com) { while (*t_ptr == ' ' || *t_ptr == '\t') t_ptr++; diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c index f308b73c07..fe171a556d 100644 --- a/usr.bin/killall/killall.c +++ b/usr.bin/killall/killall.c @@ -25,7 +25,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/killall/killall.c,v 1.5.2.4 2001/05/19 19:22:49 phk Exp $ - * $DragonFly: src/usr.bin/killall/killall.c,v 1.9 2007/02/01 10:33:26 corecode Exp $ */ #include @@ -286,7 +285,7 @@ main(int ac, char **av) do { size += size / 10; newprocs = realloc(procs, size); - if (newprocs == 0) { + if (newprocs == NULL) { if (procs) free(procs); errx(1, "could not reallocate memory"); diff --git a/usr.bin/lex/initscan.c b/usr.bin/lex/initscan.c index 75f5bb01ea..e8221cb4b8 100644 --- a/usr.bin/lex/initscan.c +++ b/usr.bin/lex/initscan.c @@ -188,7 +188,7 @@ struct yy_buffer_state #define YY_BUFFER_EOF_PENDING 2 }; -static YY_BUFFER_STATE yy_current_buffer = 0; +static YY_BUFFER_STATE yy_current_buffer = NULL; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -1355,7 +1355,7 @@ static int input YY_PROTO(( void )); #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; +static int *yy_start_stack = NULL; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif @@ -2947,7 +2947,7 @@ static int yy_get_next_buffer() } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -3380,7 +3380,7 @@ yy_size_t size; b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; diff --git a/usr.bin/lex/main.c b/usr.bin/lex/main.c index 18933c596a..fcb30ec7d2 100644 --- a/usr.bin/lex/main.c +++ b/usr.bin/lex/main.c @@ -31,7 +31,6 @@ /* $Header: /home/daffy/u0/vern/flex/RCS/main.c,v 2.64 96/05/25 20:42:42 vern Exp $ */ /* $FreeBSD: src/usr.bin/lex/main.c,v 1.7 1999/10/27 07:56:45 obrien Exp $ */ -/* $DragonFly: src/usr.bin/lex/main.c,v 1.4 2005/02/20 17:34:11 asmodai Exp $ */ #include "flexdef.h" @@ -579,7 +578,7 @@ void flexinit(int argc, char **argv) performance_report = 0; did_outfilename = 0; prefix = "yy"; - yyclass = 0; + yyclass = NULL; use_read = use_stdout = false; sawcmpflag = false; diff --git a/usr.bin/lex/misc.c b/usr.bin/lex/misc.c index 91de1e5110..a24be29f58 100644 --- a/usr.bin/lex/misc.c +++ b/usr.bin/lex/misc.c @@ -732,7 +732,7 @@ void skelout(void) */ while ( skelfile ? (fgets( buf, MAXLINE, skelfile ) != NULL) : - ((buf = (char *) skel[skel_ind++]) != 0) ) + ((buf = (char *) skel[skel_ind++]) != NULL) ) { /* copy from skel array */ if ( buf[0] == '%' ) { /* control line */ diff --git a/usr.bin/lex/sym.c b/usr.bin/lex/sym.c index 7b1996de48..ee881c5da9 100644 --- a/usr.bin/lex/sym.c +++ b/usr.bin/lex/sym.c @@ -28,7 +28,6 @@ /* $Header: /home/daffy/u0/vern/flex/RCS/sym.c,v 2.19 95/03/04 16:11:04 vern Exp $ */ /* $FreeBSD: src/usr.bin/lex/sym.c,v 1.5 1999/10/27 07:56:47 obrien Exp $ */ -/* $DragonFly: src/usr.bin/lex/sym.c,v 1.4 2005/08/04 17:31:22 drhodus Exp $ */ #include "flexdef.h" @@ -75,7 +74,7 @@ int addsym(char *sym, char *str_def, int int_def, hash_table table, if ( new_entry == NULL ) flexfatal( _( "symbol table memory allocation failed" ) ); - if ( (successor = table[hash_val]) != 0 ) + if ( (successor = table[hash_val]) != NULL ) { new_entry->next = successor; successor->prev = new_entry; diff --git a/usr.bin/login/login_fbtab.c b/usr.bin/login/login_fbtab.c index 04aa4e05d4..87c3102eef 100644 --- a/usr.bin/login/login_fbtab.c +++ b/usr.bin/login/login_fbtab.c @@ -14,7 +14,6 @@ * merchantibility and fitness for any particular purpose. ************************************************************************/ /* $FreeBSD: src/usr.bin/login/login_fbtab.c,v 1.18 2007/09/21 01:55:11 kevlo Exp $ */ -/* $DragonFly: src/usr.bin/login/login_fbtab.c,v 1.3 2003/10/04 20:36:48 hmp Exp $ */ /* SYNOPSIS void login_fbtab(tty, uid, gid) @@ -96,15 +95,15 @@ login_fbtab(char *tty, uid_t uid, gid_t gid) while (fgets(buf, sizeof(buf), fp)) { if ((cp = strchr(buf, '#'))) *cp = 0; /* strip comment */ - if ((cp = devname = strtok(buf, WSPACE)) == 0) + if ((cp = devname = strtok(buf, WSPACE)) == NULL) continue; /* empty or comment */ if (strncmp(devname, _PATH_DEV, sizeof _PATH_DEV - 1) != 0 - || (cp = strtok(NULL, WSPACE)) == 0 + || (cp = strtok(NULL, WSPACE)) == NULL || *cp != '0' || sscanf(cp, "%o", &prot) == 0 || prot == 0 || (prot & 0777) != prot - || (cp = strtok(NULL, WSPACE)) == 0) { + || (cp = strtok(NULL, WSPACE)) == NULL) { syslog(LOG_ERR, "%s: bad entry: %s", table, cp ? cp : "(null)"); continue; } diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c index 7977a2a468..b337151b5e 100644 --- a/usr.bin/m4/gnum4.c +++ b/usr.bin/m4/gnum4.c @@ -25,7 +25,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/m4/gnum4.c,v 1.9 2004/05/18 15:53:58 stefanf Exp $ - * $DragonFly: src/usr.bin/m4/gnum4.c,v 1.3 2006/12/27 21:29:02 pavalos Exp $ */ /* @@ -80,7 +79,7 @@ new_path_entry(const char *dirname) n->name = strdup(dirname); if (!n->name) errx(1, "out of memory"); - n->next = 0; + n->next = NULL; return n; } @@ -133,7 +132,7 @@ dopath(struct input_file *i, const char *filename) for (pe = first; pe; pe = pe->next) { snprintf(path, sizeof(path), "%s/%s", pe->name, filename); - if ((f = fopen(path, "r")) != 0) { + if ((f = fopen(path, "r")) != NULL) { set_input(i, f, path); return i; } diff --git a/usr.bin/mail/cmd2.c b/usr.bin/mail/cmd2.c index e0ba5e075e..943dced230 100644 --- a/usr.bin/mail/cmd2.c +++ b/usr.bin/mail/cmd2.c @@ -32,7 +32,6 @@ * * @(#)cmd2.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/mail/cmd2.c,v 1.5.6.3 2003/01/06 05:46:03 mikeh Exp $ - * $DragonFly: src/usr.bin/mail/cmd2.c,v 1.4 2004/09/08 03:01:11 joerg Exp $ */ #include "rcv.h" @@ -377,7 +376,7 @@ clobber(char **argv) { int times; - if (argv[0] == 0) + if (argv[0] == NULL) times = 1; else times = (atoi(argv[0]) + 511) / 512; @@ -443,7 +442,7 @@ ignore1(char **list, struct ignoretab *tab, const char *which) if (*list == NULL) return (igshow(tab, which)); - for (ap = list; *ap != 0; ap++) { + for (ap = list; *ap != NULL; ap++) { istrncpy(field, *ap, sizeof(field)); if (member(field, tab)) continue; @@ -478,9 +477,9 @@ igshow(struct ignoretab *tab, const char *which) for (h = 0; h < HSHSIZE; h++) for (igp = tab->i_head[h]; igp != NULL; igp = igp->i_link) *ap++ = igp->i_field; - *ap = 0; + *ap = NULL; qsort(ring, tab->i_count, sizeof(char *), igcomp); - for (ap = ring; *ap != 0; ap++) + for (ap = ring; *ap != NULL; ap++) printf("%s\n", *ap); return (0); } diff --git a/usr.bin/mail/cmd3.c b/usr.bin/mail/cmd3.c index d64191a2b5..f32b29109b 100644 --- a/usr.bin/mail/cmd3.c +++ b/usr.bin/mail/cmd3.c @@ -32,7 +32,6 @@ * * @(#)cmd3.c 8.2 (Berkeley) 4/20/95 * $FreeBSD: src/usr.bin/mail/cmd3.c,v 1.4.6.4 2003/01/06 05:46:03 mikeh Exp $ - * $DragonFly: src/usr.bin/mail/cmd3.c,v 1.4 2004/09/08 03:01:11 joerg Exp $ */ #include "rcv.h" @@ -705,6 +704,6 @@ alternates(char **namelist) strcpy(cp, *ap); *ap2 = cp; } - *ap2 = 0; + *ap2 = NULL; return (0); } diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c index 3b667aed83..56e5a70b40 100644 --- a/usr.bin/mail/lex.c +++ b/usr.bin/mail/lex.c @@ -32,7 +32,6 @@ * * @(#)lex.c 8.2 (Berkeley) 4/20/95 * $FreeBSD: src/usr.bin/mail/lex.c,v 1.5.6.5 2003/01/06 05:46:03 mikeh Exp $ - * $DragonFly: src/usr.bin/mail/lex.c,v 1.6 2004/09/08 03:01:11 joerg Exp $ */ #include "rcv.h" @@ -364,7 +363,7 @@ execute(char *linebuf, int contxt) * A message list defaulting to nearest forward * legal message. */ - if (msgvec == 0) { + if (msgvec == NULL) { printf("Illegal use of \"message list\"\n"); break; } @@ -386,7 +385,7 @@ execute(char *linebuf, int contxt) * A message list with no defaults, but no error * if none exist. */ - if (msgvec == 0) { + if (msgvec == NULL) { printf("Illegal use of \"message list\"\n"); break; } diff --git a/usr.bin/mail/send.c b/usr.bin/mail/send.c index de24885957..9e2b47d4e4 100644 --- a/usr.bin/mail/send.c +++ b/usr.bin/mail/send.c @@ -32,7 +32,6 @@ * * @(#)send.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/mail/send.c,v 1.5.6.5 2003/01/06 05:46:03 mikeh Exp $ - * $DragonFly: src/usr.bin/mail/send.c,v 1.5 2004/09/08 03:01:11 joerg Exp $ */ #include "rcv.h" @@ -65,7 +64,7 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign, * Compute the prefix string, without trailing whitespace */ if (prefix != NULL) { - cp2 = 0; + cp2 = NULL; for (cp = prefix; *cp != '\0'; cp++) if (*cp != ' ' && *cp != '\t') cp2 = cp; @@ -74,7 +73,7 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign, ibuf = setinput(mp); count = mp->m_size; ishead = 1; - dostat = doign == 0 || !isign("status", doign); + dostat = doign == NULL || !isign("status", doign); infld = 0; firstline = 1; /* diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index ec69701f36..9eb512b374 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -38,7 +38,6 @@ * * @(#)job.c 8.2 (Berkeley) 3/19/94 * $FreeBSD: src/usr.bin/make/job.c,v 1.75 2005/02/10 14:32:14 harti Exp $ - * $DragonFly: src/usr.bin/make/job.c,v 1.148 2008/03/05 10:37:24 corecode Exp $ */ #ifndef OLD_JOKE @@ -2912,7 +2911,7 @@ Compat_RunCommand(GNode *gn, const char cmd[], GNode *ENDNode) brk_string(&aa, line, true); av = aa.argv + 1; - for (p = sh_builtin; *p != 0; p++) { + for (p = sh_builtin; *p != NULL; p++) { if (strcmp(av[0], *p) == 0) { /* * This command must be passed by the shell diff --git a/usr.bin/mkstr/mkstr.c b/usr.bin/mkstr/mkstr.c index 13934407c2..8169546e32 100644 --- a/usr.bin/mkstr/mkstr.c +++ b/usr.bin/mkstr/mkstr.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved. * @(#)mkstr.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/mkstr/mkstr.c,v 1.4.2.1 2002/11/16 01:07:42 tjr Exp $ - * $DragonFly: src/usr.bin/mkstr/mkstr.c,v 1.3 2008/06/05 18:06:33 swildner Exp $ */ #include @@ -284,7 +283,7 @@ hashit(char *str, int really, unsigned fakept) if (i < 0) i += NBUCKETS; if (really != 0) - for (hp = bucket[i]; hp != 0; hp = hp->hnext) + for (hp = bucket[i]; hp != NULL; hp = hp->hnext) if (hp->hval == hashval) { fseek(mesgread, (long) hp->hpt, 0); fgetNUL(buf, sizeof buf, mesgread); @@ -294,7 +293,7 @@ hashit(char *str, int really, unsigned fakept) if (strcmp(buf, str) == 0) break; } - if (!really || hp == 0) { + if (!really || hp == NULL) { hp = (struct hash *) calloc(1, sizeof *hp); if (hp == NULL) err(1, NULL); diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index 533f9436b8..d49fcea3e1 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -417,7 +417,7 @@ intpr(int interval1, u_long ifnetaddr, void (*pfunc)(char *)) if (msa.sa.sa_family != sa->sa_family) continue; - fmt = 0; + fmt = NULL; switch (msa.sa.sa_family) { case AF_INET: fmt = routename(msa.in.sin_addr.s_addr); diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 1f7fc36117..bab95c9075 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -32,7 +32,6 @@ * * @(#)inet.c 8.5 (Berkeley) 5/24/95 * $FreeBSD: src/usr.bin/netstat/inet.c,v 1.37.2.11 2003/11/27 14:46:49 ru Exp $ - * $DragonFly: src/usr.bin/netstat/inet.c,v 1.21 2007/12/29 22:15:06 hasso Exp $ */ #include @@ -140,7 +139,7 @@ protopr(u_long proto, const char *name, int af1 __unused) } if (len == 0) return; - if ((buf = malloc(len)) == 0) { + if ((buf = malloc(len)) == NULL) { warn("malloc %lu bytes", (u_long)len); return; } @@ -883,7 +882,7 @@ pim_stats(u_long off __unused, const char *name, int af1 __unused) void inetprint(struct in_addr *in, int port, const char *proto, int num_port) { - struct servent *sp = 0; + struct servent *sp = NULL; char line[80], *cp; int width; @@ -918,7 +917,7 @@ inetname(struct in_addr *inp) struct hostent *hp; struct netent *np; - cp = 0; + cp = NULL; if (!numeric_addr && inp->s_addr != INADDR_ANY) { int net = inet_netof(*inp); int lna = inet_lnaof(*inp); @@ -928,7 +927,7 @@ inetname(struct in_addr *inp) if (np) cp = np->n_name; } - if (cp == 0) { + if (cp == NULL) { hp = gethostbyaddr(inp, sizeof (*inp), AF_INET); if (hp) { cp = hp->h_name; diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c index d8694353f2..7326234da1 100644 --- a/usr.bin/netstat/inet6.c +++ b/usr.bin/netstat/inet6.c @@ -32,7 +32,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/netstat/inet6.c,v 1.3.2.11 2001/09/17 14:53:17 ru Exp $ - * $DragonFly: src/usr.bin/netstat/inet6.c,v 1.7 2006/05/21 03:43:47 dillon Exp $ * * @(#)inet6.c 8.4 (Berkeley) 4/20/94 */ @@ -1041,7 +1040,7 @@ rip6_stats(u_long off __unused, const char *name, int af1 __unused) void inet6print(struct in6_addr *in6, int port, char *proto, int numeric) { - struct servent *sp = 0; + struct servent *sp = NULL; char line[80], *cp; int width; @@ -1081,7 +1080,7 @@ inet6name(struct in6_addr *in6p) else domain[0] = 0; } - cp = 0; + cp = NULL; if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) { hp = gethostbyaddr(in6p, sizeof(*in6p), AF_INET6); if (hp) { diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c index 9f14031383..f50f44a552 100644 --- a/usr.bin/netstat/ipx.c +++ b/usr.bin/netstat/ipx.c @@ -33,7 +33,6 @@ * * @(#)ns.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/netstat/ipx.c,v 1.13.2.1 2001/08/10 09:07:09 ru Exp $ - * $DragonFly: src/usr.bin/netstat/ipx.c,v 1.6 2007/05/17 08:19:02 swildner Exp $ */ #define _KERNEL_STRUCTURES @@ -316,12 +315,12 @@ ipx_erputil(int z, int c) char *name, *where; for(j = 0;; j ++) { - if ((name = ipx_errnames[j].name) == 0) + if ((name = ipx_errnames[j].name) == NULL) break; if (ipx_errnames[j].code == c) break; } - if (name == 0) { + if (name == NULL) { if (c > 01000) where = "in transit"; else diff --git a/usr.bin/netstat/iso.c b/usr.bin/netstat/iso.c index b831f7e60f..a47b6d289e 100644 --- a/usr.bin/netstat/iso.c +++ b/usr.bin/netstat/iso.c @@ -35,7 +35,6 @@ /* * $FreeBSD: src/usr.bin/netstat/iso.c,v 1.4.2.2 2001/09/17 14:53:17 ru Exp $ - * $DragonFly: src/usr.bin/netstat/iso.c,v 1.5 2007/04/22 01:25:04 dillon Exp $ */ /******************************************************************************* Copyright IBM Corporation 1987 @@ -302,7 +301,7 @@ tp_protopr(u_long off, const char *name, int af __unused) kget(off, tpkerninfo); size = tpkerninfo.tpr_size * sizeof (*tpr); tpr_base = (struct tp_ref *)malloc(size); - if (tpr_base == 0) + if (tpr_base == NULL) return; kread((u_long)(tpkerninfo.tpr_base), (char *)tpr_base, size); for (tpr = tpr_base; tpr < tpr_base + tpkerninfo.tpr_size; tpr++) { @@ -361,7 +360,7 @@ char * isonetname(struct iso_addr *iso) { struct sockaddr_iso sa; - struct iso_hostent *ihe = 0; + struct iso_hostent *ihe = NULL; struct iso_hostent *iso_gethostentrybyaddr(); struct iso_hostent *iso_getserventrybytsel(); struct iso_hostent Ihe; diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 7be5789a24..01248f5c95 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -612,7 +612,7 @@ printproto(struct protox *tp, const char *name) int kread(u_long addr, char *buf, int size) { - if (kvmd == 0) { + if (kvmd == NULL) { /* * XXX. */ diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index bf430fe632..fe375120d7 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -163,7 +163,7 @@ routepr(u_long rtree) } kget(rtree, rt_tables); for (i = 0; i <= AF_MAX; i++) { - if ((rnh = rt_tables[i]) == 0) + if ((rnh = rt_tables[i]) == NULL) continue; kget(rnh, head); if (i == AF_UNSPEC) { @@ -467,7 +467,7 @@ p_rtnode(void) printf("\t mask "); p_sockaddr(kgetsa((struct sockaddr *)rnode.rn_mask), NULL, 0, -1); - } else if (rm == 0) + } else if (rm == NULL) return; } else { sprintf(nbuf, "(%d)", rnode.rn_bit); @@ -519,7 +519,7 @@ ntreestuff(void) err(1, "sysctl: net.route.0.0.dump estimate"); } - if ((buf = malloc(needed)) == 0) { + if ((buf = malloc(needed)) == NULL) { err(2, "malloc(%lu)", (unsigned long)needed); } if (sysctl(mib, miblen, buf, &needed, NULL, 0) < 0) { @@ -813,7 +813,7 @@ routename(u_long in) static char line[MAXHOSTNAMELEN]; struct hostent *hp; - cp = 0; + cp = NULL; if (!numeric_addr) { hp = gethostbyaddr(&in, sizeof (struct in_addr), AF_INET); if (hp) { @@ -882,9 +882,9 @@ domask(char *dst, u_long addr, u_long mask) char * netname(u_long in, u_long mask) { - char *cp = 0; + char *cp = NULL; static char line[MAXHOSTNAMELEN]; - struct netent *np = 0; + struct netent *np = NULL; u_long dmask; u_long i; @@ -1047,7 +1047,7 @@ char * ipx_print(struct sockaddr *sa) { u_short port; - struct servent *sp = 0; + struct servent *sp = NULL; const char *net = "", *host = ""; char *p; u_char *q; diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c index 5ab46bed7d..37ba197cac 100644 --- a/usr.bin/netstat/unix.c +++ b/usr.bin/netstat/unix.c @@ -32,7 +32,6 @@ * * @(#)unix.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/netstat/unix.c,v 1.12.2.2 2001/08/10 09:07:09 ru Exp $ - * $DragonFly: src/usr.bin/netstat/unix.c,v 1.4 2005/03/05 13:23:15 hmp Exp $ */ /* @@ -81,7 +80,7 @@ unixpr(void) warn("sysctl: %s", mibvar); continue; } - if ((buf = malloc(len)) == 0) { + if ((buf = malloc(len)) == NULL) { warn("malloc %lu bytes", (u_long)len); return; } diff --git a/usr.bin/newkey/generic.c b/usr.bin/newkey/generic.c index bab8634da3..8d48aee762 100644 --- a/usr.bin/newkey/generic.c +++ b/usr.bin/newkey/generic.c @@ -29,7 +29,6 @@ * * @(#)generic.c 1.2 91/03/11 Copyr 1986 Sun Micro * $FreeBSD: src/usr.bin/newkey/generic.c,v 1.3.2.1 2001/07/04 22:32:20 kris Exp $ - * $DragonFly: src/usr.bin/newkey/generic.c,v 1.8 2008/06/05 18:06:33 swildner Exp $ */ /* @@ -70,7 +69,7 @@ getseed(char *seed, int seedsize, unsigned char *pass) static BIGNUM * itobn(long i) { - BIGNUM *n = 0; + BIGNUM *n = NULL; if ((n = BN_new()) == NULL) errx(1, "could not create BIGNUM: %s", diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c index e58194e511..57a670d116 100644 --- a/usr.bin/nfsstat/nfsstat.c +++ b/usr.bin/nfsstat/nfsstat.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1983, 1989, 1993 The Regents of the University of California. All rights reserved. * @(#)nfsstat.c 8.2 (Berkeley) 3/31/95 * $FreeBSD: src/usr.bin/nfsstat/nfsstat.c,v 1.15.2.3 2001/06/06 20:25:58 tmm Exp $ - * $DragonFly: src/usr.bin/nfsstat/nfsstat.c,v 1.4 2004/07/16 00:55:04 hmp Exp $ */ #include @@ -137,7 +136,7 @@ main(int argc, char **argv) deadkernel = 1; if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, - errbuf)) == 0) { + errbuf)) == NULL) { errx(1, "kvm_openfiles: %s", errbuf); } if (kvm_nlist(kd, nl) != 0) { diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c index a3b4b7f4b9..aea6d652ea 100644 --- a/usr.bin/quota/quota.c +++ b/usr.bin/quota/quota.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1980, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)quota.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/quota/quota.c,v 1.11.2.5 2002/11/30 23:54:21 iedowse Exp $ - * $DragonFly: src/usr.bin/quota/quota.c,v 1.7 2006/04/03 01:59:28 dillon Exp $ */ /* @@ -480,7 +479,7 @@ getprivs(long id, int quotatype) else quptail->next = qup; quptail = qup; - quptail->next = 0; + quptail->next = NULL; qup = NULL; } if (qup) diff --git a/usr.bin/rdist/expand.c b/usr.bin/rdist/expand.c index af375cc3ba..e56890e1d0 100644 --- a/usr.bin/rdist/expand.c +++ b/usr.bin/rdist/expand.c @@ -32,7 +32,6 @@ * * @(#)expand.c 8.1 (Berkeley) 6/9/93 * $FreeBSD: src/usr.bin/rdist/expand.c,v 1.8 1999/08/28 01:05:06 peter Exp $ - * $DragonFly: src/usr.bin/rdist/expand.c,v 1.6 2008/10/16 01:52:33 swildner Exp $ */ #include "defs.h" @@ -109,7 +108,7 @@ expand(struct namelist *list, int wh) tilde = ""; eargc = 0; eargv = sortbase = argvbuf; - *eargv = 0; + *eargv = NULL; nleft = NCARGS - 4; /* * Walk the name list and expand names into eargv[]; @@ -386,7 +385,7 @@ doit: strcpy(lm, pl); strcat(restbuf, pe + 1); *pm = savec; - if (s == 0) { + if (s == NULL) { spathp = pathp; expsh(restbuf); pathp = spathp; @@ -580,7 +579,7 @@ Cat(char *s1, char *s2) nleft -= len; if (nleft <= 0 || ++eargc >= GAVSIZ) yyerror("Arguments too long"); - eargv[eargc] = 0; + eargv[eargc] = NULL; eargv[eargc - 1] = s = malloc(len); if (s == NULL) fatal("ran out of memory\n"); diff --git a/usr.bin/rdist/main.c b/usr.bin/rdist/main.c index 46eb734984..472c2681ab 100644 --- a/usr.bin/rdist/main.c +++ b/usr.bin/rdist/main.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)main.c 8.1 (Berkeley) 6/9/93 * $FreeBSD: src/usr.bin/rdist/main.c,v 1.5 1999/08/28 01:05:07 peter Exp $ - * $DragonFly: src/usr.bin/rdist/main.c,v 1.5 2008/10/16 01:52:33 swildner Exp $ */ /* * Remote distribution program. @@ -92,7 +91,7 @@ main(int argc, char **argv) gethostname(host, sizeof(host)); strcpy(tempfile, _PATH_TMP); strcat(tempfile, _RDIST_TMP); - if ((tempname = rindex(tempfile, '/')) != 0) + if ((tempname = rindex(tempfile, '/')) != NULL) tempname++; else tempname = tempfile; diff --git a/usr.bin/rdist/rshrcmd.c b/usr.bin/rdist/rshrcmd.c index f83b24d0b2..da242a4302 100644 --- a/usr.bin/rdist/rshrcmd.c +++ b/usr.bin/rdist/rshrcmd.c @@ -4,7 +4,6 @@ * Chris Siebenmann . * * $FreeBSD: src/usr.bin/rdist/rshrcmd.c,v 1.6 1999/08/28 01:05:08 peter Exp $ - * $DragonFly: src/usr.bin/rdist/rshrcmd.c,v 1.3 2004/07/24 19:45:10 eirikn Exp $ */ #include @@ -42,11 +41,11 @@ rshrcmd(char **ahost, u_short port, char *luser, char *ruser, char *cmd, int *fd struct hostent *hp; /* insure that we are indeed being used as we thought. */ - if (fd2p != 0) + if (fd2p != NULL) return -1; /* validate remote hostname. */ hp = gethostbyname(*ahost); - if (hp == 0) { + if (hp == NULL) { error("%s: unknown host", *ahost); return -1; } diff --git a/usr.bin/rdist/server.c b/usr.bin/rdist/server.c index 1122da4a29..f932ab049b 100644 --- a/usr.bin/rdist/server.c +++ b/usr.bin/rdist/server.c @@ -32,7 +32,6 @@ * * @(#)server.c 8.1 (Berkeley) 6/9/93 * $FreeBSD: src/usr.bin/rdist/server.c,v 1.10 1999/08/28 01:05:09 peter Exp $ - * $DragonFly: src/usr.bin/rdist/server.c,v 1.7 2008/10/16 01:52:33 swildner Exp $ */ #include @@ -301,7 +300,7 @@ install(char *src, char *dest, int destdir, int opts) Tdest = destcopy; } sendf(rname, opts); - Tdest = 0; + Tdest = NULL; } static char * diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 7dbc8cb682..5a962689e5 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -28,7 +28,6 @@ * * @(#)rpc_main.c 1.21 94/04/25 SMI; 1.30 89/03/30 (C) 1987 SMI * $FreeBSD: src/usr.bin/rpcgen/rpc_main.c,v 1.33 2007/08/23 09:38:26 delphij Exp $ - * $DragonFly: src/usr.bin/rpcgen/rpc_main.c,v 1.12 2008/10/16 01:52:33 swildner Exp $ */ @@ -427,7 +426,7 @@ generate_guard(const char *pathname) char *guard, *tmp, *stopat; filename = strrchr(pathname, '/'); /* find last component */ - filename = ((filename == 0) ? pathname : filename+1); + filename = ((filename == NULL) ? pathname : filename+1); guard = xstrdup(filename); stopat = strrchr(guard, '.'); @@ -507,7 +506,7 @@ h_output(const char *infile, const char *define, int extend, const char *outfile tell = ftell(fout); /* print data definitions */ - while ((def = get_definition()) != 0) + while ((def = get_definition()) != NULL) print_datadef(def, headeronly); /* @@ -614,7 +613,7 @@ s_output(int argc, const char **argv, const char *infile, const char *define, if (timerflag) f_print(fout, "\n#define _RPCSVC_CLOSEDOWN %s\n", svcclosetime); - while ((def = get_definition()) != 0) + while ((def = get_definition()) != NULL) foundprogram |= (def->def_kind == DEF_PROGRAM); if (extend && !foundprogram) { unlink(outfilename); @@ -652,7 +651,7 @@ l_output(const char *infile, const char *define, int extend, const char *outfile free(include); } else f_print(fout, "#include \n"); - while ((def = get_definition()) != 0) + while ((def = get_definition()) != NULL) foundprogram |= (def->def_kind == DEF_PROGRAM); if (extend && !foundprogram) unlink(outfilename); @@ -674,7 +673,7 @@ t_output(const char *infile, const char *define, int extend, const char *outfile outfilename = extend ? extendfile(infile, outfile) : outfile; open_output(infile, outfilename); add_warning(); - while ((def = get_definition()) != 0) + while ((def = get_definition()) != NULL) foundprogram |= (def->def_kind == DEF_PROGRAM); if (extend && !foundprogram) unlink(outfilename); @@ -707,7 +706,7 @@ svc_output(const char *infile, const char *define, int extend, const char *outfi f_print(fout, "#include \n"); tell = ftell(fout); - while ((def = get_definition()) != 0) + while ((def = get_definition()) != NULL) write_sample_svc(def); if (extend && tell == ftell(fout)) unlink(outfilename); @@ -739,7 +738,7 @@ clnt_output(const char *infile, const char *define, int extend, const char *outf } else f_print(fout, "#include \n"); tell = ftell(fout); - while ((def = get_definition()) != 0) + while ((def = get_definition()) != NULL) has_program += write_sample_clnt(def); if (has_program) diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c index 4b65b16c3c..73d1c42f19 100644 --- a/usr.bin/rs/rs.c +++ b/usr.bin/rs/rs.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1993 The Regents of the University of California. All rights reserved. * @(#)rs.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/rs/rs.c,v 1.5.2.2 2002/08/03 00:48:43 tjr Exp $ - * $DragonFly: src/usr.bin/rs/rs.c,v 1.3 2005/01/05 00:32:50 cpressey Exp $ */ /* @@ -178,7 +177,7 @@ getfile(void) } } } while (getline() != EOF); - *ep = 0; /* mark end of pointers */ + *ep = NULL; /* mark end of pointers */ nelem = ep - elem; } diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index a06df77c67..5ee994318b 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -32,7 +32,6 @@ * * @(#)compile.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/sed/compile.c,v 1.34 2009/05/25 06:45:33 brian Exp $ - * $DragonFly: src/usr.bin/sed/compile.c,v 1.4 2008/04/08 13:23:38 swildner Exp $ */ #include @@ -157,10 +156,10 @@ compile_stream(struct s_command **link) char re[_POSIX2_LINE_MAX + 1]; int naddr; /* Number of addresses */ - stack = 0; + stack = NULL; for (;;) { if ((p = cu_fgets(lbuf, sizeof(lbuf), NULL)) == NULL) { - if (stack != 0) + if (stack != NULL) errx(1, "%lu: %s: unexpected EOF (pending }'s)", linenum, fname); return (link); @@ -238,7 +237,7 @@ nonsel: /* Now parse the command */ * group is really just a noop. */ cmd->nonsel = 1; - if (stack == 0) + if (stack == NULL) errx(1, "%lu: %s: unexpected }", linenum, fname); cmd2 = stack; stack = cmd2->next; diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index f5adbde605..85ba31e44b 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -113,7 +113,7 @@ main(int argc, char *argv[]) { int ch, i, stdinflag = 0; char cflag = 0, mflag = 0; - char *outfile, *outpath = 0; + char *outfile, *outpath = NULL; struct field *fldtab; size_t fldtab_sz, fld_cnt; size_t alloc_size; diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c index 07f4f3304c..822904ff98 100644 --- a/usr.bin/systat/mbufs.c +++ b/usr.bin/systat/mbufs.c @@ -32,7 +32,6 @@ * * @(#)mbufs.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/systat/mbufs.c,v 1.10.2.1 2000/08/26 09:36:55 ps Exp $ - * $DragonFly: src/usr.bin/systat/mbufs.c,v 1.8 2008/11/10 04:59:45 swildner Exp $ */ #define _KERNEL_STRUCTURES @@ -97,7 +96,7 @@ showmbufs(void) char buf[10]; const char *mtname; - if (mb == 0) + if (mb == NULL) return; for (j = 0; j < wnd->_maxy; j++) { max = 0, idx = -1; @@ -175,7 +174,7 @@ initmbufs(void) return 0; } - if (mb == 0) + if (mb == NULL) mb = (struct mbstat *)calloc(1, sizeof *mb); return 1; } diff --git a/usr.bin/systat/netcmds.c b/usr.bin/systat/netcmds.c index e4ad7adbea..6ad6c25750 100644 --- a/usr.bin/systat/netcmds.c +++ b/usr.bin/systat/netcmds.c @@ -148,7 +148,7 @@ changeitems(char *args, int onoff) continue; } hp = gethostbyname(args); - if (hp == 0) { + if (hp == NULL) { in.s_addr = inet_addr(args); if ((int)in.s_addr == -1) { error("%s: unknown host or port", args); @@ -164,7 +164,7 @@ static int selectproto(char *proto) { - if (proto == 0 || streq(proto, "all")) + if (proto == NULL || streq(proto, "all")) protos = TCP | UDP; else if (streq(proto, "tcp")) protos = TCP; @@ -199,9 +199,9 @@ selectport(long port, int onoff) struct pitem *p; if (port == -1) { - if (ports == 0) + if (ports == NULL) return (0); - free((char *)ports), ports = 0; + free((char *)ports), ports = NULL; nports = 0; return (1); } @@ -257,10 +257,10 @@ 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; + free((char *)hosts), hosts = NULL; nhosts = 0; return (1); } diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index 4c1c63f460..7b58e78ae7 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -32,7 +32,6 @@ * * @(#)netstat.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/systat/netstat.c,v 1.13 1999/08/30 08:18:08 peter Exp $ - * $DragonFly: src/usr.bin/systat/netstat.c,v 1.11 2008/11/10 04:59:45 swildner Exp $ */ /* @@ -393,7 +392,7 @@ shownetstat(void) static void inetprint(struct in_addr *in, int port, const char *proto) { - struct servent *sp = 0; + struct servent *sp = NULL; char line[80], *cp; snprintf(line, sizeof(line), "%.*s.", 16, inetname(*in)); @@ -422,7 +421,7 @@ inetprint(struct in_addr *in, int port, const char *proto) static char * inetname(struct in_addr in) { - char *cp = 0; + char *cp = NULL; static char line[50]; struct hostent *hp; struct netent *np; @@ -436,7 +435,7 @@ inetname(struct in_addr in) if (np) cp = np->n_name; } - if (cp == 0) { + if (cp == NULL) { hp = gethostbyaddr(&in, sizeof (in), AF_INET); if (hp) cp = hp->h_name; diff --git a/usr.bin/talk/get_addrs.c b/usr.bin/talk/get_addrs.c index c1c65cb4e8..8c835a21f7 100644 --- a/usr.bin/talk/get_addrs.c +++ b/usr.bin/talk/get_addrs.c @@ -56,7 +56,7 @@ get_addrs(char *my_machine_name __unused, char *his_machine_name) err(1, "failed to find my interface address"); /* find the server's port */ sp = getservbyname("ntalk", "udp"); - if (sp == 0) + if (sp == NULL) errx(1, "ntalk/udp: service is not registered"); daemon_port = sp->s_port; } diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c index ac5f6cc33e..1a2d3b8120 100644 --- a/usr.bin/telnet/commands.c +++ b/usr.bin/telnet/commands.c @@ -32,7 +32,6 @@ * * @(#)commands.c 8.4 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/telnet/commands.c,v 1.12.2.7 2003/04/23 07:16:32 ru Exp $ - * $DragonFly: src/crypto/telnet/telnet/commands.c,v 1.3 2008/09/04 11:54:24 hasso Exp $ */ #include @@ -199,7 +198,7 @@ makeargv(void) break; cp++; } - *argp++ = 0; + *argp++ = NULL; } /* @@ -349,7 +348,7 @@ sendcmd(int argc, char *argv[]) count = 0; for (i = 1; i < argc; i++) { s = GETSEND(argv[i]); - if (s == 0) { + if (s == NULL) { printf("Unknown send argument '%s'\n'send ?' for help.\n", argv[i]); return 0; @@ -389,7 +388,7 @@ sendcmd(int argc, char *argv[]) /* OK, they are all OK, now go through again and actually send */ count = 0; for (i = 1; i < argc; i++) { - if ((s = GETSEND(argv[i])) == 0) { + if ((s = GETSEND(argv[i])) == NULL) { fprintf(stderr, "Telnet 'send' error - argument disappeared!\n"); quit(); /*NOTREACHED*/ @@ -830,7 +829,7 @@ toggle(int argc, char *argv[]) fprintf(stderr, "'%s': ambiguous argument ('toggle ?' for help).\n", name); return 0; - } else if (c == 0) { + } else if (c == NULL) { fprintf(stderr, "'%s': unknown argument ('toggle ?' for help).\n", name); return 0; @@ -935,9 +934,9 @@ setcmd(int argc, char *argv[]) } ct = getset(argv[1]); - if (ct == 0) { + if (ct == NULL) { c = GETTOGGLE(argv[1]); - if (c == 0) { + if (c == NULL) { fprintf(stderr, "'%s': unknown argument ('set ?' for help).\n", argv[1]); return 0; @@ -1011,9 +1010,9 @@ unsetcmd(int argc, char *argv[]) while (argc--) { name = *argv++; ct = getset(name); - if (ct == 0) { + if (ct == NULL) { c = GETTOGGLE(name); - if (c == 0) { + if (c == NULL) { fprintf(stderr, "'%s': unknown argument ('unset ?' for help).\n", name); return 0; @@ -1190,7 +1189,7 @@ modecmd(int argc, char *argv[]) if (argc != 2) { printf("'mode' command requires an argument\n"); printf("'mode ?' for help.\n"); - } else if ((mt = GETMODECMD(argv[1])) == 0) { + } else if ((mt = GETMODECMD(argv[1])) == NULL) { fprintf(stderr, "Unknown mode '%s' ('mode ?' for help).\n", argv[1]); } else if (Ambiguous((void *)mt)) { fprintf(stderr, "Ambiguous mode '%s' ('mode ?' for help).\n", argv[1]); @@ -1361,7 +1360,7 @@ shell(int argc, char *argv[] __unused) shellp = getenv("SHELL"); if (shellp == NULL) shellp = "/bin/sh"; - if ((shellname = strrchr(shellp, '/')) == 0) + if ((shellname = strrchr(shellp, '/')) == NULL) shellname = shellp; else shellname++; @@ -1484,7 +1483,7 @@ slccmd(int argc, char *argv[]) return 0; } c = getslc(argv[1]); - if (c == 0) { + if (c == NULL) { fprintf(stderr, "'%s': unknown argument ('slc ?' for help).\n", argv[1]); return 0; @@ -1578,7 +1577,7 @@ env_cmd(int argc, char *argv[]) return 0; } c = getenvcmd(argv[1]); - if (c == 0) { + if (c == NULL) { fprintf(stderr, "'%s': unknown argument ('environ ?' for help).\n", argv[1]); return 0; @@ -1745,7 +1744,7 @@ env_send(unsigned char *var) return; } ep = env_find(var); - if (ep == 0) { + if (ep == NULL) { fprintf(stderr, "Cannot send '%s': variable not defined\n", var); return; @@ -1891,7 +1890,7 @@ auth_cmd(int argc, char *argv[]) c = (struct authlist *) genget(argv[1], (char **) AuthList, sizeof(struct authlist)); - if (c == 0) { + if (c == NULL) { fprintf(stderr, "'%s': unknown argument ('auth ?' for help).\n", argv[1]); return 0; @@ -1996,7 +1995,7 @@ encrypt_cmd(int argc, char *argv[]) c = (struct encryptlist *) genget(argv[1], (char **) EncryptList, sizeof(struct encryptlist)); - if (c == 0) { + if (c == NULL) { fprintf(stderr, "'%s': unknown argument ('encrypt ?' for help).\n", argv[1]); return 0; @@ -2165,11 +2164,11 @@ switch_af(struct addrinfo **aip) int tn(int argc, char *argv[]) { - char *srp = 0; + char *srp = NULL; int proto, opt; int srlen; int srcroute = 0, result; - char *cmd, *hostp = 0, *portp = 0, *user = 0; + char *cmd, *hostp = NULL, *portp = NULL, *user = NULL; char *src_addr = NULL; struct addrinfo hints, *res, *res0 = NULL, *src_res, *src_res0 = NULL; int error = 0, af_error = 0; @@ -2213,12 +2212,12 @@ tn(int argc, char *argv[]) --argc; continue; } - if (hostp == 0) { + if (hostp == NULL) { hostp = *argv++; --argc; continue; } - if (portp == 0) { + if (portp == NULL) { portp = *argv++; --argc; continue; @@ -2228,7 +2227,7 @@ tn(int argc, char *argv[]) setuid(getuid()); return 0; } - if (hostp == 0) + if (hostp == NULL) goto usage; if (src_addr != NULL) { @@ -2348,7 +2347,7 @@ tn(int argc, char *argv[]) hostbuf[BUFSIZ - 1] = '\0'; } else hostp = hostbuf; - srp = 0; + srp = NULL; result = sourceroute(res, hostp, &srp, &srlen, &proto, &opt); if (result == 0) { #ifdef INET6 @@ -2405,7 +2404,7 @@ tn(int argc, char *argv[]) } if (src_addr != NULL) { - for (src_res = src_res0; src_res != 0; src_res = src_res->ai_next) + for (src_res = src_res0; src_res != NULL; src_res = src_res->ai_next) if (src_res->ai_family == res->ai_family) break; if (src_res == NULL) @@ -2577,7 +2576,7 @@ call(intrtn_t routine, ...) int argno = 0; va_start(ap, routine); - while ((args[argno++] = va_arg(ap, char *)) != 0); + while ((args[argno++] = va_arg(ap, char *)) != NULL); va_end(ap); return (*routine)(argno-1, args); } @@ -2613,7 +2612,7 @@ command(int top, const char *tbuf, int cnt) cp = line; while (cnt > 0 && (*cp++ = *tbuf++) != '\n') cnt--; - tbuf = 0; + tbuf = NULL; if (cp == line || *--cp != '\n' || cp == line) goto getline; *cp = '\0'; @@ -2634,7 +2633,7 @@ command(int top, const char *tbuf, int cnt) if (line[0] == 0) break; makeargv(); - if (margv[0] == 0) { + if (margv[0] == NULL) { break; } c = getcmd(margv[0]); @@ -2642,7 +2641,7 @@ command(int top, const char *tbuf, int cnt) printf("?Ambiguous command\n"); continue; } - if (c == 0) { + if (c == NULL) { printf("?Invalid command\n"); continue; } @@ -2694,7 +2693,7 @@ help(int argc, char *argv[]) return 0; } -static char *rcname = 0; +static char *rcname = NULL; static char rcbuf[128]; void @@ -2713,7 +2712,7 @@ cmdrc(char *m1, char *m2) strlcpy(m1save, m1, sizeof(m1save)); m1 = m1save; - if (rcname == 0) { + if (rcname == NULL) { rcname = getenv("HOME"); if (rcname && (strlen(rcname) + 10) < sizeof(rcbuf)) strcpy(rcbuf, rcname); @@ -2723,7 +2722,7 @@ cmdrc(char *m1, char *m2) rcname = rcbuf; } - if ((rcfile = fopen(rcname, "r")) == 0) { + if ((rcfile = fopen(rcname, "r")) == NULL) { return; } @@ -2754,14 +2753,14 @@ cmdrc(char *m1, char *m2) gotmachine = 1; } makeargv(); - if (margv[0] == 0) + if (margv[0] == NULL) continue; c = getcmd(margv[0]); if (Ambiguous((void *)c)) { printf("?Ambiguous command: %s\n", margv[0]); continue; } - if (c == 0) { + if (c == NULL) { printf("?Invalid command: %s\n", margv[0]); continue; } @@ -2931,7 +2930,7 @@ sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, ai->ai_family != AF_INET6 && #endif c == ':') - cp2 = 0; + cp2 = NULL; else for (cp2 = cp; (c = *cp2); cp2++) { if (c == ',') { *cp2++ = '\0'; @@ -2950,7 +2949,7 @@ sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, break; } if (!c) - cp2 = 0; + cp2 = NULL; hints.ai_flags = AI_NUMERICHOST; error = getaddrinfo(cp, NULL, &hints, &res); @@ -3005,7 +3004,7 @@ sourceroute(struct addrinfo *ai, char *arg, char **cpp, int *lenp, int *protop, #endif { if ((*(*cpp+IPOPT_OLEN) = lsrp - *cpp) <= 7) { - *cpp = 0; + *cpp = NULL; *lenp = 0; return -1; } diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c index 23df5a1a7e..b12b40b5e3 100644 --- a/usr.bin/telnet/main.c +++ b/usr.bin/telnet/main.c @@ -32,7 +32,6 @@ * * @(#)main.c 8.3 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/telnet/main.c,v 1.4.2.5 2002/04/13 10:59:08 markm Exp $ - * $DragonFly: src/crypto/telnet/telnet/main.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ #include @@ -352,7 +351,7 @@ main(int argc, char *argv[]) *argp++ = argv[0]; /* host */ if (argc > 1) *argp++ = argv[1]; /* port */ - *argp = 0; + *argp = NULL; if (setjmp(toplevel) != 0) Exit(0); diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c index 2fdcbae21a..4950c00f9d 100644 --- a/usr.bin/telnet/telnet.c +++ b/usr.bin/telnet/telnet.c @@ -32,7 +32,6 @@ * * @(#)telnet.c 8.4 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/telnet/telnet.c,v 1.4.2.5 2002/04/13 10:59:08 markm Exp $ - * $DragonFly: src/crypto/telnet/telnet/telnet.c,v 1.3 2005/03/28 18:03:32 drhodus Exp $ */ #include @@ -110,7 +109,7 @@ int doaddrlookup = 1, /* do a reverse address lookup? */ clienteof = 0; -char *prompt = 0; +char *prompt = NULL; #ifdef ENCRYPTION char *line; /* hack around breakage in sra.c :-( !! */ #endif @@ -535,7 +534,7 @@ mklist(char *buf, char *name) if (name) { if (strlen(name) > 40) { - name = 0; + name = NULL; unknown[0] = name_unknown; } else { unknown[0] = name; @@ -554,13 +553,13 @@ mklist(char *buf, char *name) * Allocate an array to put the name pointers into */ argv = (char **)malloc((n+3)*sizeof(char *)); - if (argv == 0) + if (argv == NULL) return(unknown); /* * Fill up the array of pointers to names. */ - *argv = 0; + *argv = NULL; argvp = argv+1; n = 0; for (cp = cp2 = buf; (c = *cp); cp++) { @@ -620,9 +619,9 @@ mklist(char *buf, char *name) */ cp = *(argvp-1); *argvp++ = cp; - *argvp = 0; + *argvp = NULL; - if (*argv == 0) { + if (*argv == NULL) { if (name) *argv = name; else { @@ -678,7 +677,7 @@ static const char * gettermname(void) { char *tname; - static const char **tnamep = 0; + static const char **tnamep = NULL; static const char **next; int err; @@ -699,7 +698,7 @@ gettermname(void) } next = tnamep; } - if (*next == 0) + if (*next == NULL) next = tnamep; return(*next++); } @@ -1100,7 +1099,7 @@ slc_init(void) localchars = 1; for (spcp = spc_data; spcp < &spc_data[NSLC+1]; spcp++) { spcp->val = 0; - spcp->valp = 0; + spcp->valp = NULL; spcp->flags = spcp->mylevel = SLC_NOSUPPORT; } @@ -1406,7 +1405,7 @@ int old_env_value = OLD_ENV_VALUE; void env_opt(unsigned char *buf, int len) { - unsigned char *ep = 0, *epc = 0; + unsigned char *ep = NULL, *epc = NULL; int i; switch(buf[0]&0xff) { diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c index 360d598216..6436fc79bd 100644 --- a/usr.bin/telnet/utilities.c +++ b/usr.bin/telnet/utilities.c @@ -32,7 +32,6 @@ * * @(#)utilities.c 8.3 (Berkeley) 5/30/95 * $FreeBSD: src/crypto/telnet/telnet/utilities.c,v 1.2.8.2 2002/04/13 10:59:08 markm Exp $ - * $DragonFly: src/crypto/telnet/telnet/utilities.c,v 1.2 2003/06/17 04:24:37 dillon Exp $ */ #define TELOPTS @@ -63,7 +62,7 @@ #include #endif -FILE *NetTrace = 0; /* Not in bss, since needs to stay */ +FILE *NetTrace = NULL; /* Not in bss, since needs to stay */ int prettydump; /* diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c index c5353f9831..d9b6a275e8 100644 --- a/usr.bin/tftp/main.c +++ b/usr.bin/tftp/main.c @@ -594,7 +594,7 @@ command(void) printf("?Ambiguous command\n"); continue; } - if (c == 0) { + if (c == NULL) { printf("?Invalid command\n"); continue; } @@ -612,7 +612,7 @@ getcmd(char *name) longest = 0; nmatches = 0; - found = 0; + found = NULL; for (c = cmdtab; (p = c->name) != NULL; c++) { for (q = name; *q == *p++; q++) if (*q == 0) /* exact match? */ @@ -656,7 +656,7 @@ makeargv(void) break; *cp++ = '\0'; } - *argp++ = 0; + *argp++ = NULL; } void diff --git a/usr.bin/tip/libacu/v831.c b/usr.bin/tip/libacu/v831.c index 4f1aa30881..a14e674ffe 100644 --- a/usr.bin/tip/libacu/v831.c +++ b/usr.bin/tip/libacu/v831.c @@ -195,7 +195,7 @@ dialit(phonenum, acu) for (vp = vaconfig; vp->vc_name; vp++) if (strcmp(vp->vc_name, acu) == 0) break; - if (vp->vc_name == 0) { + if (vp->vc_name == NULL) { printf("Unable to locate dialer (%s)\n", acu); return ('K'); } diff --git a/usr.bin/tip/tip/value.c b/usr.bin/tip/tip/value.c index 8d9c355c4a..bd36deff1c 100644 --- a/usr.bin/tip/tip/value.c +++ b/usr.bin/tip/tip/value.c @@ -350,7 +350,7 @@ vstring(s,v) char *expand(); p = vlookup(s); - if (p == 0) + if (p == NULL) return (1); if (p->v_type&NUMBER) vassign(p, (char *)(intptr_t)atoi(v)); diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c index 0f3fb9a79f..62447308b2 100644 --- a/usr.bin/units/units.c +++ b/usr.bin/units/units.c @@ -15,7 +15,6 @@ * improvements you might make to this program. * * $FreeBSD: src/usr.bin/units/units.c,v 1.11 2008/08/16 16:27:41 dwmalone Exp $ - * $DragonFly: src/usr.bin/units/units.c,v 1.4 2006/08/13 19:19:44 swildner Exp $ */ #include @@ -227,7 +226,7 @@ addsubunit(char *product[], char *toadd) return 1; } if (!*ptr) - *(ptr + 1) = 0; + *(ptr + 1) = NULL; *ptr = dupstr(toadd); return 0; } @@ -676,7 +675,7 @@ main(int argc, char **argv) struct unittype have, want; char havestr[81], wantstr[81]; int optchar; - char *userfile = 0; + char *userfile = NULL; int quiet = 0; while ((optchar = getopt(argc, argv, "vqf:")) != -1) { diff --git a/usr.bin/usbhidctl/usbhid.c b/usr.bin/usbhidctl/usbhid.c index 8d797088ec..19540fdd5a 100644 --- a/usr.bin/usbhidctl/usbhid.c +++ b/usr.bin/usbhidctl/usbhid.c @@ -168,9 +168,9 @@ rev(struct hid_item **p) { struct hid_item *cur, *prev, *next; - prev = 0; + prev = NULL; cur = *p; - while(cur != 0) { + while(cur != NULL) { next = cur->next; cur->next = prev; prev = cur; @@ -210,7 +210,7 @@ dumpdata(int f, report_desc_t rd, int loop) int sp = 0; char namebuf[10000], *namep; - hids = 0; + hids = NULL; for (d = hid_start_parse(rd, 1< @@ -229,7 +228,7 @@ main(int argc, char **argv) setgid(getgid()); kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf); - if (kd == 0) + if (kd == NULL) errx(1, "kvm_openfiles: %s", errbuf); if ((c = kvm_nlist(kd, namelist)) != 0) { diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c index ccfa4d4ccd..51ebfb3957 100644 --- a/usr.bin/whereis/whereis.c +++ b/usr.bin/whereis/whereis.c @@ -22,7 +22,6 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * $FreeBSD: src/usr.bin/whereis/whereis.c,v 1.12 2002/08/22 01:50:51 johan Exp $ - * $DragonFly: src/usr.bin/whereis/whereis.c,v 1.6 2008/06/05 18:06:33 swildner Exp $ */ /* @@ -442,7 +441,7 @@ main(int argc, char **argv) nlen = strlen(cp); bin = realloc(bin, olen + nlen + 2); - if (bin == 0) + if (bin == NULL) abort(); strcat(bin, " "); strcat(bin, cp); @@ -516,7 +515,7 @@ main(int argc, char **argv) nlen = strlen(cp2); man = realloc(man, olen + nlen + 2); - if (man == 0) + if (man == NULL) abort(); strcat(man, " "); strcat(man, cp2); @@ -555,7 +554,7 @@ main(int argc, char **argv) nlen = strlen(cp); src = realloc(src, olen + nlen + 2); - if (src == 0) + if (src == NULL) abort(); strcat(src, " "); strcat(src, cp); @@ -623,7 +622,7 @@ main(int argc, char **argv) src = realloc(src, olen + nlen + 2); - if (src == 0) + if (src == NULL) abort(); strcat(src, " "); strcat(src, buf); diff --git a/usr.bin/window/cmd.c b/usr.bin/window/cmd.c index a048df536a..020a792514 100644 --- a/usr.bin/window/cmd.c +++ b/usr.bin/window/cmd.c @@ -83,7 +83,7 @@ docmd(void) switch (c) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - if ((w = window[c - '1']) == 0) { + if ((w = window[c - '1']) == NULL) { error("%c: No such window.", c); break; } @@ -92,7 +92,7 @@ docmd(void) out = 1; break; case '%': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) setselwin(w); break; case ctrl('^'): @@ -104,26 +104,26 @@ docmd(void) error("No previous window."); break; case 'c': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) closewin(w); break; case 'w': c_window(); break; case 'm': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) c_move(w); break; case 'M': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) movewin(w, w->ww_alt.t, w->ww_alt.l); break; case 's': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) c_size(w); break; case 'S': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) sizewin(w, w->ww_alt.nr, w->ww_alt.nc); break; case 'y': @@ -215,7 +215,7 @@ struct ww * getwin(void) { int c; - struct ww *w = 0; + struct ww *w = NULL; if (!terse) wwputs("Which window? ", cmdwin); @@ -234,7 +234,7 @@ getwin(void) w = selwin; else if (c == '-') w = lastselwin; - if (w == 0) + if (w == NULL) wwbell(); if (!terse) wwputc('\n', cmdwin); @@ -295,6 +295,6 @@ setselwin(struct ww *w) return; if (selwin != 0) lastselwin = selwin; - if ((selwin = w) != 0) + if ((selwin = w) != NULL) front(selwin, 1); } diff --git a/usr.bin/window/cmd2.c b/usr.bin/window/cmd2.c index 386e7d8064..3b767feebd 100644 --- a/usr.bin/window/cmd2.c +++ b/usr.bin/window/cmd2.c @@ -103,7 +103,7 @@ c_help(void) { struct ww *w; - if ((w = openiwin(wwnrow - 3, "Help")) == 0) { + if ((w = openiwin(wwnrow - 3, "Help")) == NULL) { error("Can't open help window: %s.", wwerror()); return; } diff --git a/usr.bin/window/cmd6.c b/usr.bin/window/cmd6.c index 8a989fa14b..695f7ec6ea 100644 --- a/usr.bin/window/cmd6.c +++ b/usr.bin/window/cmd6.c @@ -70,11 +70,11 @@ c_debug(void) debug_str(); break; case 'v': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) wwdumpnvis(w); break; case 'w': - if ((w = getwin()) != 0) + if ((w = getwin()) != NULL) wwdumpwin(w); break; default: @@ -89,7 +89,7 @@ debug_str(void) struct ww *w; struct string *s; - if ((w = openiwin(wwnrow - 3, "Allocated Strings")) == 0) { + if ((w = openiwin(wwnrow - 3, "Allocated Strings")) == NULL) { error("Can't open string window: %s.", wwerror()); return; } diff --git a/usr.bin/window/cmd7.c b/usr.bin/window/cmd7.c index 684cf9d43d..c13899ad24 100644 --- a/usr.bin/window/cmd7.c +++ b/usr.bin/window/cmd7.c @@ -231,7 +231,7 @@ unyank(void) str_free(yp->line); free((char *) yp); } - yb_head = yb_tail = 0; + yb_head = yb_tail = NULL; } void @@ -245,9 +245,9 @@ yank_line(int r, int c, int cend) if (c == cend) return; - if ((yp = (struct yb *) malloc(sizeof *yp)) == 0) + if ((yp = (struct yb *) malloc(sizeof *yp)) == NULL) return; - yp->link = 0; + yp->link = NULL; nl = cend == selwin->ww_b.r; bp = selwin->ww_buf[r]; for (cend--; cend >= c; cend--) diff --git a/usr.bin/window/compress.c b/usr.bin/window/compress.c index 14da34ab33..4cdb19427a 100644 --- a/usr.bin/window/compress.c +++ b/usr.bin/window/compress.c @@ -241,30 +241,30 @@ ccinit(void) #endif #undef C if ((cc_output = (struct cc **) - malloc((unsigned) cc_bufsize * sizeof *cc_output)) == 0) + malloc((unsigned) cc_bufsize * sizeof *cc_output)) == NULL) goto nomem; if ((cc_hashcodes = (short *) - malloc((unsigned) cc_bufsize * sizeof *cc_hashcodes)) == 0) + malloc((unsigned) cc_bufsize * sizeof *cc_hashcodes)) == NULL) goto nomem; - if ((cc_htab = (struct cc **) malloc(HSIZE * sizeof *cc_htab)) == 0) + if ((cc_htab = (struct cc **) malloc(HSIZE * sizeof *cc_htab)) == NULL) goto nomem; if ((cc_tokens = (struct cc **) malloc((unsigned) (cc_ntoken + tt.tt_token_max - tt.tt_token_min + 1) * - sizeof *cc_tokens)) == 0) + sizeof *cc_tokens)) == NULL) goto nomem; if ((cc_undo = (struct cc_undo *) - malloc((unsigned) cc_bufsize * sizeof *cc_undo)) == 0) + malloc((unsigned) cc_bufsize * sizeof *cc_undo)) == NULL) goto nomem; for (i = tt.tt_token_min; i <= tt.tt_token_max; i++) if ((cc_places[i] = (short *) - malloc((unsigned) cc_bufsize * sizeof **cc_places)) == 0) + malloc((unsigned) cc_bufsize * sizeof **cc_places)) == NULL) goto nomem; cc_q0a.qforw = cc_q0a.qback = &cc_q0a; cc_q0b.qforw = cc_q0b.qback = &cc_q0b; cc_q1a.qforw = cc_q1a.qback = &cc_q1a; cc_q1b.qforw = cc_q1b.qback = &cc_q1b; - if ((p = (struct cc *) malloc((unsigned) cc_ntoken * sizeof *p)) == 0) + if ((p = (struct cc *) malloc((unsigned) cc_ntoken * sizeof *p)) == NULL) goto nomem; for (i = 0; i < tt.tt_ntoken; i++) { p->code = i; @@ -286,7 +286,7 @@ ccinit(void) } cc_tt_ob = tt_ob; cc_tt_obe = tt_obe; - if ((cc_buffer = malloc((unsigned) cc_bufsize)) == 0) + if ((cc_buffer = malloc((unsigned) cc_bufsize)) == NULL) goto nomem; return 0; nomem: @@ -315,9 +315,9 @@ ccreset(void) memset((char *) cc_htab, 0, HSIZE * sizeof *cc_htab); for (p = cc_q0a.qforw; p != &cc_q0a; p = p->qforw) - p->hback = 0; + p->hback = NULL; for (p = cc_q1a.qforw; p != &cc_q1a; p = p->qforw) - p->hback = 0; + p->hback = NULL; } void @@ -490,7 +490,7 @@ cc_sweep(char *buffer, int bufsize, struct cc **tokens, int length) h = cc_htab + (*hc1++ = hash(hh, c)); hc = hc1; } - for (p = *h; p != 0; p = p->hforw) + for (p = *h; p != NULL; p = p->hforw) if (p->length == (char) length) { char *p1 = p->string; char *p2 = cp - length; @@ -502,13 +502,13 @@ cc_sweep(char *buffer, int bufsize, struct cc **tokens, int length) break; fail:; } - if (p == 0) { + if (p == NULL) { p = cc_q1a.qback; if (p == &cc_q1a || (p->time >= cc_time0 && p->length == (char) length)) continue; - if (p->hback != 0) - if ((*p->hback = p->hforw) != 0) + if (p->hback != NULL) + if ((*p->hback = p->hforw) != NULL) p->hforw->hback = p->hback; { char *p1 = p->string; @@ -526,7 +526,7 @@ cc_sweep(char *buffer, int bufsize, struct cc **tokens, int length) p->bcount = 1; p->ccount = 0; p->flag = 0; - if ((p->hforw = *h) != 0) + if ((p->hforw = *h) != NULL) p->hforw->hback = &p->hforw; *h = p; p->hback = h; @@ -609,7 +609,7 @@ cc_sweep(char *buffer, int bufsize, struct cc **tokens, int length) } } if ((i = pp - tokens) > 0) { - *pp = 0; + *pp = NULL; if (cc_reverse) cc_sweep_reverse(tokens, places); if (cc_sort && i > 1) { @@ -619,7 +619,7 @@ cc_sweep(char *buffer, int bufsize, struct cc **tokens, int length) if (cc_chop) { if ((i = i * cc_chop / 100) == 0) i = 1; - tokens[i] = 0; + tokens[i] = NULL; } i++; } @@ -632,7 +632,7 @@ cc_sweep_reverse(struct cc **pp, short int *places) struct cc *p; short frnt, back, t; - while ((p = *pp++) != 0) { + while ((p = *pp++) != NULL) { back = -1; t = p->places; /* the list is never empty */ @@ -718,7 +718,7 @@ cc_compress_cleanup(struct cc **output, int bufsize) for (end = output + bufsize; output < end;) { struct cc *p; int length; - if ((p = *output) == 0) { + if ((p = *output) == NULL) { output++; continue; } @@ -728,7 +728,7 @@ cc_compress_cleanup(struct cc **output, int bufsize) qinsert(p, &cc_q0b); p->flag = 0; } else if (p->ccount == 0) { - *output = 0; + *output = NULL; } else if (p->ccount >= thresh(length) #ifndef cc_weight || wthreshp(p->weight, length) @@ -737,7 +737,7 @@ cc_compress_cleanup(struct cc **output, int bufsize) p->flag = 0; } else { p->ccount = 0; - *output = 0; + *output = NULL; } output += length; } @@ -791,17 +791,17 @@ cc_compress(struct cc **output, struct cc **tokens, char flag) struct cc **iip = ip + length; struct cc_undo *undop1 = undop; - if ((x = *(jp = ip)) != 0) + if ((x = *(jp = ip)) != NULL) goto z; while (--jp >= output) - if ((x = *jp) != 0) { + if ((x = *jp) != NULL) { if (jp + x->length > ip) goto z; break; } jp = ip + 1; while (jp < iip) { - if ((x = *jp) == 0) { + if ((x = *jp) == NULL) { jp++; continue; } @@ -814,7 +814,7 @@ cc_compress(struct cc **output, struct cc **tokens, char flag) undop->pos = jp; undop->val = x; undop++; - *jp = 0; + *jp = NULL; x->ccount--; score_adjust(score0, x); if (score0 < 0 && flag) @@ -822,7 +822,7 @@ cc_compress(struct cc **output, struct cc **tokens, char flag) jp += x->length; } undop->pos = ip; - undop->val = 0; + undop->val = NULL; undop++; *ip = p; ccount++; @@ -849,7 +849,7 @@ cc_compress(struct cc **output, struct cc **tokens, char flag) x->ccount++; } } - } while ((p = *pp++) != 0); + } while ((p = *pp++) != NULL); return pp - tokens; } @@ -860,7 +860,7 @@ cc_output_phase(char *buffer, struct cc **output, int bufsize) struct cc *p, *p1; for (i = 0; i < bufsize;) { - if ((p = output[i]) == 0) { + if ((p = output[i]) == NULL) { ttputc(buffer[i]); i++; } else if (p->code >= 0) { diff --git a/usr.bin/window/context.c b/usr.bin/window/context.c index 11124d12fb..0585e06707 100644 --- a/usr.bin/window/context.c +++ b/usr.bin/window/context.c @@ -56,7 +56,7 @@ cx_alloc(void) if (cx.x_type != 0) { xp = (struct context *) malloc((unsigned) sizeof (struct context)); - if (xp == 0) + if (xp == NULL) return -1; *xp = cx; cx.x_link = xp; @@ -73,7 +73,7 @@ cx_free(void) { struct context *xp; - if ((xp = cx.x_link) != 0) { + if ((xp = cx.x_link) != NULL) { cx = *xp; free((char *)xp); } else diff --git a/usr.bin/window/error.c b/usr.bin/window/error.c index da3ff9330a..59aaab8bcc 100644 --- a/usr.bin/window/error.c +++ b/usr.bin/window/error.c @@ -55,9 +55,9 @@ verror(const char *fmt, va_list ap) struct context *x; struct ww *w; - for (x = &cx; x != 0 && x->x_type != X_FILE; x = x->x_link) + for (x = &cx; x != NULL && x->x_type != X_FILE; x = x->x_link) ; - if (x == 0) { + if (x == NULL) { if (terse) wwbell(); else { @@ -68,12 +68,12 @@ verror(const char *fmt, va_list ap) } if (x->x_noerr) return; - if ((w = x->x_errwin) == 0) { + if ((w = x->x_errwin) == NULL) { char buf[512]; (void) snprintf(buf, sizeof(buf), "Errors from %s", x->x_filename); - if ((w = x->x_errwin = openiwin(ERRLINES, buf)) == 0) { + if ((w = x->x_errwin = openiwin(ERRLINES, buf)) == NULL) { wwputs("Can't open error window. ", cmdwin); x->x_noerr = 1; return; diff --git a/usr.bin/window/lcmd1.c b/usr.bin/window/lcmd1.c index 4018790f56..3b3f2dcd5f 100644 --- a/usr.bin/window/lcmd1.c +++ b/usr.bin/window/lcmd1.c @@ -96,7 +96,7 @@ l_window(struct value *v, struct value *a) for (pp = argv; a->v_type != V_ERR && pp < &argv[sizeof argv/sizeof *argv-1]; pp++, a++) *pp = a->v_str; - *pp = 0; + *pp = NULL; shf = *(sh = argv); if ((*sh = strrchr(shf, '/'))) (*sh)++; @@ -108,7 +108,7 @@ l_window(struct value *v, struct value *a) } if ((w = openwin(id, row, col, nrow, ncol, nline, label, haspty ? WWT_PTY : WWT_SOCKET, hasframe ? WWU_HASFRAME : 0, shf, - sh)) == 0) + sh)) == NULL) return; if (mapnl) SET(w->ww_wflags, WWW_MAPNL); @@ -153,7 +153,7 @@ l_smooth(struct value *v, struct value *a) v->v_type = V_NUM; v->v_num = 0; - if ((w = vtowin(a++, selwin)) == 0) + if ((w = vtowin(a++, selwin)) == NULL) return; v->v_num = ISSET(w->ww_wflags, WWW_NOUPDATE) == 0; if (!vtobool(a, v->v_num, v->v_num)) @@ -189,7 +189,7 @@ l_select(struct value *v, struct value *a) v->v_num = selwin ? selwin->ww_id + 1 : -1; if (a->v_type == V_ERR) return; - if ((w = vtowin(a, (struct ww *)0)) == 0) + if ((w = vtowin(a, (struct ww *)0)) == NULL) return; setselwin(w); } @@ -239,7 +239,7 @@ l_label(struct value *v __unused, struct value *a) { struct ww *w; - if ((w = vtowin(a, selwin)) == 0) + if ((w = vtowin(a, selwin)) == NULL) return; if ((++a)->v_type != V_ERR && setlabel(w, a->v_str) < 0) error("Out of memory."); @@ -258,7 +258,7 @@ l_foreground(struct value *v, struct value *a) struct ww *w; char flag; - if ((w = vtowin(a, selwin)) == 0) + if ((w = vtowin(a, selwin)) == NULL) return; v->v_type = V_NUM; v->v_num = isfg(w); @@ -311,7 +311,7 @@ l_write(struct value *v __unused, struct value *a) char buf[20]; struct ww *w; - if ((w = vtowin(a++, selwin)) == 0) + if ((w = vtowin(a++, selwin)) == NULL) return; while (a->v_type != V_ERR) { if (a->v_type == V_NUM) { @@ -338,7 +338,7 @@ l_close(struct value *v __unused, struct value *a) closewin((struct ww *)0); else for (; a->v_type != V_ERR; a++) - if ((w = vtowin(a, (struct ww *)0)) != 0) + if ((w = vtowin(a, (struct ww *)0)) != NULL) closewin(w); } @@ -387,7 +387,7 @@ vtowin(struct value *v, struct ww *w) { switch (v->v_type) { case V_ERR: - if (w != 0) + if (w != NULL) return w; error("No window specified."); return 0; @@ -396,7 +396,7 @@ vtowin(struct value *v, struct ww *w) return 0; } if (v->v_num < 1 || v->v_num > NWINDOW - || (w = window[v->v_num - 1]) == 0) { + || (w = window[v->v_num - 1]) == NULL) { error("%d: No such window.", v->v_num); return 0; } diff --git a/usr.bin/window/lcmd2.c b/usr.bin/window/lcmd2.c index 6fb4a00b6d..1c28ff3412 100644 --- a/usr.bin/window/lcmd2.c +++ b/usr.bin/window/lcmd2.c @@ -52,7 +52,7 @@ l_iostat(struct value *v __unused, struct value *a __unused) { struct ww *w; - if ((w = openiwin(16, "IO Statistics")) == 0) { + if ((w = openiwin(16, "IO Statistics")) == NULL) { error("Can't open statistics window: %s.", wwerror()); return; } @@ -106,7 +106,7 @@ l_time(struct value *v __unused, struct value *a) struct rusage rusage; struct timeval timeval; - if ((w = openiwin(8, "Timing and Resource Usage")) == 0) { + if ((w = openiwin(8, "Timing and Resource Usage")) == NULL) { error("Can't open time window: %s.", wwerror()); return; } @@ -183,12 +183,12 @@ l_list(struct value *v __unused, struct value *a __unused) error("No windows."); return; } - if ((w = openiwin(n + 2, "Windows")) == 0) { + if ((w = openiwin(n + 2, "Windows")) == NULL) { error("Can't open listing window: %s.", wwerror()); return; } for (i = 0; i < NWINDOW; i++) { - if ((wp = window[i]) == 0) + if ((wp = window[i]) == NULL) continue; wwprintf(w, "%c %c %-13s %-.*s\n", wp == selwin ? '+' : (wp == lastselwin ? '-' : ' '), @@ -206,7 +206,7 @@ l_variable(struct value *v __unused, struct value *a __unused) { struct ww *w; - if ((w = openiwin(wwnrow - 3, "Variables")) == 0) { + if ((w = openiwin(wwnrow - 3, "Variables")) == NULL) { error("Can't open variable window: %s.", wwerror()); return; } @@ -256,7 +256,7 @@ l_def_shell(struct value *v, struct value *a) v->v_type = V_STR; for (pp = default_shell + 1; *pp; pp++) { str_free(*pp); - *pp = 0; + *pp = NULL; } } for (pp = default_shell, vp = a; @@ -264,7 +264,7 @@ l_def_shell(struct value *v, struct value *a) pp < &default_shell[sizeof default_shell/sizeof *default_shell-1]; pp++, vp++) if ((*pp = vp->v_type == V_STR ? - str_cpy(vp->v_str) : str_itoa(vp->v_num)) == 0) { + str_cpy(vp->v_str) : str_itoa(vp->v_num)) == NULL) { /* just leave default_shell[] the way it is */ p_memerror(); break; @@ -289,7 +289,7 @@ l_alias(struct value *v, struct value *a) if (a->v_type == V_ERR) { struct ww *w; - if ((w = openiwin(wwnrow - 3, "Aliases")) == 0) { + if ((w = openiwin(wwnrow - 3, "Aliases")) == NULL) { error("Can't open alias window: %s.", wwerror()); return; } @@ -297,7 +297,7 @@ l_alias(struct value *v, struct value *a) waitnl(w); closeiwin(w); } else { - struct alias *ap = 0; + struct alias *ap = NULL; if ((ap = alias_lookup(a->v_str))) { if ((v->v_str = str_cpy(ap->a_buf)) == 0) { @@ -315,7 +315,7 @@ l_alias(struct value *v, struct value *a) for (n = 0, vp = a + 1; vp->v_type != V_ERR; vp++, n++) for (p = vp->v_str; *p; p++, n++) ; - if ((str = str_alloc(n)) == 0) { + if ((str = str_alloc(n)) == NULL) { p_memerror(); return; } @@ -324,7 +324,7 @@ l_alias(struct value *v, struct value *a) for (p = vp->v_str; (*q++ = *p++);) ; q[-1] = 0; - if ((ap = alias_set(a[0].v_str, (char *)0)) == 0) { + if ((ap = alias_set(a[0].v_str, (char *)0)) == NULL) { p_memerror(); str_free(str); return; @@ -369,7 +369,7 @@ l_echo(struct value *v __unused, struct value *a) char buf[20]; struct ww *w; - if ((w = vtowin(a++, selwin)) == 0) + if ((w = vtowin(a++, selwin)) == NULL) return; while (a->v_type != V_ERR) { if (a->v_type == V_NUM) { diff --git a/usr.bin/window/main.c b/usr.bin/window/main.c index 969afa5b8c..5495d197e5 100644 --- a/usr.bin/window/main.c +++ b/usr.bin/window/main.c @@ -56,7 +56,7 @@ main(int argc, char **argv) char fflag = 0; char dflag = 0; char xflag = 0; - char *cmd = 0; + char *cmd = NULL; char tflag = 0; int ch; @@ -68,7 +68,7 @@ main(int argc, char **argv) fflag++; break; case 'c': - if (cmd != 0) { + if (cmd != NULL) { warnx("Only one -c allowed"); usage(); } @@ -93,7 +93,7 @@ main(int argc, char **argv) usage(); } } - if ((kp = getenv("SHELL")) == 0) + if ((kp = getenv("SHELL")) == NULL) kp = _PATH_BSHELL; if ((default_shellfile = str_cpy(kp)) == 0) errx(1, "Out of memory."); @@ -162,7 +162,7 @@ main(int argc, char **argv) setterse(tflag); setcmd(1); - if (cmd != 0) + if (cmd != NULL) (void) dolongcmd(cmd, (struct value *)0, 0); if (!fflag) if (dflag || doconfig() < 0) diff --git a/usr.bin/window/parser2.c b/usr.bin/window/parser2.c index 53696e9481..7d3d80245e 100644 --- a/usr.bin/window/parser2.c +++ b/usr.bin/window/parser2.c @@ -50,15 +50,15 @@ int p_function(const char *name, struct value *v, int flag) { struct value t; - struct lcmd_tab *c = 0; - struct alias *a = 0; + struct lcmd_tab *c = NULL; + struct alias *a = NULL; struct lcmd_arg *ap; /* this arg */ - struct lcmd_arg *lp = 0; /* list arg */ + struct lcmd_arg *lp = NULL; /* list arg */ int i; struct value av[LCMD_NARG + 1]; struct value *vp; - if (name != 0) { + if (name != NULL) { if ((c = lcmd_lookup(name))) name = c->lc_name; else if ((a = alias_lookup(name))) @@ -75,8 +75,8 @@ p_function(const char *name, struct value *v, int flag) (void) s_gettok(); i = 0; for (;;) { - ap = 0; - vp = 0; + ap = NULL; + vp = NULL; if (token == T_COMMA) /* null argument */ t.v_type = V_ERR; else { @@ -87,7 +87,7 @@ p_function(const char *name, struct value *v, int flag) } if (token != T_ASSIGN) { if (i >= LCMD_NARG || - (c != 0 && (ap = lp) == 0 && + (c != NULL && (ap = lp) == NULL && (ap = c->lc_arg + i)->arg_name == 0)) { p_error("%s: Too many arguments.", name); flag = 0; @@ -108,30 +108,30 @@ p_function(const char *name, struct value *v, int flag) if (t.v_type == V_ERR) flag = 0; if (tmp) { - if (c == 0) { + if (c == NULL) { /* an aliase */ p_error("%s: Bad alias syntax.", name); flag = 0; } else { for (ap = c->lc_arg, vp = av; - ap != 0 && ap->arg_name != 0 && + ap != NULL && ap->arg_name != 0 && (*ap->arg_name == '\0' || !str_match(tmp, ap->arg_name, ap->arg_minlen)); ap++, vp++) ; - if (ap == 0 || ap->arg_name == 0) { + if (ap == NULL || ap->arg_name == 0) { p_error("%s: Unknown argument \"%s\".", name, tmp); flag = 0; - ap = 0; - vp = 0; + ap = NULL; + vp = NULL; } } str_free(tmp); } } - if (ap != 0) { + if (ap != NULL) { if (ap->arg_flags & ARG_LIST) { i = vp - av + 1; lp = ap; @@ -145,7 +145,7 @@ p_function(const char *name, struct value *v, int flag) p_error("%s: Argument %d duplicated.", name, (int)(vp - av + 1)); flag = 0; - vp = 0; + vp = NULL; } else if (t.v_type == V_ERR) { /* do nothing */ } else if (((ap->arg_flags&ARG_TYPE) == ARG_NUM && @@ -160,10 +160,10 @@ p_function(const char *name, struct value *v, int flag) p_error("%s: Argument %d type mismatch.", name, (int)(vp - av + 1)); flag = 0; - vp = 0; + vp = NULL; } } - if (vp != 0) + if (vp != NULL) *vp = t; else val_free(t); @@ -179,7 +179,7 @@ p_function(const char *name, struct value *v, int flag) flag = 0; /* look for legal follow set */ v->v_type = V_ERR; if (flag) { - if (c != 0) + if (c != NULL) (*c->lc_func)(v, av); else { if (a->a_flags & A_INUSE) diff --git a/usr.bin/window/parser4.c b/usr.bin/window/parser4.c index d90510a738..10fd9bb244 100644 --- a/usr.bin/window/parser4.c +++ b/usr.bin/window/parser4.c @@ -52,7 +52,7 @@ p_expr3_10(int level, struct value *v, char flag) { struct value l, r; int op; - const char *opname = 0; + const char *opname = NULL; if ((level == 10 ? p_expr11(v, flag) : p_expr3_10(level + 1, v, flag)) < 0) diff --git a/usr.bin/window/parser5.c b/usr.bin/window/parser5.c index 267230e625..cb8103e245 100644 --- a/usr.bin/window/parser5.c +++ b/usr.bin/window/parser5.c @@ -108,8 +108,8 @@ p_expr11(struct value *v, char flag) struct var *r = var_lookup(name); if (op == T_DQ) { v->v_type = V_NUM; - v->v_num = r != 0; - } else if (r != 0) + v->v_num = r != NULL; + } else if (r != NULL) *v = r->r_val; else { p_error("%s: Undefined variable.", name); diff --git a/usr.bin/window/startup.c b/usr.bin/window/startup.c index 650063af4f..366fe04c81 100644 --- a/usr.bin/window/startup.c +++ b/usr.bin/window/startup.c @@ -46,7 +46,7 @@ doconfig(void) const char *home; static char runcom[] = RUNCOM; - if ((home = getenv("HOME")) == 0) + if ((home = getenv("HOME")) == NULL) home = "."; (void) sprintf(buf, "%.*s/%s", (int)((sizeof buf - sizeof runcom) / sizeof (char) - 1), @@ -69,7 +69,7 @@ dodefault(void) return; if ((w = openwin(0, 1, 0, r, wwncol, default_nline, (char *) 0, WWT_PTY, WWU_HASFRAME, default_shellfile, - default_shell)) == 0) + default_shell)) == NULL) return; wwprintf(w, "Escape character is %s.\r\n", unctrl(escapec)); } diff --git a/usr.bin/window/string.c b/usr.bin/window/string.c index 16b47b6a21..d4104f5477 100644 --- a/usr.bin/window/string.c +++ b/usr.bin/window/string.c @@ -47,7 +47,7 @@ str_cpy(const char *s) char *p; str = p = str_alloc(strlen(s) + 1); - if (p == 0) + if (p == NULL) return 0; while ((*p++ = *s++)) ; @@ -64,7 +64,7 @@ str_ncpy(const char *s, int n) if (n > l) n = l; str = p = str_alloc(n + 1); - if (p == 0) + if (p == NULL) return 0; while (--n >= 0) *p++ = *s++; @@ -89,7 +89,7 @@ str_cat(const char *s1, const char *s2) const char *q; str = p = str_alloc(strlen(s1) + strlen(s2) + 1); - if (p == 0) + if (p == NULL) return 0; for (q = s1; (*p++ = *q++);) ; @@ -117,7 +117,7 @@ str_alloc(size_t l) struct string *s; s = (struct string *) malloc(l + str_offset); - if (s == 0) + if (s == NULL) return 0; if (str_head.s_forw == 0) str_head.s_forw = str_head.s_back = &str_head; diff --git a/usr.bin/window/ttgeneric.c b/usr.bin/window/ttgeneric.c index 7de3845a6b..5decc8f77b 100644 --- a/usr.bin/window/ttgeneric.c +++ b/usr.bin/window/ttgeneric.c @@ -488,13 +488,13 @@ tt_generic(void) gen_LI = tgetnum("li"); gen_UG = tgetnum("ug"); gen_SG = tgetnum("sg"); - if (gen_CL == 0 || gen_OS || gen_CM == 0) + if (gen_CL == NULL || gen_OS || gen_CM == NULL) return -1; /* * Deal with obsolete termcap fields. */ - if (gen_LE == 0) { + if (gen_LE == NULL) { if (gen_BC) gen_LE = gen_BC; else if (gen_BS) { @@ -502,13 +502,13 @@ tt_generic(void) gen_BC = &bc; } } - if (gen_NL == 0) { + if (gen_NL == NULL) { static struct tt_str nl = { "\n", 1 }; gen_NL = &nl; } - if (gen_DO == 0) + if (gen_DO == NULL) gen_DO = gen_NL; - if (gen_CR == 0) { + if (gen_CR == NULL) { static struct tt_str cr = { "\r", 1 }; gen_CR = &cr; } @@ -516,7 +516,7 @@ tt_generic(void) * Most terminal will scroll with "nl", but very few specify "sf". * We shouldn't use "do" here. */ - if (gen_SF == 0 && !gen_NS) + if (gen_SF == NULL && !gen_NS) gen_SF = gen_NL; BC = gen_LE ? __DECONST(char *, gen_LE->ts_str) : 0; UP = gen_UP ? __DECONST(char *, gen_UP->ts_str) : 0; @@ -525,21 +525,21 @@ tt_generic(void) * really exist. */ if (gen_SG > 0) - gen_SO = 0; + gen_SO = NULL; if (gen_UG > 0 || (gen_US && gen_SO && ttstrcmp(gen_US, gen_SO) == 0)) - gen_US = 0; + gen_US = NULL; if (gen_IM && gen_IM->ts_n == 0) { free((char *) gen_IM); - gen_IM = 0; + gen_IM = NULL; } if (gen_EI && gen_EI->ts_n == 0) { free((char *) gen_EI); - gen_EI = 0; + gen_EI = NULL; } if (gen_IC && gen_IC->ts_n == 0) { free((char *) gen_IC); - gen_IC = 0; + gen_IC = NULL; } if (gen_IM) tt.tt_inschar = gen_inschar; diff --git a/usr.bin/window/ttinit.c b/usr.bin/window/ttinit.c index 868b676f83..7251a0f266 100644 --- a/usr.bin/window/ttinit.c +++ b/usr.bin/window/ttinit.c @@ -73,7 +73,7 @@ ttinit(void) * Set output buffer size to about 1 second of output time. */ i = MIN(wwbaud/10, 512); - if ((tt_ob = malloc((unsigned) i)) == 0) { + if ((tt_ob = malloc((unsigned) i)) == NULL) { wwerrno = WWE_NOMEM; return -1; } @@ -90,7 +90,7 @@ ttinit(void) p++; for (q = p; *q && *q != '|' && *q != ':'; q++) ; - if (q != p && (t = malloc((unsigned) (q - p + 1))) != 0) { + if (q != p && (t = malloc((unsigned) (q - p + 1))) != NULL) { wwterm = t; while (p < q) *t++ = *p++; diff --git a/usr.bin/window/tttermcap.c b/usr.bin/window/tttermcap.c index f26dc31012..d8df2bfe30 100644 --- a/usr.bin/window/tttermcap.c +++ b/usr.bin/window/tttermcap.c @@ -57,9 +57,9 @@ tttgetstr(const char *str) { struct tt_str *s; - if ((str = tgetstr(str, &tt_strp)) == 0) + if ((str = tgetstr(str, &tt_strp)) == NULL) return 0; - if ((s = (struct tt_str *) malloc(sizeof *s)) == 0) + if ((s = (struct tt_str *) malloc(sizeof *s)) == NULL) return 0; s->ts_str = str; s->ts_n = tt_strp - s->ts_str - 1; @@ -75,7 +75,7 @@ ttxgetstr(const char *str) if (tgetstr(str, &bufp) == 0) return 0; - if ((s = (struct tt_str *) malloc(sizeof *s)) == 0) + if ((s = (struct tt_str *) malloc(sizeof *s)) == NULL) return 0; s->ts_str = tt_strp; tputs(buf, 1, ttxputc); diff --git a/usr.bin/window/ttwyse60.c b/usr.bin/window/ttwyse60.c index d5bb78c379..f7704f0463 100644 --- a/usr.bin/window/ttwyse60.c +++ b/usr.bin/window/ttwyse60.c @@ -64,9 +64,9 @@ tt_wyse60(void) return -1; tt.tt_availmodes |= WWM_GRP; tt.tt_frame = wyse60_frame; - if (gen_AS == 0) + if (gen_AS == NULL) gen_AS = &as; - if (gen_AE == 0) + if (gen_AE == NULL) gen_AE = &ae; return 0; } diff --git a/usr.bin/window/ttwyse75.c b/usr.bin/window/ttwyse75.c index b0f50986e7..0ea507c821 100644 --- a/usr.bin/window/ttwyse75.c +++ b/usr.bin/window/ttwyse75.c @@ -64,9 +64,9 @@ tt_wyse75(void) return -1; tt.tt_availmodes |= WWM_GRP; tt.tt_frame = wyse75_frame; - if (gen_AS == 0) + if (gen_AS == NULL) gen_AS = &as; - if (gen_AE == 0) + if (gen_AE == NULL) gen_AE = &ae; return 0; } diff --git a/usr.bin/window/var.c b/usr.bin/window/var.c index 7967d4db31..9950410fba 100644 --- a/usr.bin/window/var.c +++ b/usr.bin/window/var.c @@ -53,9 +53,9 @@ var_set1(struct var **head, const char *name, struct value *v) if (val.v_type == V_STR && val.v_str != 0 && (val.v_str = str_cpy(val.v_str)) == 0) return 0; - if (*(p = var_lookup1(head, name)) == 0) { + if (*(p = var_lookup1(head, name)) == NULL) { r = (struct var *) malloc(sizeof (struct var)); - if (r == 0) { + if (r == NULL) { val_free(val); return 0; } @@ -100,11 +100,11 @@ var_unset1(struct var **head, const char *name) struct var **p; struct var *r; - if (*(p = var_lookup1(head, name)) == 0) + if (*(p = var_lookup1(head, name)) == NULL) return -1; r = *p; *p = r->r_left; - while (*p != 0) + while (*p != NULL) p = &(*p)->r_right; *p = r->r_right; val_free(r->r_val); @@ -118,7 +118,7 @@ var_lookup1(struct var **p, const char *name) { int cmp; - while (*p != 0) { + while (*p != NULL) { if ((cmp = strcmp(name, (*p)->r_name)) < 0) p = &(*p)->r_left; else if (cmp > 0) @@ -132,7 +132,7 @@ var_lookup1(struct var **p, const char *name) int var_walk1(struct var *r, int (*func) (void *, struct var *), void *a) { - if (r == 0) + if (r == NULL) return 0; if (var_walk1(r->r_left, func, a) < 0 || (*func)(a, r) < 0 || var_walk1(r->r_right, func, a) < 0) diff --git a/usr.bin/window/win.c b/usr.bin/window/win.c index 10e1fb437f..f5ae610d35 100644 --- a/usr.bin/window/win.c +++ b/usr.bin/window/win.c @@ -70,7 +70,7 @@ openwin(int id, int row, int col, int nrow, int ncol, int nline, char *label, in return 0; } w = wwopen(type, 0, nrow, ncol, row, col, nline); - if (w == 0) { + if (w == NULL) { error("Can't open window: %s.", wwerror()); return 0; } @@ -79,7 +79,7 @@ openwin(int id, int row, int col, int nrow, int ncol, int nline, char *label, in CLR(w->ww_uflags, WWU_ALLFLAGS); SET(w->ww_uflags, uflags); w->ww_alt = w->ww_w; - if (label != 0 && setlabel(w, label) < 0) + if (label != NULL && setlabel(w, label) < 0) error("No memory for label."); wwcursor(w, 1); /* @@ -115,12 +115,12 @@ findid(void) struct ww * findselwin(void) { - struct ww *w, *s = 0; + struct ww *w, *s = NULL; int i; for (i = 0; i < NWINDOW; i++) - if ((w = window[i]) != 0 && w != selwin && - (s == 0 || + if ((w = window[i]) != NULL && w != selwin && + (s == NULL || (!isfg(w) && (w->ww_order < s->ww_order || isfg(s))))) s = w; return s; @@ -135,12 +135,12 @@ closewin(struct ww *w) char didit = 0; int i; - if (w != 0) { + if (w != NULL) { closewin1(w); didit++; } else for (i = 0; i < NWINDOW; i++) { - if ((w = window[i]) == 0) + if ((w = window[i]) == NULL) continue; closewin1(w); didit++; @@ -168,7 +168,7 @@ openiwin(int nrow, const char *label) { struct ww *w; - if ((w = wwopen(WWT_INTERNAL, 0, nrow, wwncol, 2, 0, 0)) == 0) + if ((w = wwopen(WWT_INTERNAL, 0, nrow, wwncol, 2, 0, 0)) == NULL) return 0; SET(w->ww_wflags, WWW_MAPNL | WWW_NOINTR | WWW_NOUPDATE | WWW_UNCTRL); SET(w->ww_uflags, WWU_HASFRAME | WWU_CENTER); diff --git a/usr.bin/window/wwalloc.c b/usr.bin/window/wwalloc.c index 3a3243ea00..3863db73be 100644 --- a/usr.bin/window/wwalloc.c +++ b/usr.bin/window/wwalloc.c @@ -45,7 +45,7 @@ wwalloc(int row, int col, int nrow, int ncol, int size) /* fast, call malloc only once */ pp = (char **) malloc((unsigned) sizeof (char **) * nrow + size * nrow * ncol); - if (pp == 0) { + if (pp == NULL) { wwerrno = WWE_NOMEM; return 0; } diff --git a/usr.bin/window/wwinit.c b/usr.bin/window/wwinit.c index 6a563e5a1f..a462e76a0a 100644 --- a/usr.bin/window/wwinit.c +++ b/usr.bin/window/wwinit.c @@ -344,7 +344,7 @@ wwaddcap(const char *cap, char **kp) char *str; const char *p; - if ((str = tgetstr(cap, &tp)) != 0) { + if ((str = tgetstr(cap, &tp)) != NULL) { while ((*(*kp)++ = *cap++)) ; (*kp)[-1] = '='; diff --git a/usr.bin/window/wwiomux.c b/usr.bin/window/wwiomux.c index 2453f3c28d..12d199b906 100644 --- a/usr.bin/window/wwiomux.c +++ b/usr.bin/window/wwiomux.c @@ -212,7 +212,7 @@ wwiomux(void) * Update will eventually happen when output from wwcurwin * dies down. */ - if ((w = wwcurwin) != 0 && w->ww_pty >= 0 && + if ((w = wwcurwin) != NULL && w->ww_pty >= 0 && w->ww_obq > w->ww_obp && !ISSET(w->ww_pflags, WWP_STOPPED)) { int n = wwwrite(w, w->ww_obp, w->ww_obq - w->ww_obp); diff --git a/usr.bin/window/wwopen.c b/usr.bin/window/wwopen.c index 049f6b83c7..be32e7ba5e 100644 --- a/usr.bin/window/wwopen.c +++ b/usr.bin/window/wwopen.c @@ -49,7 +49,7 @@ wwopen(int type, int oflags, int nrow, int ncol, int row, int col, int nline) short nvis; w = (struct ww *)calloc(1, sizeof (struct ww)); - if (w == 0) { + if (w == NULL) { wwerrno = WWE_NOMEM; goto bad; } @@ -172,7 +172,7 @@ wwopen(int type, int oflags, int nrow, int ncol, int row, int col, int nline) SET(w->ww_oflags, oflags); return wwindex[w->ww_index] = w; bad: - if (w != 0) { + if (w != NULL) { if (w->ww_win != 0) wwfree(w->ww_win, w->ww_w.t); if (w->ww_fmap != 0) diff --git a/usr.bin/window/wwsize.c b/usr.bin/window/wwsize.c index 3a03de2150..62670ac8cc 100644 --- a/usr.bin/window/wwsize.c +++ b/usr.bin/window/wwsize.c @@ -44,32 +44,32 @@ wwsize(struct ww *w, int nrow, int ncol) { int i, j; int nline = 0; - union ww_char **buf = 0; - char **win = 0; - short *nvis = 0; - char **fmap = 0; + union ww_char **buf = NULL; + char **win = NULL; + short *nvis = NULL; + char **fmap = NULL; char m; /* * First allocate new buffers. */ win = wwalloc(w->ww_w.t, w->ww_w.l, nrow, ncol, sizeof (char)); - if (win == 0) + if (win == NULL) goto bad; if (w->ww_fmap != 0) { fmap = wwalloc(w->ww_w.t, w->ww_w.l, nrow, ncol, sizeof (char)); - if (fmap == 0) + if (fmap == NULL) goto bad; } if (nrow > w->ww_b.nr || ncol > w->ww_b.nc) { nline = MAX(w->ww_b.nr, nrow); buf = (union ww_char **) wwalloc(w->ww_b.t, w->ww_b.l, nline, ncol, sizeof (union ww_char)); - if (buf == 0) + if (buf == NULL) goto bad; } nvis = (short *)malloc((unsigned) nrow * sizeof (short)); - if (nvis == 0) { + if (nvis == NULL) { wwerrno = WWE_NOMEM; goto bad; } @@ -77,7 +77,7 @@ wwsize(struct ww *w, int nrow, int ncol) /* * Copy text buffer. */ - if (buf != 0) { + if (buf != NULL) { int b, r; b = w->ww_b.t + nline; @@ -102,7 +102,7 @@ wwsize(struct ww *w, int nrow, int ncol) */ wwfree((char **)w->ww_win, w->ww_w.t); w->ww_win = win; - if (buf != 0) { + if (buf != NULL) { wwfree((char **)w->ww_buf, w->ww_b.t); w->ww_buf = buf; } @@ -121,7 +121,7 @@ wwsize(struct ww *w, int nrow, int ncol) w->ww_w.nr = nrow; w->ww_w.nc = ncol; /* text buffer */ - if (buf != 0) { + if (buf != NULL) { w->ww_b.b = w->ww_b.t + nline; w->ww_b.r = w->ww_b.l + ncol; w->ww_b.nr = nline; @@ -153,7 +153,7 @@ wwsize(struct ww *w, int nrow, int ncol) for (j = w->ww_w.l; j < w->ww_w.r; j++) w->ww_win[i][j] = m; /* frame map */ - if (fmap != 0) + if (fmap != NULL) for (i = w->ww_w.t; i < w->ww_w.b; i++) for (j = w->ww_w.l; j < w->ww_w.r; j++) w->ww_fmap[i][j] = 0; @@ -175,11 +175,11 @@ wwsize(struct ww *w, int nrow, int ncol) (void) wwsetttysize(w->ww_pty, nrow, ncol); return 0; bad: - if (win != 0) + if (win != NULL) wwfree(win, w->ww_w.t); - if (fmap != 0) + if (fmap != NULL) wwfree(fmap, w->ww_w.t); - if (buf != 0) + if (buf != NULL) wwfree((char **)buf, w->ww_b.t); return -1; } diff --git a/usr.bin/window/wwunframe.c b/usr.bin/window/wwunframe.c index 0f9d4d3f8e..848bd0a813 100644 --- a/usr.bin/window/wwunframe.c +++ b/usr.bin/window/wwunframe.c @@ -52,7 +52,7 @@ wwunframe(struct ww *w) if (win[j] & WWM_GLS) continue; win[j] |= WWM_GLS; - if (fmap != 0) + if (fmap != NULL) fmap[j] = 0; if (smap[j] == w->ww_index) { smap[j] = WWX_NOBODY; diff --git a/usr.bin/window/wwwrite.c b/usr.bin/window/wwwrite.c index 781524f454..b30d091ac2 100644 --- a/usr.bin/window/wwwrite.c +++ b/usr.bin/window/wwwrite.c @@ -58,11 +58,11 @@ wwwrite(struct ww *w, const char *p, int n) int hascursor; const char *savep = p; const char *q = p + n; - const char *r = 0; - const char *s = 0; + const char *r = NULL; + const char *s = NULL; #ifdef lint - s = 0; /* define it before possible use */ + s = NULL; /* define it before possible use */ #endif hascursor = ISSET(w->ww_wflags, WWW_HASCURSOR); if (hascursor) @@ -72,7 +72,7 @@ wwwrite(struct ww *w, const char *p, int n) if (r && !*p) { p = r; q = s; - r = 0; + r = NULL; continue; } if (w->ww_wstate == 0 && @@ -107,7 +107,7 @@ wwwrite(struct ww *w, const char *p, int n) if (!*p && r) { p = r; q = s; - r = 0; + r = NULL; } else if (*p == '\t') { int tmp = 8 - ((i - w->ww_w.l) & 7); p++; diff --git a/usr.bin/window/xx.c b/usr.bin/window/xx.c index b77a807b45..7b1de8a9ff 100644 --- a/usr.bin/window/xx.c +++ b/usr.bin/window/xx.c @@ -83,7 +83,7 @@ xxreset1(void) { struct xx *xp, *xq; - for (xp = xx_head; xp != 0; xp = xq) { + for (xp = xx_head; xp != NULL; xp = xq) { xq = xp->link; xxfree(xp); } @@ -115,7 +115,7 @@ xxalloc(void) if (xxbufp > xxbufe) abort(); - if ((xp = xx_freelist) == 0) + if ((xp = xx_freelist) == NULL) /* XXX can't deal with failure */ xp = (struct xx *) malloc((unsigned) sizeof *xp); else @@ -141,7 +141,7 @@ xxmove(int row, int col) { struct xx *xp = xx_tail; - if (xp == 0 || xp->cmd != xc_move) { + if (xp == NULL || xp->cmd != xc_move) { xp = xxalloc(); xp->cmd = xc_move; } @@ -154,7 +154,7 @@ xxscroll(int dir, int top, int bot) { struct xx *xp = xx_tail; - if (xp != 0 && xp->cmd == xc_scroll && + if (xp != NULL && xp->cmd == xc_scroll && xp->arg1 == top && xp->arg2 == bot && ((xp->arg0 < 0 && dir < 0) || (xp->arg0 > 0 && dir > 0))) { xp->arg0 += dir; @@ -185,7 +185,7 @@ xxinsspace(int row, int col) { struct xx *xp = xx_tail; - if (xp != 0 && xp->cmd == xc_insspace && xp->arg0 == row && + if (xp != NULL && xp->cmd == xc_insspace && xp->arg0 == row && col >= xp->arg1 && col <= xp->arg1 + xp->arg2) { xp->arg2++; return; @@ -202,7 +202,7 @@ xxdelchar(int row, int col) { struct xx *xp = xx_tail; - if (xp != 0 && xp->cmd == xc_delchar && + if (xp != NULL && xp->cmd == xc_delchar && xp->arg0 == row && xp->arg1 == col) { xp->arg2++; return; diff --git a/usr.bin/window/xxflush.c b/usr.bin/window/xxflush.c index 8be5cdd67f..87287c0664 100644 --- a/usr.bin/window/xxflush.c +++ b/usr.bin/window/xxflush.c @@ -42,7 +42,7 @@ xxflush(int intr) { struct xx *xp, *xq; - for (xp = xx_head; xp != 0 && !(intr && wwinterrupt()); xp = xq) { + for (xp = xx_head; xp != NULL && !(intr && wwinterrupt()); xp = xq) { switch (xp->cmd) { case xc_move: if (xp->link == 0) @@ -84,7 +84,7 @@ xxflush(int intr) xq = xp->link; xxfree(xp); } - if ((xx_head = xp) == 0) { + if ((xx_head = xp) == NULL) { xx_tail = 0; xxbufp = xxbuf; } @@ -121,7 +121,7 @@ xxflush_scroll(struct xx *xp) * on vt100 style scrolling regions (I think). */ if (xp->arg0 > 0) { - if ((xq = xp->link) != 0 && xq->cmd == xc_scroll && + if ((xq = xp->link) != NULL && xq->cmd == xc_scroll && xp->arg2 == xq->arg2 && xq->arg0 < 0) { if (xp->arg1 < xq->arg1) { if (xp->arg2 - xp->arg0 <= xq->arg1) { diff --git a/usr.bin/yacc/error.c b/usr.bin/yacc/error.c index bc61a3bf1f..62a8fc3aff 100644 --- a/usr.bin/yacc/error.c +++ b/usr.bin/yacc/error.c @@ -35,7 +35,6 @@ * * @(#)error.c 5.3 (Berkeley) 6/1/90 * $FreeBSD: src/usr.bin/yacc/error.c,v 1.7 1999/08/28 01:07:59 peter Exp $ - * $DragonFly: src/usr.bin/yacc/error.c,v 1.5 2005/01/05 15:26:05 joerg Exp $ */ /* routines for printing error messages */ @@ -79,7 +78,7 @@ print_pos(const char *st_line, const char *st_cptr) { const char *s; - if (st_line == 0) return; + if (st_line == NULL) return; for (s = st_line; *s != '\n'; ++s) { if (isprint(*s) || *s == '\t') diff --git a/usr.bin/yacc/lr0.c b/usr.bin/yacc/lr0.c index f14044a0de..bb3b615a89 100644 --- a/usr.bin/yacc/lr0.c +++ b/usr.bin/yacc/lr0.c @@ -34,7 +34,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/yacc/lr0.c,v 1.6 1999/08/28 01:08:00 peter Exp $ - * $DragonFly: src/usr.bin/yacc/lr0.c,v 1.4 2004/04/07 20:43:24 cpressey Exp $ * * @(#)lr0.c 5.3 (Berkeley) 1/20/91 */ @@ -286,7 +285,7 @@ initialize_states(void) continue; p = (core *) MALLOC(sizeof(core) + i*sizeof(short)); - if (p == 0) no_space(); + if (p == NULL) no_space(); p->next = 0; p->link = 0; @@ -312,7 +311,7 @@ new_itemsets(void) int symbol; for (i = 0; i < nsyms; i++) - kernel_end[i] = 0; + kernel_end[i] = NULL; shiftcount = 0; isp = itemset; diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c index ef33a8f722..5135389b95 100644 --- a/usr.bin/yacc/main.c +++ b/usr.bin/yacc/main.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1989 The Regents of the University of California. All rights reserved. * @(#)main.c 5.5 (Berkeley) 5/24/93 * $FreeBSD: src/usr.bin/yacc/main.c,v 1.12 2000/01/10 20:26:24 kris Exp $ - * $DragonFly: src/usr.bin/yacc/main.c,v 1.6 2006/01/22 13:38:50 swildner Exp $ */ #include @@ -293,7 +292,7 @@ create_file_names(void) const char *tmpdir; tmpdir = getenv("TMPDIR"); - if (tmpdir == 0) tmpdir = "/tmp"; + if (tmpdir == NULL) tmpdir = "/tmp"; len = strlen(tmpdir); i = len + 17; @@ -301,11 +300,11 @@ create_file_names(void) ++i; action_file_name = MALLOC(i); - if (action_file_name == 0) no_space(); + if (action_file_name == NULL) no_space(); text_file_name = MALLOC(i); - if (text_file_name == 0) no_space(); + if (text_file_name == NULL) no_space(); union_file_name = MALLOC(i); - if (union_file_name == 0) no_space(); + if (union_file_name == NULL) no_space(); strcpy(action_file_name, tmpdir); strcpy(text_file_name, tmpdir); @@ -327,7 +326,7 @@ create_file_names(void) text_file_name[len + 5] = 't'; union_file_name[len + 5] = 'u'; - if (output_file_name != 0) + if (output_file_name != NULL) { file_prefix = output_file_name; len = strlen(file_prefix); @@ -336,7 +335,7 @@ create_file_names(void) { len = strlen(file_prefix); output_file_name = MALLOC(len + 7); - if (output_file_name == 0) + if (output_file_name == NULL) no_space(); strcpy(output_file_name, file_prefix); strcpy(output_file_name + len, OUTPUT_SUFFIX); @@ -345,7 +344,7 @@ create_file_names(void) if (rflag) { code_file_name = MALLOC(len + 8); - if (code_file_name == 0) + if (code_file_name == NULL) no_space(); strcpy(code_file_name, file_prefix); if (file_prefix == output_file_name) @@ -370,7 +369,7 @@ create_file_names(void) if (dflag) { defines_file_name = MALLOC(len + 7); - if (defines_file_name == 0) + if (defines_file_name == NULL) no_space(); strcpy(defines_file_name, file_prefix); if (file_prefix == output_file_name) @@ -388,7 +387,7 @@ create_file_names(void) if (vflag) { verbose_file_name = MALLOC(len + 8); - if (verbose_file_name == 0) + if (verbose_file_name == NULL) no_space(); strcpy(verbose_file_name, file_prefix); if (file_prefix == output_file_name) @@ -413,10 +412,10 @@ open_files(void) create_file_names(); - if (input_file == 0) + if (input_file == NULL) { input_file = fopen(input_file_name, "r"); - if (input_file == 0) + if (input_file == NULL) open_error(input_file_name); } @@ -440,34 +439,34 @@ open_files(void) } text_file = fopen(text_file_name, "w"); - if (text_file == 0) + if (text_file == NULL) open_error(text_file_name); if (vflag) { verbose_file = fopen(verbose_file_name, "w"); - if (verbose_file == 0) + if (verbose_file == NULL) open_error(verbose_file_name); } if (dflag) { defines_file = fopen(defines_file_name, "w"); - if (defines_file == 0) + if (defines_file == NULL) open_error(defines_file_name); union_file = fopen(union_file_name, "w"); - if (union_file == 0) + if (union_file == NULL) open_error(union_file_name); } output_file = fopen(output_file_name, "w"); - if (output_file == 0) + if (output_file == NULL) open_error(output_file_name); if (rflag) { code_file = fopen(code_file_name, "w"); - if (code_file == 0) + if (code_file == NULL) open_error(code_file_name); } else diff --git a/usr.bin/yacc/mkpar.c b/usr.bin/yacc/mkpar.c index a23800041c..b2b381d6ca 100644 --- a/usr.bin/yacc/mkpar.c +++ b/usr.bin/yacc/mkpar.c @@ -35,7 +35,6 @@ * * @(#)mkpar.c 5.3 (Berkeley) 1/20/91 * $FreeBSD: src/usr.bin/yacc/mkpar.c,v 1.10 1999/08/28 01:08:01 peter Exp $ - * $DragonFly: src/usr.bin/yacc/mkpar.c,v 1.5 2005/01/05 15:26:05 joerg Exp $ */ #include @@ -105,7 +104,7 @@ get_shifts(int stateno) int i, k; int symbol; - actions = 0; + actions = NULL; sp = shift_table[stateno]; if (sp) { @@ -159,7 +158,7 @@ add_reduce(action *actions, int ruleno, int symbol) { action *temp, *prev, *next; - prev = 0; + prev = NULL; for (next = actions; next && next->symbol < symbol; next = next->next) prev = next; @@ -218,7 +217,7 @@ unused_rules(void) action *p; rules_used = (short *) MALLOC(nrules*sizeof(short)); - if (rules_used == 0) no_space(); + if (rules_used == NULL) no_space(); for (i = 0; i < nrules; ++i) rules_used[i] = 0; diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c index 0cb11b1475..3d8cf9102a 100644 --- a/usr.bin/yacc/output.c +++ b/usr.bin/yacc/output.c @@ -34,7 +34,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/yacc/output.c,v 1.13.2.3 2001/10/05 03:03:14 obrien Exp $ - * $DragonFly: src/usr.bin/yacc/output.c,v 1.5 2005/01/05 15:26:05 joerg Exp $ * * @(#)output.c 5.7 (Berkeley) 5/24/93 */ @@ -965,12 +964,12 @@ output_debug(void) fprintf(code_file, "#define YYMAXTOKEN %d\n", max); symnam = MALLOC((max+1)*sizeof(char *)); - if (symnam == 0) no_space(); + if (symnam == NULL) no_space(); /* Note that it is not necessary to initialize the element */ /* symnam[max]. */ for (i = 0; i < max; ++i) - symnam[i] = 0; + symnam[i] = NULL; for (i = ntokens - 1; i >= 2; --i) symnam[symbol_value[i]] = symbol_name[i]; symnam[0] = "end-of-file"; @@ -1325,9 +1324,9 @@ increase_maxtable(int loc) do { newmax += 200; } while (newmax <= loc); table = (short *) REALLOC(table, newmax*sizeof(short)); - if (table == 0) no_space(); + if (table == NULL) no_space(); check = (short *) REALLOC(check, newmax*sizeof(short)); - if (check == 0) no_space(); + if (check == NULL) no_space(); for (l = maxtable; l < newmax; ++l) { table[l] = 0; diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c index d077b3cbaa..104c94e9f2 100644 --- a/usr.bin/yacc/reader.c +++ b/usr.bin/yacc/reader.c @@ -34,7 +34,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/yacc/reader.c,v 1.8.2.1 2001/10/05 03:00:44 obrien Exp $ - * $DragonFly: src/usr.bin/yacc/reader.c,v 1.5 2005/01/05 15:26:05 joerg Exp $ * * @(#)reader.c 5.7 (Berkeley) 1/20/91 */ @@ -122,7 +121,7 @@ cachec(int c) { cache_size += 256; cache = REALLOC(cache, cache_size); - if (cache == 0) no_space(); + if (cache == NULL) no_space(); } cache[cinc] = c; ++cinc; @@ -144,12 +143,12 @@ get_line(void) return; } - if (line == 0 || linesize != (LINESIZE + 1)) + if (line == NULL || linesize != (LINESIZE + 1)) { if (line) FREE(line); linesize = LINESIZE + 1; line = MALLOC(linesize); - if (line == 0) no_space(); + if (line == NULL) no_space(); } i = 0; @@ -162,7 +161,7 @@ get_line(void) { linesize += LINESIZE; line = REALLOC(line, linesize); - if (line == 0) no_space(); + if (line == NULL) no_space(); } c = getc(f); if (c == EOF) @@ -181,11 +180,11 @@ dup_line(void) { char *p, *s, *t; - if (line == 0) return (0); + if (line == NULL) return (0); s = line; while (*s != '\n') ++s; p = MALLOC(s - line + 1); - if (p == 0) no_space(); + if (p == NULL) no_space(); s = line; t = p; @@ -230,10 +229,10 @@ nextc(void) { const char *s; - if (line == 0) + if (line == NULL) { get_line(); - if (line == 0) + if (line == NULL) return (EOF); } @@ -244,7 +243,7 @@ nextc(void) { case '\n': get_line(); - if (line == 0) return (EOF); + if (line == NULL) return (EOF); s = cptr; break; @@ -273,7 +272,7 @@ nextc(void) else if (s[1] == '/') { get_line(); - if (line == 0) return (EOF); + if (line == NULL) return (EOF); s = cptr; break; } @@ -397,7 +396,7 @@ copy_text(void) if (*cptr == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_text(t_lineno, t_line, t_cptr); } if (!lflag) fprintf(f, line_format, lineno, input_file_name); @@ -442,7 +441,7 @@ loop: if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_string(s_lineno, s_line, s_cptr); } } @@ -488,7 +487,7 @@ loop: if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_comment(c_lineno, c_line, c_cptr); } } @@ -544,7 +543,7 @@ loop: case '\n': next_line: get_line(); - if (line == 0) unterminated_union(u_lineno, u_line, u_cptr); + if (line == NULL) unterminated_union(u_lineno, u_line, u_cptr); goto loop; case '{': @@ -588,7 +587,7 @@ loop: if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_string(s_lineno, s_line, s_cptr); } } @@ -643,7 +642,7 @@ loop: if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_comment(c_lineno, c_line, c_cptr); } } @@ -697,7 +696,7 @@ get_literal(void) { case '\n': get_line(); - if (line == 0) unterminated_string(s_lineno, s_line, s_cptr); + if (line == NULL) unterminated_string(s_lineno, s_line, s_cptr); continue; case '0': case '1': case '2': case '3': @@ -750,7 +749,7 @@ get_literal(void) n = cinc; s = MALLOC(n); - if (s == 0) no_space(); + if (s == NULL) no_space(); for (i = 0; i < n; ++i) s[i] = cache[i]; @@ -897,11 +896,11 @@ get_tag(void) tag_table = (char **) (tag_table ? REALLOC(tag_table, tagmax*sizeof(char *)) : MALLOC(tagmax*sizeof(char *))); - if (tag_table == 0) no_space(); + if (tag_table == NULL) no_space(); } s = MALLOC(cinc); - if (s == 0) no_space(); + if (s == NULL) no_space(); strcpy(s, cache); tag_table[ntags] = s; ++ntags; @@ -916,7 +915,7 @@ declare_tokens(int assoc) int c; bucket *bp; int value; - char *tag = 0; + char *tag = NULL; if (assoc != TOKEN) ++prec; @@ -1071,7 +1070,7 @@ read_declarations(void) cache_size = 256; cache = MALLOC(cache_size); - if (cache == 0) no_space(); + if (cache == NULL) no_space(); for (;;) { @@ -1124,19 +1123,19 @@ initialize_grammar(void) nitems = 4; maxitems = 300; pitem = (bucket **) MALLOC(maxitems*sizeof(bucket *)); - if (pitem == 0) no_space(); - pitem[0] = 0; - pitem[1] = 0; - pitem[2] = 0; - pitem[3] = 0; + if (pitem == NULL) no_space(); + pitem[0] = NULL; + pitem[1] = NULL; + pitem[2] = NULL; + pitem[3] = NULL; nrules = 3; maxrules = 100; plhs = (bucket **) MALLOC(maxrules*sizeof(bucket *)); - if (plhs == 0) no_space(); - plhs[0] = 0; - plhs[1] = 0; - plhs[2] = 0; + if (plhs == NULL) no_space(); + plhs[0] = NULL; + plhs[1] = NULL; + plhs[2] = NULL; rprec = (short *) MALLOC(maxrules*sizeof(short)); if (rprec == 0) no_space(); rprec[0] = 0; @@ -1155,7 +1154,7 @@ expand_items(void) { maxitems += 300; pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *)); - if (pitem == 0) no_space(); + if (pitem == NULL) no_space(); } @@ -1164,7 +1163,7 @@ expand_rules(void) { maxrules += 100; plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *)); - if (plhs == 0) no_space(); + if (plhs == NULL) no_space(); rprec = (short *) REALLOC(rprec, maxrules*sizeof(short)); if (rprec == 0) no_space(); rassoc = (char *) REALLOC(rassoc, maxrules*sizeof(char)); @@ -1207,7 +1206,7 @@ advance_to_start(void) if (!isalpha(c) && c != '_' && c != '.' && c != '_') syntax_error(lineno, line, cptr); bp = get_name(); - if (goal == 0) + if (goal == NULL) { if (bp->class == TERM) terminal_start(bp->name); @@ -1245,13 +1244,13 @@ end_rule(void) if (!last_was_action && plhs[nrules]->tag) { for (i = nitems - 1; pitem[i]; --i) continue; - if (pitem[i+1] == 0 || pitem[i+1]->tag != plhs[nrules]->tag) + if (pitem[i+1] == NULL || pitem[i+1]->tag != plhs[nrules]->tag) default_action_warning(); } last_was_action = 0; if (nitems >= maxitems) expand_items(); - pitem[nitems] = 0; + pitem[nitems] = NULL; ++nitems; ++nrules; } @@ -1389,7 +1388,7 @@ loop: if (ntags) { tag = plhs[nrules]->tag; - if (tag == 0) untyped_lhs(); + if (tag == NULL) untyped_lhs(); fprintf(f, "yyval.%s", tag); } else @@ -1406,7 +1405,7 @@ loop: if (i <= 0 || i > n) unknown_rhs(i); tag = pitem[nitems + i - n - 1]->tag; - if (tag == 0) untyped_rhs(i, pitem[nitems + i - n - 1]->name); + if (tag == NULL) untyped_rhs(i, pitem[nitems + i - n - 1]->name); fprintf(f, "yyvsp[%d].%s", i - n, tag); } else @@ -1486,7 +1485,7 @@ loop: if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_string(s_lineno, s_line, s_cptr); } } @@ -1530,7 +1529,7 @@ loop: if (c == '\n') { get_line(); - if (line == 0) + if (line == NULL) unterminated_comment(c_lineno, c_line, c_cptr); } } @@ -1626,7 +1625,7 @@ free_tags(void) { int i; - if (tag_table == 0) return; + if (tag_table == NULL) return; for (i = 0; i < ntags; ++i) { @@ -1647,7 +1646,7 @@ pack_names(void) for (bp = first_symbol; bp; bp = bp->next) name_pool_size += strlen(bp->name) + 1; name_pool = MALLOC(name_pool_size); - if (name_pool == 0) no_space(); + if (name_pool == NULL) no_space(); strcpy(name_pool, "$accept"); strcpy(name_pool+8, "$end"); @@ -1709,10 +1708,10 @@ pack_symbols(void) if (symbol_assoc == 0) no_space(); v = (bucket **) MALLOC(nsyms*sizeof(bucket *)); - if (v == 0) no_space(); + if (v == NULL) no_space(); - v[0] = 0; - v[start_symbol] = 0; + v[0] = NULL; + v[start_symbol] = NULL; i = 1; j = start_symbol + 1; diff --git a/usr.bin/yacc/symtab.c b/usr.bin/yacc/symtab.c index ee5091f514..bb8cc31d46 100644 --- a/usr.bin/yacc/symtab.c +++ b/usr.bin/yacc/symtab.c @@ -34,7 +34,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/yacc/symtab.c,v 1.6 1999/08/28 01:08:03 peter Exp $ - * $DragonFly: src/usr.bin/yacc/symtab.c,v 1.5 2005/01/05 15:26:05 joerg Exp $ * * @(#)symtab.c 5.3 (Berkeley) 6/1/90 */ @@ -78,7 +77,7 @@ make_bucket(const char *name) assert(name); bp = (bucket *) MALLOC(sizeof(bucket)); - if (bp == 0) no_space(); + if (bp == NULL) no_space(); bp->link = 0; bp->next = 0; bp->name = MALLOC(strlen(name) + 1); @@ -127,9 +126,9 @@ create_symbol_table(void) bucket *bp; symbol_table = (bucket **) MALLOC(TABLE_SIZE*sizeof(bucket *)); - if (symbol_table == 0) no_space(); + if (symbol_table == NULL) no_space(); for (i = 0; i < TABLE_SIZE; i++) - symbol_table[i] = 0; + symbol_table[i] = NULL; bp = make_bucket("error"); bp->index = 1; @@ -145,7 +144,7 @@ void free_symbol_table(void) { FREE(symbol_table); - symbol_table = 0; + symbol_table = NULL; } diff --git a/usr.bin/yacc/verbose.c b/usr.bin/yacc/verbose.c index 5bd148f273..46dcd4f937 100644 --- a/usr.bin/yacc/verbose.c +++ b/usr.bin/yacc/verbose.c @@ -34,7 +34,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.bin/yacc/verbose.c,v 1.6 1999/08/28 01:08:03 peter Exp $ - * $DragonFly: src/usr.bin/yacc/verbose.c,v 1.5 2005/01/05 15:26:05 joerg Exp $ * * @(#)verbose.c 5.3 (Berkeley) 1/20/91 */ @@ -63,7 +62,7 @@ verbose(void) if (!vflag) return; null_rules = (short *) MALLOC(nrules*sizeof(short)); - if (null_rules == 0) no_space(); + if (null_rules == NULL) no_space(); fprintf(verbose_file, "\f\n"); for (i = 0; i < nstates; i++) print_state(i); diff --git a/usr.sbin/IPXrouted/af.c b/usr.sbin/IPXrouted/af.c index 6994590aa2..8f57aea759 100644 --- a/usr.sbin/IPXrouted/af.c +++ b/usr.sbin/IPXrouted/af.c @@ -36,7 +36,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/IPXrouted/af.c,v 1.6 1999/08/28 01:15:01 peter Exp $ - * $DragonFly: src/usr.sbin/IPXrouted/af.c,v 1.4 2004/12/18 22:48:02 swildner Exp $ * * @(#)af.c 8.1 (Berkeley) 6/5/93 */ @@ -191,7 +190,7 @@ ipxnet_checkhost(struct sockaddr_ipx *sipx) * We want this route if there is no more than one * point to point interface with this network. */ - if (ifp == 0 || (ifp->int_flags & IFF_POINTOPOINT)==0) return (1); + if (ifp == NULL || (ifp->int_flags & IFF_POINTOPOINT)==0) return (1); return (ifp->int_sq.n == ifp->int_sq.p); } diff --git a/usr.sbin/IPXrouted/if.c b/usr.sbin/IPXrouted/if.c index 338b4f946e..515d2f8931 100644 --- a/usr.sbin/IPXrouted/if.c +++ b/usr.sbin/IPXrouted/if.c @@ -35,7 +35,6 @@ * static char sccsid[] = "@(#)if.c 5.1 (Berkeley) 6/4/85"; (routed/if.c) * * $FreeBSD: src/usr.sbin/IPXrouted/if.c,v 1.5 1999/08/28 01:15:02 peter Exp $ - * $DragonFly: src/usr.sbin/IPXrouted/if.c,v 1.3 2004/03/11 09:38:59 hmp Exp $ * * @(#)if.c 8.1 (Berkeley) 6/5/93 */ @@ -127,7 +126,7 @@ if_iflookup(struct sockaddr *addr) if (af >= AF_MAX) return (0); - maybe = 0; + maybe = NULL; netmatch = afswitch[af].af_netmatch; for (ifp = ifnet; ifp; ifp = ifp->int_next) { if (ifp->int_addr.sa_family != af) @@ -137,10 +136,10 @@ if_iflookup(struct sockaddr *addr) if ((ifp->int_flags & IFF_BROADCAST) && same(&ifp->int_broadaddr, addr)) break; - if (maybe == 0 && (*netmatch)(addr, &ifp->int_addr)) + if (maybe == NULL && (*netmatch)(addr, &ifp->int_addr)) maybe = ifp; } - if (ifp == 0) + if (ifp == NULL) ifp = maybe; return (ifp); } diff --git a/usr.sbin/IPXrouted/input.c b/usr.sbin/IPXrouted/input.c index 93913e5ee6..0bb6e2b0cc 100644 --- a/usr.sbin/IPXrouted/input.c +++ b/usr.sbin/IPXrouted/input.c @@ -36,7 +36,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/IPXrouted/input.c,v 1.7 1999/08/28 01:15:02 peter Exp $ - * $DragonFly: src/usr.sbin/IPXrouted/input.c,v 1.3 2004/03/11 09:38:59 hmp Exp $ * * @(#)input.c 8.1 (Berkeley) 6/5/93 */ @@ -69,13 +68,13 @@ rip_input(struct sockaddr *from, int size) int rtchanged = 0; struct rt_entry *rt; struct netinfo *n; - struct interface *ifp = 0; + struct interface *ifp = NULL; struct afswitch *afp; struct sockaddr_ipx *ipxp; ifp = if_ifwithnet(from); ipxp = (struct sockaddr_ipx *)from; - if (ifp == 0) { + if (ifp == NULL) { if(ftrace) { fprintf(ftrace, "Received bogus packet from %s\n", ipxdp_ntoa(&ipxp->sipx_addr)); @@ -133,7 +132,7 @@ rip_input(struct sockaddr *from, int size) * found. The specs is a bit vague here. I'm not * sure what we should do. */ - if (rt == 0) + if (rt == NULL) return; /* XXX * According to the spec we should not include @@ -142,7 +141,7 @@ rip_input(struct sockaddr *from, int size) */ if (rt->rt_metric == (HOPCNT_INFINITY-1)) return; - n->rip_metric = htons( rt == 0 ? HOPCNT_INFINITY : + n->rip_metric = htons( rt == NULL ? HOPCNT_INFINITY : min(rt->rt_metric+1, HOPCNT_INFINITY)); n->rip_ticks = htons(rt->rt_ticks+1); @@ -174,7 +173,7 @@ rip_input(struct sockaddr *from, int size) TRACE_OUTPUT(ifp, from, newsize); if (ftrace) { /* XXX This should not happen anymore. */ - if(ifp == 0) + if(ifp == NULL) fprintf(ftrace, "--- ifp = 0\n"); else fprintf(ftrace, @@ -190,9 +189,9 @@ rip_input(struct sockaddr *from, int size) return; (*afp->af_canon)(from); /* are we talking to ourselves? */ - if ((ifp = if_ifwithaddr(from)) != 0) { + if ((ifp = if_ifwithaddr(from)) != NULL) { rt = rtfind(from); - if (rt == 0 || (rt->rt_state & RTS_INTERFACE) == 0) { + if (rt == NULL || (rt->rt_state & RTS_INTERFACE) == 0) { addrouteforif(ifp); rtchanged = 1; } else @@ -206,7 +205,7 @@ rip_input(struct sockaddr *from, int size) if ((rt = rtfind(from)) && (rt->rt_state & RTS_INTERFACE)) { if(ftrace) fprintf(ftrace, "Got route\n"); rt->rt_timer = 0; - } else if ((ifp = if_ifwithdstaddr(from)) != 0) { + } else if ((ifp = if_ifwithdstaddr(from)) != NULL) { if(ftrace) fprintf(ftrace, "Got partner\n"); addrouteforif(ifp); rtchanged = 1; @@ -218,7 +217,7 @@ rip_input(struct sockaddr *from, int size) if ((unsigned) ntohs(n->rip_metric) > HOPCNT_INFINITY) continue; rt = rtfind(sa = ipx_nettosa(n->rip_dst)); - if (rt == 0) { + if (rt == NULL) { if (ntohs(n->rip_metric) == HOPCNT_INFINITY) continue; rtadd(sa, from, ntohs(n->rip_metric), diff --git a/usr.sbin/IPXrouted/sap_input.c b/usr.sbin/IPXrouted/sap_input.c index 787bc343eb..1aa9e57e74 100644 --- a/usr.sbin/IPXrouted/sap_input.c +++ b/usr.sbin/IPXrouted/sap_input.c @@ -29,7 +29,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/IPXrouted/sap_input.c,v 1.7 1999/08/28 01:15:04 peter Exp $ - * $DragonFly: src/usr.sbin/IPXrouted/sap_input.c,v 1.3 2004/03/11 09:38:59 hmp Exp $ */ /* @@ -49,13 +48,13 @@ sap_input(struct sockaddr *from, int size) int sapchanged = 0; struct sap_entry *sap; struct sap_info *n; - struct interface *ifp = 0; + struct interface *ifp = NULL; struct afswitch *afp; struct sockaddr_ipx *ipxp; ifp = if_ifwithnet(from); ipxp = (struct sockaddr_ipx *)from; - if (ifp == 0) { + if (ifp == NULL) { if(ftrace) { fprintf(ftrace, "Received bogus packet from %s\n", ipxdp_ntoa(&ipxp->sipx_addr)); @@ -144,7 +143,7 @@ sap_input(struct sockaddr *from, int size) if (ntohs(n->hops) > HOPCNT_INFINITY) continue; sap = sap_lookup(n->ServType, n->ServName); - if (sap == 0) { + if (sap == NULL) { if (ntohs(n->hops) == HOPCNT_INFINITY) continue; sap_add(n, from); diff --git a/usr.sbin/IPXrouted/startup.c b/usr.sbin/IPXrouted/startup.c index a2fcb7dad8..0945ea6f4f 100644 --- a/usr.sbin/IPXrouted/startup.c +++ b/usr.sbin/IPXrouted/startup.c @@ -117,7 +117,7 @@ ifinit(void) char *buf, *cplim, *cp; struct if_msghdr *ifm; struct ifa_msghdr *ifam; - struct sockaddr_dl *sdl = 0; + struct sockaddr_dl *sdl = NULL; mib[0] = CTL_NET; mib[1] = PF_ROUTE; @@ -194,7 +194,7 @@ ifinit(void) continue; ifp = (struct interface *) malloc(sdl->sdl_nlen + 1 + sizeof(ifs)); - if (ifp == 0) { + if (ifp == NULL) { syslog(LOG_ERR, "IPXrouted: out of memory\n"); lookforinterfaces = 1; break; diff --git a/usr.sbin/IPXrouted/tables.c b/usr.sbin/IPXrouted/tables.c index 77aeb15118..8d34509eaf 100644 --- a/usr.sbin/IPXrouted/tables.c +++ b/usr.sbin/IPXrouted/tables.c @@ -33,7 +33,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/IPXrouted/tables.c,v 1.7 1999/08/28 01:15:05 peter Exp $ - * $DragonFly: src/usr.sbin/IPXrouted/tables.c,v 1.3 2004/03/11 09:38:59 hmp Exp $ * * @(#)tables.c 8.1 (Berkeley) 6/5/93 */ @@ -95,7 +94,7 @@ rtfind(struct sockaddr *dst) u_int hash; struct afhash h; int af = dst->sa_family; - int (*match)() = 0; + int (*match)() = NULL; if (af >= AF_MAX) return (0); @@ -133,7 +132,7 @@ rtadd(struct sockaddr *dst, struct sockaddr *gate, short metric, short ticks, hash = h.afh_nethash; rh = &nethash[hash & ROUTEHASHMASK]; rt = (struct rt_entry *)malloc(sizeof (*rt)); - if (rt == 0) + if (rt == NULL) return; rt->rt_hash = hash; rt->rt_dst = *dst; @@ -184,7 +183,7 @@ rtadd_clone(struct rt_entry *ort, struct sockaddr *dst, struct sockaddr *gate, hash = h.afh_nethash; rh = &nethash[hash & ROUTEHASHMASK]; rt = (struct rt_entry *)malloc(sizeof (*rt)); - if (rt == 0) + if (rt == NULL) return; rt->rt_hash = hash; rt->rt_dst = *dst; diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 6948cc60bc..1518af83f6 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1984, 1993 The Regents of the University of California. All rights reserved. * @(#)from: arp.c 8.2 (Berkeley) 1/2/94 * $FreeBSD: src/usr.sbin/arp/arp.c,v 1.22.2.12 2003/04/16 10:02:37 ru Exp $ - * $DragonFly: src/usr.sbin/arp/arp.c,v 1.11 2008/02/03 00:41:44 swildner Exp $ */ /* @@ -515,7 +514,7 @@ print_entry(struct sockaddr_dl *sdl, hp = gethostbyaddr(&(addr->sin_addr), sizeof(addr->sin_addr), AF_INET); else - hp = 0; + hp = NULL; if (hp) host = hp->h_name; else { diff --git a/usr.sbin/cdcontrol/cdcontrol.c b/usr.sbin/cdcontrol/cdcontrol.c index e6d7561e27..97c3d34750 100644 --- a/usr.sbin/cdcontrol/cdcontrol.c +++ b/usr.sbin/cdcontrol/cdcontrol.c @@ -18,7 +18,6 @@ * Some code style reformatting. * * $FreeBSD: src/usr.sbin/cdcontrol/cdcontrol.c,v 1.24.2.11 2002/11/20 00:26:19 njl Exp $ - * $DragonFly: src/usr.sbin/cdcontrol/cdcontrol.c,v 1.11 2006/09/26 17:32:09 dillon Exp $ */ #include @@ -796,7 +795,7 @@ pstatus(char *arg) char *p, vmcn[(4 * 15) + 1]; while ((p = strtok(arg, " \t"))) { - arg = 0; + arg = NULL; if (!strncasecmp(p, "audio", strlen(p))) what |= STATUS_AUDIO; else if (!strncasecmp(p, "media", strlen(p))) diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c index 7381689aa0..cddb981eaa 100644 --- a/usr.sbin/config/mkheaders.c +++ b/usr.sbin/config/mkheaders.c @@ -32,7 +32,6 @@ * * @(#)mkheaders.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/mkheaders.c,v 1.14.2.2 2001/01/23 00:09:32 peter Exp $ - * $DragonFly: src/usr.sbin/config/mkheaders.c,v 1.13 2005/01/12 00:26:03 cpressey Exp $ */ /* @@ -198,7 +197,7 @@ do_header(const char *dev, char *hname, int count) fl_head = fl; } outf = fopen(file, "w"); - if (outf == 0) + if (outf == NULL) err(1, "%s", file); for (fl = fl_head; fl != NULL; fl = tflp) { fprintf(outf, diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index ec11f9f137..f8b978c3f9 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -287,7 +287,7 @@ next: } return; } - if (wd == 0) + if (wd == NULL) goto next; if (wd[0] == '#') { @@ -297,7 +297,7 @@ next: } this = strdup(wd); next_word(fp, wd); - if (wd == 0) { + if (wd == NULL) { printf("%s: No type for %s.\n", fname, this); exit(1); @@ -306,7 +306,7 @@ next: isdup = 1; else isdup = 0; - tp = 0; + tp = NULL; if (first == 3 && pf == NULL && (tp = fltail_lookup(this)) != NULL) { if (tp->f_type != INVISIBLE || tp->f_flags) printf("%s: Local file %s overrides %s.\n", @@ -435,7 +435,7 @@ nextparam: filetype = PROFILING; goto nextparam; } - if (needs == 0 && nreqs == 1) + if (needs == NULL && nreqs == 1) needs = strdup(wd); if (isdup) goto invis; @@ -476,7 +476,7 @@ nextparam: exit(1); } invis: - while ((wd = get_word(fp)) != 0) + while ((wd = get_word(fp)) != NULL) ; if (tp == NULL) tp = new_fent(); @@ -686,7 +686,7 @@ tail(char *fn) char *cp; cp = strrchr(fn, '/'); - if (cp == 0) + if (cp == NULL) return(fn); return(cp + 1); } diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index 43da8605ed..9e242972b9 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -33,7 +33,6 @@ * * @(#)mkheaders.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/config/mkoptions.c,v 1.17.2.3 2001/12/13 19:18:01 dillon Exp $ - * $DragonFly: src/usr.sbin/config/mkoptions.c,v 1.19 2007/01/19 07:23:43 dillon Exp $ */ /* @@ -232,7 +231,7 @@ do_option(char *name) } outf = fopen(file, "w"); - if (outf == 0) + if (outf == NULL) err(1, "%s", file); for (op = op_head; op != NULL; op = topp) { /* was the option in the config file? */ @@ -333,7 +332,7 @@ next: val = get_word(fp); if (val == (char *)EOF) return; - if (val == 0) { + if (val == NULL) { char *s; s = strdup(this); diff --git a/usr.sbin/cron/cron/popen.c b/usr.sbin/cron/cron/popen.c index fe0cad5419..aa8515ab70 100644 --- a/usr.sbin/cron/cron/popen.c +++ b/usr.sbin/cron/cron/popen.c @@ -19,7 +19,6 @@ * * @(#)popen.c 5.7 (Berkeley) 2/14/89 * $FreeBSD: src/usr.sbin/cron/cron/popen.c,v 1.7.2.3 2000/12/11 01:03:31 obrien Exp $ - * $DragonFly: src/usr.sbin/cron/cron/popen.c,v 1.5 2004/12/18 22:48:03 swildner Exp $ */ /* this came out of the ftpd sources; it's been modified to avoid the @@ -220,7 +219,7 @@ cron_pclose(FILE *iop) * pclose returns -1 if stream is not associated with a * `popened' command, or, if already `pclosed'. */ - if (pids == 0 || pids[fdes = fileno(iop)] == 0) + if (pids == NULL || pids[fdes = fileno(iop)] == 0) return(-1); fclose(iop); omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index c33cca6cee..0d4d331660 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -27,7 +27,6 @@ * * From BSDI: daemon.c,v 1.2 1996/08/15 01:11:09 jch Exp * $FreeBSD: src/usr.sbin/daemon/daemon.c,v 1.1.2.1 2002/08/28 17:25:54 sheldonh Exp $ - * $DragonFly: src/usr.sbin/daemon/daemon.c,v 1.4 2004/12/21 23:30:57 liamfoy Exp $ */ #include @@ -49,7 +48,7 @@ main(int argc, char *argv[]) nochdir = noclose = 1; pidfile = NULL; - pidf = 0; + pidf = NULL; while ((ch = getopt(argc, argv, "cfp:")) != -1) { switch (ch) { case 'c': diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index 1830014393..12f4f74fa1 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -391,7 +391,7 @@ getprivs(long id, int quotatype, char *fspath) else quptail->next = qup; quptail = qup; - qup->next = 0; + qup->next = NULL; } endfsent(); return (quphead); diff --git a/usr.sbin/gifconfig/gifconfig.c b/usr.sbin/gifconfig/gifconfig.c index 1eb2054274..fd6ec4bd36 100644 --- a/usr.sbin/gifconfig/gifconfig.c +++ b/usr.sbin/gifconfig/gifconfig.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/usr.sbin/gifconfig/gifconfig.c,v 1.2.2.4 2002/08/30 14:23:39 sobomax Exp $ */ -/* $DragonFly: src/usr.sbin/gifconfig/gifconfig.c,v 1.6 2004/03/24 18:23:46 cpressey Exp $ */ /* $KAME: gifconfig.c,v 1.14 2001/01/01 04:04:56 jinmei Exp $ */ /* @@ -388,7 +387,7 @@ ifconfig(int argc, char **argv, int af, struct afswtch *rafp) for (p = cmds; p->c_name; p++) if (strcmp(*argv, p->c_name) == 0) break; - if (p->c_name == 0 && setpsrc) + if (p->c_name == NULL && setpsrc) p++; /* got src, do dst */ if (p->c_func) { if (p->c_parameter == NEXTARG) { diff --git a/usr.sbin/inetd/builtins.c b/usr.sbin/inetd/builtins.c index 85a86ff55d..064b2e4ba5 100644 --- a/usr.sbin/inetd/builtins.c +++ b/usr.sbin/inetd/builtins.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/inetd/builtins.c,v 1.19.2.7 2002/07/22 14:05:56 fanf Exp $ - * $DragonFly: src/usr.sbin/inetd/builtins.c,v 1.5 2004/12/18 22:48:03 swildner Exp $ * */ @@ -127,7 +126,7 @@ chargen_dg(int s, struct servtab *sep) /* Character generator */ socklen_t size; char text[LINESIZ+2]; - if (endring == 0) { + if (endring == NULL) { initring(); rs = ring; } diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 8bf3f93341..004e47ede2 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1983, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)from: inetd.c 8.4 (Berkeley) 4/13/94 * $FreeBSD: src/usr.sbin/inetd/inetd.c,v 1.80.2.11 2003/04/05 13:39:18 dwmalone Exp $ - * $DragonFly: src/usr.sbin/inetd/inetd.c,v 1.11 2008/05/23 23:40:59 swildner Exp $ */ /* @@ -986,7 +985,7 @@ config(void) sep->se_socktype == new->se_socktype && sep->se_family == new->se_family) break; - if (sep != 0) { + if (sep != NULL) { int i; #define SWAP(a, b) { typeof(a) c = a; a = b; b = c; } @@ -1068,7 +1067,7 @@ config(void) if (!sep->se_rpc) { if (sep->se_family != AF_UNIX) { sp = getservbyname(sep->se_service, sep->se_proto); - if (sp == 0) { + if (sp == NULL) { syslog(LOG_ERR, "%s/%s: unknown service", sep->se_service, sep->se_proto); sep->se_checked = 0; @@ -1098,7 +1097,7 @@ config(void) close_sep(sep); } else { rpc = getrpcbyname(sep->se_service); - if (rpc == 0) { + if (rpc == NULL) { syslog(LOG_ERR, "%s/%s unknown RPC service", sep->se_service, sep->se_proto); if (sep->se_fd != -1) diff --git a/usr.sbin/kernbb/kernbb.c b/usr.sbin/kernbb/kernbb.c index 279efa9382..4270237e73 100644 --- a/usr.sbin/kernbb/kernbb.c +++ b/usr.sbin/kernbb/kernbb.c @@ -7,7 +7,6 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/usr.sbin/kernbb/kernbb.c,v 1.11.2.1 2001/07/19 04:17:03 kris Exp $ - * $DragonFly: src/usr.sbin/kernbb/kernbb.c,v 1.3 2003/11/16 15:17:36 eirikn Exp $ */ #include @@ -129,8 +128,8 @@ main(int argc __unused, char **argv __unused) free(pn[i]); if (file[i] && fn[i]) free(fn[i]); - pn[i] = 0; - fn[i] = 0; + pn[i] = NULL; + fn[i] = NULL; } } return 0; diff --git a/usr.sbin/kgmon/kgmon.c b/usr.sbin/kgmon/kgmon.c index a8d5843299..8893f5a40d 100644 --- a/usr.sbin/kgmon/kgmon.c +++ b/usr.sbin/kgmon/kgmon.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1983, 1992, 1993 The Regents of the University of California. All rights reserved. * @(#)kgmon.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/kgmon/kgmon.c,v 1.9 1999/08/28 01:16:42 peter Exp $ - * $DragonFly: src/usr.sbin/kgmon/kgmon.c,v 1.7 2008/04/20 13:44:26 swildner Exp $ */ #include @@ -314,7 +313,7 @@ dumpstate(struct kvmvars *kvp) setprof(kvp, GMON_PROF_OFF); fp = fopen("gmon.out", "w"); - if (fp == 0) { + if (fp == NULL) { warn("gmon.out"); return; } diff --git a/usr.sbin/lpr/chkprintcap/chkprintcap.c b/usr.sbin/lpr/chkprintcap/chkprintcap.c index 9baf536929..13356f0f49 100644 --- a/usr.sbin/lpr/chkprintcap/chkprintcap.c +++ b/usr.sbin/lpr/chkprintcap/chkprintcap.c @@ -28,7 +28,6 @@ * * @(#) Copyright (C) 1997, Massachusetts Institute of Technology * $FreeBSD: src/usr.sbin/lpr/chkprintcap/chkprintcap.c,v 1.3.2.2 2002/04/18 20:45:23 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/chkprintcap/chkprintcap.c,v 1.2 2003/06/17 04:29:55 dillon Exp $ */ #include @@ -220,7 +219,7 @@ note_spool_dir(const struct printer *pp, const struct stat *st) struct dirlist *dp, *dp2, *last; dp = malloc(sizeof *dp); - if (dp == 0) + if (dp == NULL) err(++problems, "malloc(%lu)", (u_long)sizeof *dp); dp->stab = *st; @@ -231,7 +230,7 @@ note_spool_dir(const struct printer *pp, const struct stat *st) if (dp->path == 0) err(++problems, "malloc(%lu)", strlen(pp->spool_dir) + 1UL); - last = 0; + last = NULL; LIST_FOREACH(dp2, &dirlist, link) { if(!lessp(dp, dp2)) break; @@ -253,7 +252,7 @@ check_spool_dirs(void) for (dp = LIST_FIRST(&dirlist); dp; dp = dp2) { dp2 = LIST_NEXT(dp, link); - if (dp2 != 0 && equal(dp, dp2)) { + if (dp2 != NULL && equal(dp, dp2)) { ++problems; if (strcmp(dp->path, dp2->path) == 0) { warnx("%s and %s share the same spool, %s", @@ -287,7 +286,7 @@ make_spool_dir(const struct printer *pp) return; } gr = getgrnam("daemon"); - if (gr == 0) + if (gr == NULL) errx(++problems, "cannot locate daemon group"); if (chown(sd, pp->daemon_user, gr->gr_gid) < 0) { diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index 3b56a6dc5c..7c371aed0b 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -37,7 +37,6 @@ * * @(#)common.c 8.5 (Berkeley) 4/28/95 * $FreeBSD: src/usr.sbin/lpr/common_source/common.c,v 1.12.2.17 2002/07/14 23:58:52 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/common_source/common.c,v 1.4 2004/12/18 22:48:03 swildner Exp $ */ #include @@ -224,7 +223,7 @@ lock_file_name(const struct printer *pp, char *buf, size_t len) { static char staticbuf[MAXPATHLEN]; - if (buf == 0) + if (buf == NULL) buf = staticbuf; if (len == 0) len = MAXPATHLEN; @@ -242,7 +241,7 @@ status_file_name(const struct printer *pp, char *buf, size_t len) { static char staticbuf[MAXPATHLEN]; - if (buf == 0) + if (buf == NULL) buf = staticbuf; if (len == 0) len = MAXPATHLEN; diff --git a/usr.sbin/lpr/common_source/net.c b/usr.sbin/lpr/common_source/net.c index de74d28fa0..b582866056 100644 --- a/usr.sbin/lpr/common_source/net.c +++ b/usr.sbin/lpr/common_source/net.c @@ -38,7 +38,6 @@ * From: @(#)common.c 8.5 (Berkeley) 4/28/95 * * $FreeBSD: src/usr.sbin/lpr/common_source/net.c,v 1.3.2.4 2001/06/25 01:00:56 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/common_source/net.c,v 1.3 2004/12/18 22:48:03 swildner Exp $ */ #include @@ -281,7 +280,7 @@ writel(int strm, ...) if (n > NIOV) { iovp = malloc(n * sizeof *iovp); - if (iovp == 0) + if (iovp == NULL) return -1; } diff --git a/usr.sbin/lpr/common_source/printcap.c b/usr.sbin/lpr/common_source/printcap.c index 3143b233a9..18ad030683 100644 --- a/usr.sbin/lpr/common_source/printcap.c +++ b/usr.sbin/lpr/common_source/printcap.c @@ -38,7 +38,6 @@ * From: @(#)common.c 8.5 (Berkeley) 4/28/95 * * $FreeBSD: src/usr.sbin/lpr/common_source/printcap.c,v 1.6.2.3 2002/04/28 23:29:10 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/common_source/printcap.c,v 1.3 2004/03/22 22:32:50 cpressey Exp $ */ #include @@ -216,7 +215,7 @@ getprintcap_int(char *bp, struct printer *pp) char *rp_name; int error; - if ((pp->printer = capdb_canonical_name(bp)) == 0) + if ((pp->printer = capdb_canonical_name(bp)) == NULL) return PCAPERR_OSERR; #define CHK(x) do {if ((x) == PCAPERR_OSERR) return PCAPERR_OSERR;}while(0) @@ -381,7 +380,7 @@ capdb_getaltstr(char *bp, const char *shrt, const char *lng, return status; if (dflt) { *result = strdup(dflt); - if (*result == 0) + if (*result == NULL) return PCAPERR_OSERR; return strlen(*result); } @@ -434,9 +433,9 @@ capdb_canonical_name(const char *bp) const char *nameend; nameend = strpbrk(bp, "|:"); - if (nameend == 0) + if (nameend == NULL) nameend = bp + 1; - if ((retval = malloc(nameend - bp + 1)) != 0) { + if ((retval = malloc(nameend - bp + 1)) != NULL) { retval[0] = '\0'; strncat(retval, bp, nameend - bp); } diff --git a/usr.sbin/lpr/common_source/request.c b/usr.sbin/lpr/common_source/request.c index 539c9557de..8ea4668ad2 100644 --- a/usr.sbin/lpr/common_source/request.c +++ b/usr.sbin/lpr/common_source/request.c @@ -28,7 +28,6 @@ * * @(#) Copyright (C) 1997, Massachusetts Institute of Technology * $FreeBSD: src/usr.sbin/lpr/common_source/request.c,v 1.2.2.1 2001/06/12 16:40:57 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/common_source/request.c,v 1.2 2003/06/17 04:29:56 dillon Exp $ */ #include @@ -67,11 +66,11 @@ free_request(struct request *rp) free(rp->prettyname); if (rp->authinfo) free(rp->authinfo); - while ((ru = TAILQ_FIRST(&rp->users)) != 0) { + while ((ru = TAILQ_FIRST(&rp->users)) != NULL) { TAILQ_REMOVE(&rp->users, ru, ru_link); free(ru); } - while ((rj = TAILQ_FIRST(&rp->jobids)) != 0) { + while ((rj = TAILQ_FIRST(&rp->jobids)) != NULL) { TAILQ_REMOVE(&rp->jobids, rj, rj_link); free(rj); } diff --git a/usr.sbin/lpr/common_source/rmjob.c b/usr.sbin/lpr/common_source/rmjob.c index 58f6824a65..f11a13b6a9 100644 --- a/usr.sbin/lpr/common_source/rmjob.c +++ b/usr.sbin/lpr/common_source/rmjob.c @@ -330,7 +330,7 @@ rmremote(const struct printer *pp) else niov = 4 + requests + 1; iov = malloc(niov * sizeof *iov); - if (iov == 0) + if (iov == NULL) fatal(pp, "out of memory in rmremote()"); iov[0].iov_base = "\5"; iov[1].iov_base = pp->remote_queue; diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c index b13e1705ec..83f12a541c 100644 --- a/usr.sbin/lpr/lpc/lpc.c +++ b/usr.sbin/lpr/lpc/lpc.c @@ -34,7 +34,6 @@ * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)lpc.c 8.3 (Berkeley) 4/28/95 * $FreeBSD: src/usr.sbin/lpr/lpc/lpc.c,v 1.13.2.11 2002/07/26 03:12:07 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/lpc/lpc.c,v 1.7 2006/01/14 22:58:18 corecode Exp $ */ #include @@ -97,7 +96,7 @@ main(int argc, char **argv) printf("?Ambiguous command\n"); exit(1); } - if (c == 0) { + if (c == NULL) { printf("?Invalid command\n"); exit(1); } @@ -199,7 +198,7 @@ cmdscanner(void) printf("?Ambiguous command\n"); continue; } - if (c == 0) { + if (c == NULL) { printf("?Invalid command\n"); continue; } @@ -233,7 +232,7 @@ getcmd(const char *name) longest = 0; nmatches = 0; - found = 0; + found = NULL; for (c = cmdtab; (p = c->c_name); c++) { for (q = name; *q == *p++; q++) if (*q == 0) /* exact match? */ @@ -277,7 +276,7 @@ makeargv(void) break; *cp++ = '\0'; } - *argp++ = 0; + *argp++ = NULL; } #define HELPINDENT (sizeof ("directory")) diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 38ceb4b834..8eb4601aa2 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -34,7 +34,6 @@ * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)printjob.c 8.7 (Berkeley) 5/10/95 * $FreeBSD: src/usr.sbin/lpr/lpd/printjob.c,v 1.22.2.32 2002/06/19 23:58:16 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/lpd/printjob.c,v 1.4 2004/12/18 22:48:03 swildner Exp $ */ /* @@ -647,7 +646,7 @@ print(struct printer *pp, int format, char *file) av[i++] = "-L"; av[i++] = *locale ? locale : "C"; av[i++] = "-F"; - av[i] = 0; + av[i] = NULL; fo = ofd; goto start; } @@ -769,7 +768,7 @@ print(struct printer *pp, int format, char *file) av[n++] = "-h"; av[n++] = origin_host; av[n++] = pp->acct_file; - av[n] = 0; + av[n] = NULL; fo = pfd; if (of_pid > 0) { /* stop output filter */ write(ofd, "\031\1", 2); @@ -1598,7 +1597,7 @@ init(struct printer *pp) sprintf(&length[2], "%ld", pp->page_length); sprintf(&pxwidth[2], "%ld", pp->page_pwidth); sprintf(&pxlength[2], "%ld", pp->page_plength); - if ((s = checkremote(pp)) != 0) { + if ((s = checkremote(pp)) != NULL) { syslog(LOG_WARNING, "%s", s); free(s); } diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c index 67593ec10a..e6df905757 100644 --- a/usr.sbin/lpr/lpr/lpr.c +++ b/usr.sbin/lpr/lpr/lpr.c @@ -39,7 +39,6 @@ * @(#) Copyright (c) 1983, 1989, 1993 The Regents of the University of California. All rights reserved. * @(#)from: lpr.c 8.4 (Berkeley) 4/28/95 * $FreeBSD: src/usr.sbin/lpr/lpr/lpr.c,v 1.32.2.11 2002/04/28 23:40:23 gad Exp $ - * $DragonFly: src/usr.sbin/lpr/lpr/lpr.c,v 1.5 2005/08/08 18:58:56 joerg Exp $ */ /* @@ -282,7 +281,7 @@ main(int argc, char *argv[]) lpr_username = Uflag; /* -U person doing 'lpr' */ } else { lpr_username = getlogin(); /* person doing 'lpr' */ - if (userid != pp->daemon_user || lpr_username == 0) { + if (userid != pp->daemon_user || lpr_username == NULL) { if ((pw = getpwuid(userid)) == NULL) errx(1, "Who are you?"); lpr_username = pw->pw_name; @@ -334,7 +333,7 @@ main(int argc, char *argv[]) card('J', jobname); card('L', lpr_username); } - if (format != 'p' && Zflag != 0) + if (format != 'p' && Zflag != NULL) card('Z', Zflag); if (iflag) card('I', itoa(indent)); diff --git a/usr.sbin/mfiutil/mfi_patrol.c b/usr.sbin/mfiutil/mfi_patrol.c index 01bcf2b639..834313f441 100644 --- a/usr.sbin/mfiutil/mfi_patrol.c +++ b/usr.sbin/mfiutil/mfi_patrol.c @@ -55,7 +55,7 @@ mfi_get_time(int fd, uint32_t *at) if (mfi_dcmd_command(fd, MFI_DCMD_TIME_SECS_GET, at, sizeof(*at), NULL, 0, NULL) < 0) { warn("Couldn't fetch adapter time"); - at = 0; + at = NULL; } } diff --git a/usr.sbin/mrouted/callout.c b/usr.sbin/mrouted/callout.c index 80448239fb..cd9d33305c 100644 --- a/usr.sbin/mrouted/callout.c +++ b/usr.sbin/mrouted/callout.c @@ -10,14 +10,13 @@ * callout.c,v 3.8.4.8 1998/01/06 01:58:45 fenner Exp * * $FreeBSD: src/usr.sbin/mrouted/callout.c,v 1.12 1999/08/28 01:17:03 peter Exp $ - * $DragonFly: src/usr.sbin/mrouted/callout.c,v 1.6 2008/04/20 19:26:53 swildner Exp $ */ #include "defs.h" /* the code below implements a callout queue */ static int id = 0; -static struct timeout_q *Q = 0; /* pointer to the beginning of timeout queue */ +static struct timeout_q *Q = NULL; /* pointer to the beginning of timeout queue */ struct timeout_q { struct timeout_q *next; /* next event */ @@ -111,14 +110,14 @@ timer_setTimer(int delay, cfunc_t action, void *data) /* create a node */ node = (struct timeout_q *)malloc(sizeof(struct timeout_q)); - if (node == 0) { + if (node == NULL) { dolog(LOG_WARNING, 0, "Malloc Failed in timer_setTimer\n"); return -1; } node->func = action; node->data = data; node->time = delay; - node->next = 0; + node->next = NULL; node->id = ++id; prev = ptr = Q; @@ -209,7 +208,7 @@ timer_clearTimer(int timer_id) prev->next = ptr->next; /* increment next node if any */ - if (ptr->next != 0) + if (ptr->next != NULL) (ptr->next)->time += ptr->time; if (ptr->data) diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c index b82ee65df7..6259e62272 100644 --- a/usr.sbin/mrouted/main.c +++ b/usr.sbin/mrouted/main.c @@ -940,7 +940,7 @@ dolog(int severity, int syserr, char *format, ...) for (i = 0; i < NLOGMSGS; i++) { logmsg[i] = malloc(LOGMSGSIZE); - if (logmsg[i] == 0) { + if (logmsg[i] == NULL) { syslog(LOG_ERR, "out of memory"); exit(-1); } diff --git a/usr.sbin/mrouted/mapper.c b/usr.sbin/mrouted/mapper.c index 2bb0d68d30..694f816d02 100644 --- a/usr.sbin/mrouted/mapper.c +++ b/usr.sbin/mrouted/mapper.c @@ -4,7 +4,6 @@ * mapper.c,v 3.8.4.3 1998/01/06 01:57:47 fenner Exp * * $FreeBSD: src/usr.sbin/mrouted/mapper.c,v 1.15.2.1 2002/09/12 16:27:49 nectar Exp $ - * $DragonFly: src/usr.sbin/mrouted/mapper.c,v 1.4 2004/03/15 18:10:28 dillon Exp $ */ /* @@ -65,7 +64,7 @@ typedef struct node { } Node; -Node *routers = 0; +Node *routers = NULL; u_int32 our_addr, target_addr = 0; /* in NET order */ int debug = 0; int retries = DEFAULT_RETRIES; @@ -102,8 +101,8 @@ find_node(u_int32 addr, Node **ptr) n->addr = addr; n->version = 0; n->tries = 0; - n->u.interfaces = 0; - n->left = n->right = 0; + n->u.interfaces = NULL; + n->left = n->right = NULL; return n; } else if (addr == n->addr) return n; @@ -126,7 +125,7 @@ find_interface(u_int32 addr, Node *node) ifc->addr = addr; ifc->next = node->u.interfaces; node->u.interfaces = ifc; - ifc->neighbors = 0; + ifc->neighbors = NULL; return ifc; } diff --git a/usr.sbin/mrouted/mtrace.c b/usr.sbin/mrouted/mtrace.c index eeb964f440..de0733f4d3 100644 --- a/usr.sbin/mrouted/mtrace.c +++ b/usr.sbin/mrouted/mtrace.c @@ -110,7 +110,6 @@ * The mtrace program is COPYRIGHT 1998 by Xerox Corporation. * * $FreeBSD: src/usr.sbin/mrouted/mtrace.c,v 1.17.2.3 2002/09/12 16:27:49 nectar Exp $ - * $DragonFly: src/usr.sbin/mrouted/mtrace.c,v 1.8 2005/12/05 00:58:50 swildner Exp $ */ #include @@ -368,10 +367,10 @@ init_igmp(void) struct ip *ip; recv_buf = (char *)malloc(RECV_BUF_SIZE); - if (recv_buf == 0) + if (recv_buf == NULL) dolog(LOG_ERR, 0, "Out of memory allocating recv_buf!"); send_buf = (char *)malloc(RECV_BUF_SIZE); - if (send_buf == 0) + if (send_buf == NULL) dolog(LOG_ERR, 0, "Out of memory allocating send_buf!"); if ((igmp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP)) < 0) @@ -1518,7 +1517,7 @@ passive_mode(void) /* XXX This should be a hash table */ /* XXX garbage-collection should be more efficient */ - for (nn = &remembered, n = *nn, m = 0; n; n = *nn) { + for (nn = &remembered, n = *nn, m = NULL; n; n = *nn) { if ((n->base.qhdr.tr_src == base.qhdr.tr_src) && (n->base.qhdr.tr_dst == base.qhdr.tr_dst) && (n->base.igmp.igmp_group.s_addr == igmp->igmp_group.s_addr)) { diff --git a/usr.sbin/mrouted/prune.c b/usr.sbin/mrouted/prune.c index 4644ae7831..25370fac33 100644 --- a/usr.sbin/mrouted/prune.c +++ b/usr.sbin/mrouted/prune.c @@ -10,7 +10,6 @@ * prune.c,v 3.8.4.59 1998/03/01 02:06:32 fenner Exp * * $FreeBSD: src/usr.sbin/mrouted/prune.c,v 1.17.2.1 2000/10/29 03:59:57 kris Exp $ - * $DragonFly: src/usr.sbin/mrouted/prune.c,v 1.6 2008/04/20 13:44:26 swildner Exp $ */ #include "defs.h" @@ -627,7 +626,7 @@ next_grp_src_mask(struct gtable **gtpp, /* ordered by group */ } (*gtpp) = gbest; (*stpp) = sbest; - return (*gtpp)!=0; + return (*gtpp)!=NULL; } /* diff --git a/usr.sbin/mrouted/route.c b/usr.sbin/mrouted/route.c index 91383c3d4d..346cf53116 100644 --- a/usr.sbin/mrouted/route.c +++ b/usr.sbin/mrouted/route.c @@ -10,7 +10,6 @@ * route.c,v 3.8.4.41 1998/01/15 00:08:34 fenner Exp * * $FreeBSD: src/usr.sbin/mrouted/route.c,v 1.12 1999/08/28 01:17:08 peter Exp $ - * $DragonFly: src/usr.sbin/mrouted/route.c,v 1.5 2005/12/05 00:58:50 swildner Exp $ */ #include "defs.h" @@ -93,7 +92,7 @@ next_route(struct rtentry **rtpp, u_int32 src, u_int32 mask) rbest = rt; } (*rtpp) = rbest; - return (*rtpp)!=0; + return (*rtpp)!=NULL; } /* diff --git a/usr.sbin/mrouted/vif.c b/usr.sbin/mrouted/vif.c index 8f3d9b75dd..66e76a265b 100644 --- a/usr.sbin/mrouted/vif.c +++ b/usr.sbin/mrouted/vif.c @@ -10,7 +10,6 @@ * vif.c,v 3.8.4.56.2.1 1999/01/20 05:18:50 fenner Exp * * $FreeBSD: src/usr.sbin/mrouted/vif.c,v 1.15 1999/08/28 01:17:09 peter Exp $ - * $DragonFly: src/usr.sbin/mrouted/vif.c,v 1.4 2004/03/15 18:10:28 dillon Exp $ */ #include "defs.h" @@ -902,21 +901,21 @@ accept_neighbor_request(u_int32 src, u_int32 dst) if (v->uv_flags & VIFF_DISABLED) continue; - ncount = 0; + ncount = NULL; for (la = v->uv_neighbors; la; la = la->al_next) { /* Make sure that there's room for this neighbor... */ - if (datalen + (ncount == 0 ? 4 + 3 + 4 : 4) > MAX_DVMRP_DATA_LEN) { + if (datalen + (ncount == NULL ? 4 + 3 + 4 : 4) > MAX_DVMRP_DATA_LEN) { send_igmp(INADDR_ANY, them, IGMP_DVMRP, DVMRP_NEIGHBORS, htonl(MROUTED_LEVEL), datalen); p = (u_char *) (send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN); datalen = 0; - ncount = 0; + ncount = NULL; } /* Put out the header for this neighbor list... */ - if (ncount == 0) { + if (ncount == NULL) { PUT_ADDR(v->uv_lcl_addr); *p++ = v->uv_metric; *p++ = v->uv_threshold; @@ -968,7 +967,7 @@ accept_neighbor_request2(u_int32 src, u_int32 dst) rflags |= DVMRP_NF_QUERIER; if (vflags & VIFF_LEAF) rflags |= DVMRP_NF_LEAF; - ncount = 0; + ncount = NULL; la = v->uv_neighbors; if (la == NULL) { /* @@ -995,15 +994,15 @@ accept_neighbor_request2(u_int32 src, u_int32 dst) } else { for ( ; la; la = la->al_next) { /* Make sure that there's room for this neighbor... */ - if (datalen + (ncount == 0 ? 4+4+4 : 4) > MAX_DVMRP_DATA_LEN) { + if (datalen + (ncount == NULL ? 4+4+4 : 4) > MAX_DVMRP_DATA_LEN) { send_igmp(INADDR_ANY, them, IGMP_DVMRP, DVMRP_NEIGHBORS2, htonl(MROUTED_LEVEL), datalen); p = (u_char *) (send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN); datalen = 0; - ncount = 0; + ncount = NULL; } /* Put out the header for this neighbor list... */ - if (ncount == 0) { + if (ncount == NULL) { /* If it's a one-way tunnel, mark it down. */ if (rflags & DVMRP_NF_TUNNEL && la->al_flags & NBRF_ONEWAY) rflags |= DVMRP_NF_DOWN; diff --git a/usr.sbin/mtree/excludes.c b/usr.sbin/mtree/excludes.c index 1337a17010..ffcf3c32fa 100644 --- a/usr.sbin/mtree/excludes.c +++ b/usr.sbin/mtree/excludes.c @@ -27,7 +27,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/mtree/excludes.c,v 1.1.2.4 2001/01/12 19:17:18 phk Exp $ - * $DragonFly: src/usr.sbin/mtree/excludes.c,v 1.3 2004/03/15 16:24:22 dillon Exp $ */ #include @@ -70,10 +69,10 @@ read_excludes_file(const char *name) size_t len; fp = fopen(name, "r"); - if (fp == 0) + if (fp == NULL) err(1, "%s", name); - while ((line = fgetln(fp, &len)) != 0) { + while ((line = fgetln(fp, &len)) != NULL) { if (line[len - 1] == '\n') len--; if (len == 0) @@ -81,7 +80,7 @@ read_excludes_file(const char *name) str = malloc(len + 1); e = malloc(sizeof *e); - if (str == 0 || e == 0) + if (str == NULL || e == NULL) errx(1, "memory allocation error"); e->glob = str; memcpy(str, line, len); diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index bec80abb33..dc12d3dd8c 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/ppp/command.c,v 1.230.2.18 2003/04/05 10:48:08 ume Exp $ - * $DragonFly: src/usr.sbin/ppp/command.c,v 1.4 2008/03/11 10:53:07 hasso Exp $ */ #include @@ -626,7 +625,7 @@ ShellCommand(struct cmdargs const *arg, int bg) if ((shpid = fork()) == 0) { int i, fd; - if ((shell = getenv("SHELL")) == 0) + if ((shell = getenv("SHELL")) == NULL) shell = _PATH_BSHELL; timer_TermService(); diff --git a/usr.sbin/ppp/filter.c b/usr.sbin/ppp/filter.c index e45242ee39..209e606c5c 100644 --- a/usr.sbin/ppp/filter.c +++ b/usr.sbin/ppp/filter.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/ppp/filter.c,v 1.39.2.7 2002/09/01 02:12:26 brian Exp $ - * $DragonFly: src/usr.sbin/ppp/filter.c,v 1.2 2003/06/17 04:30:00 dillon Exp $ */ #include @@ -81,7 +80,7 @@ ParsePort(const char *service, const char *proto) int port; servent = getservbyname(service, proto); - if (servent != 0) + if (servent != NULL) return ntohs(servent->s_port); port = strtol(service, &cp, 0); diff --git a/usr.sbin/pppctl/pppctl.c b/usr.sbin/pppctl/pppctl.c index 99bacd9e1a..933dc43324 100644 --- a/usr.sbin/pppctl/pppctl.c +++ b/usr.sbin/pppctl/pppctl.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/pppctl/pppctl.c,v 1.21.2.2 2001/11/23 13:18:39 brian Exp $ - * $DragonFly: src/usr.sbin/pppctl/pppctl.c,v 1.7 2006/01/14 22:58:18 corecode Exp $ */ #include @@ -313,7 +312,7 @@ main(int argc, char **argv) warnx("cannot translate %s", host); return 1; } - } else if ((h = gethostbyname(host)) == 0) { + } else if ((h = gethostbyname(host)) == NULL) { warnx("cannot resolve %s", host); return 1; } diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c index 1c1606b0ff..3f2f8d56f1 100644 --- a/usr.sbin/pppd/main.c +++ b/usr.sbin/pppd/main.c @@ -17,7 +17,6 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * $FreeBSD: src/usr.sbin/pppd/main.c,v 1.19.2.1 2002/07/30 03:50:40 peter Exp $ - * $DragonFly: src/usr.sbin/pppd/main.c,v 1.6 2006/07/27 00:40:55 corecode Exp $ */ #include @@ -1449,7 +1448,7 @@ vfmtmsg(char *buf, int buflen, char *fmt, va_list args) } } } - str = 0; + str = NULL; base = 0; neg = 0; ++fmt; @@ -1615,15 +1614,15 @@ script_setenv(char *var, char *value) char *p, *newstring; newstring = (char *) malloc(vl + strlen(value) + 2); - if (newstring == 0) + if (newstring == NULL) return; strcpy(newstring, var); newstring[vl] = '='; strcpy(newstring+vl+1, value); /* check if this variable is already set */ - if (script_env != 0) { - for (i = 0; (p = script_env[i]) != 0; ++i) { + if (script_env != NULL) { + for (i = 0; (p = script_env[i]) != NULL; ++i) { if (strncmp(p, var, vl) == 0 && p[vl] == '=') { free(p); script_env[i] = newstring; @@ -1633,7 +1632,7 @@ script_setenv(char *var, char *value) } else { i = 0; script_env = (char **) malloc(16 * sizeof(char *)); - if (script_env == 0) + if (script_env == NULL) return; s_env_nalloc = 16; } @@ -1643,14 +1642,14 @@ script_setenv(char *var, char *value) int new_n = i + 17; char **newenv = (char **) realloc((void *)script_env, new_n * sizeof(char *)); - if (newenv == 0) + if (newenv == NULL) return; script_env = newenv; s_env_nalloc = new_n; } script_env[i] = newstring; - script_env[i+1] = 0; + script_env[i+1] = NULL; } /* @@ -1664,12 +1663,12 @@ script_unsetenv(char *var) int i; char *p; - if (script_env == 0) + if (script_env == NULL) return; - for (i = 0; (p = script_env[i]) != 0; ++i) { + for (i = 0; (p = script_env[i]) != NULL; ++i) { if (strncmp(p, var, vl) == 0 && p[vl] == '=') { free(p); - while ((script_env[i] = script_env[i+1]) != 0) + while ((script_env[i] = script_env[i+1]) != NULL) ++i; break; } diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index e16dda6f26..2e892dd1b2 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1980, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)pstat.c 8.16 (Berkeley) 5/9/95 * $FreeBSD: src/usr.sbin/pstat/pstat.c,v 1.49.2.5 2002/07/12 09:12:49 des Exp $ - * $DragonFly: src/usr.sbin/pstat/pstat.c,v 1.22 2008/03/04 18:10:44 swildner Exp $ */ #include @@ -265,7 +264,7 @@ main(int argc, char **argv) if (nlistf != NULL || memf != NULL) setgid(getgid()); - if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == 0) + if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == NULL) errx(1, "kvm_openfiles: %s", buf); #ifdef USE_KCORE if (kcore_wrapper_open(nlistf, memf, buf)) @@ -757,7 +756,7 @@ ttytype(struct tty *tty, const char *name, int type, int number, int indir) printf("%d %s %s\n", ntty, name, (ntty == 1) ? "line" : "lines"); if (ntty > ttyspace) { ttyspace = ntty; - if ((tty = realloc(tty, ttyspace * sizeof(*tty))) == 0) + if ((tty = realloc(tty, ttyspace * sizeof(*tty))) == NULL) errx(1, "realloc"); } if (indir) { diff --git a/usr.sbin/puffs/mount_psshfs/fs.c b/usr.sbin/puffs/mount_psshfs/fs.c index 6e0fc6fea2..90979b701f 100644 --- a/usr.sbin/puffs/mount_psshfs/fs.c +++ b/usr.sbin/puffs/mount_psshfs/fs.c @@ -257,7 +257,7 @@ psshfs_fs_fhtonode(struct puffs_usermount *pu, void *fid, size_t fidsize, if (pf->mounttime != pctx->mounttime) return EINVAL; - if (pn == 0) + if (pn == NULL) return EINVAL; psn = pn->pn_data; if ((psn->stat & PSN_HASFH) == 0) diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index 07f723ac28..dbd5b138ac 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -29,7 +29,6 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/quot/quot.c,v 1.11.2.4 2002/03/15 18:12:41 mikeh Exp $ - * $DragonFly: src/usr.sbin/quot/quot.c,v 1.7 2007/12/27 02:25:41 swildner Exp $ */ #include @@ -106,7 +105,7 @@ get_inode(int fd, struct fs *super, ino_t ino) if (fd < 0) { /* flush cache */ if (ip) { free(ip); - ip = 0; + ip = NULL; } return 0; } diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c index eca451a255..7f13e65dd6 100644 --- a/usr.sbin/repquota/repquota.c +++ b/usr.sbin/repquota/repquota.c @@ -36,7 +36,6 @@ * @(#) Copyright (c) 1980, 1990, 1993 The Regents of the University of California. All rights reserved. * @(#)repquota.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/repquota/repquota.c,v 1.9.2.2 2002/03/15 22:18:25 mikeh Exp $ - * $DragonFly: src/usr.sbin/repquota/repquota.c,v 1.7 2006/04/03 01:58:49 dillon Exp $ */ /* @@ -133,13 +132,13 @@ main(int argc, char **argv) } if (gflag) { setgrent(); - while ((gr = getgrent()) != 0) + while ((gr = getgrent()) != NULL) addid((u_long)gr->gr_gid, GRPQUOTA, gr->gr_name); endgrent(); } if (uflag) { setpwent(); - while ((pw = getpwent()) != 0) + while ((pw = getpwent()) != NULL) addid((u_long)pw->pw_uid, USRQUOTA, pw->pw_name); endpwent(); } @@ -211,7 +210,7 @@ repquota(struct fstab *fs, int type, char *qfpathname) break; if (dqbuf.dqb_curinodes == 0 && dqbuf.dqb_curblocks == 0) continue; - if ((fup = lookup(id, type)) == 0) + if ((fup = lookup(id, type)) == NULL) fup = addid(id, type, NULL); fup->fu_dqblk = dqbuf; } @@ -222,7 +221,7 @@ repquota(struct fstab *fs, int type, char *qfpathname) max(UT_NAMESIZE,10), " "); for (id = 0; id <= highid[type]; id++) { fup = lookup(id, type); - if (fup == 0) + if (fup == NULL) continue; if (fup->fu_dqblk.dqb_curinodes == 0 && fup->fu_dqblk.dqb_curblocks == 0) @@ -315,7 +314,7 @@ lookup(u_long id, int type) { struct fileusage *fup; - for (fup = fuhead[type][id & (FUHASH-1)]; fup != 0; fup = fup->fu_next) + for (fup = fuhead[type][id & (FUHASH-1)]; fup != NULL; fup = fup->fu_next) if (fup->fu_id == id) return (fup); return (NULL); diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c index c049729cb7..3117f9bc4c 100644 --- a/usr.sbin/rmt/rmt.c +++ b/usr.sbin/rmt/rmt.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)rmt.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/rmt/rmt.c,v 1.7 2000/02/12 01:14:33 mjacob Exp $ - * $DragonFly: src/usr.sbin/rmt/rmt.c,v 1.5 2005/12/05 02:40:28 swildner Exp $ */ /* @@ -80,7 +79,7 @@ main(int argc, char **argv) argc--, argv++; if (argc > 0) { debug = fopen(*argv, "w"); - if (debug == 0) + if (debug == NULL) exit(1); setbuf(debug, NULL); } @@ -222,10 +221,10 @@ checkbuf(char *record, int size) if (size <= maxrecsize) return (record); - if (record != 0) + if (record != NULL) free(record); record = malloc(size); - if (record == 0) { + if (record == NULL) { DEBUG("rmtd: cannot allocate buffer space\n"); exit(4); } diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 96734e6b3e..a4a47e4c75 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -160,7 +160,7 @@ struct riprt { int rrt_index; /* ifindex from which this route got */ }; -struct riprt *riprt = 0; +struct riprt *riprt = NULL; int dflag = 0; /* debug flag */ int qflag = 0; /* quiet flag */ @@ -534,7 +534,7 @@ ripalarm(void) time_t t_lifetime, t_holddown; /* age the RIP routes */ - rrt_prev = 0; + rrt_prev = NULL; t_lifetime = time(NULL) - RIP_LIFETIME; t_holddown = t_lifetime - RIP_HOLDDOWN; for (rrt = riprt; rrt; rrt = rrt_next) { @@ -1376,8 +1376,8 @@ ifconfig(void) ifc = ifcp; nifc++; ifcp->ifc_name = allocopy(ifa->ifa_name); - ifcp->ifc_addr = 0; - ifcp->ifc_filter = 0; + ifcp->ifc_addr = NULL; + ifcp->ifc_filter = NULL; ifcp->ifc_flags = ifa->ifa_flags; trace(1, "newif %s <%s>\n", ifcp->ifc_name, ifflags(ifcp->ifc_flags)); @@ -2440,7 +2440,7 @@ rt_entry(struct rt_msghdr *rtm, int again) struct netinfo6 *np; int s; - sin6_dst = sin6_gw = sin6_mask = sin6_genmask = sin6_ifp = 0; + sin6_dst = sin6_gw = sin6_mask = sin6_genmask = sin6_ifp = NULL; if ((rtm->rtm_flags & RTF_UP) == 0 || rtm->rtm_flags & (RTF_CLONING|RTF_XRESOLVE|RTF_LLINFO|RTF_BLACKHOLE)) { return; /* not interested in the link route */ @@ -3197,7 +3197,7 @@ hms(void) struct tm *tm; t = time(NULL); - if ((tm = localtime(&t)) == 0) { + if ((tm = localtime(&t)) == NULL) { fatal("localtime"); /*NOTREACHED*/ } diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 78f88673dc..f2cb62ef3c 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -901,7 +901,7 @@ ra_input(int len, struct nd_router_advert *ra, /* * RA consistency check according to RFC-2461 6.2.7 */ - if ((rai = if_indextorainfo(pi->ipi6_ifindex)) == 0) { + if ((rai = if_indextorainfo(pi->ipi6_ifindex)) == NULL) { syslog(LOG_INFO, "<%s> received RA from %s on non-advertising" " interface(%s)", diff --git a/usr.sbin/timed/timed/acksend.c b/usr.sbin/timed/timed/acksend.c index 5eb0ccb168..5a1a9f6b74 100644 --- a/usr.sbin/timed/timed/acksend.c +++ b/usr.sbin/timed/timed/acksend.c @@ -32,7 +32,6 @@ * * @(#)acksend.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/timed/timed/acksend.c,v 1.4 1999/08/28 01:20:16 peter Exp $ - * $DragonFly: src/usr.sbin/timed/timed/acksend.c,v 1.4 2004/09/05 01:59:44 dillon Exp $ */ #include "globals.h" @@ -89,7 +88,7 @@ acksend(struct tsp *message, /* this message */ msec = 200; count = bad ? 1 : 5; /* 5 packets in 6.4 seconds */ - answer = 0; + answer = NULL; do { if (!answer) { /* do not go crazy transmitting just because the @@ -106,7 +105,7 @@ acksend(struct tsp *message, /* this message */ mstotvround(&twait, msec); answer = readmsg(ack, name, &twait, net); - if (answer != 0) { + if (answer != NULL) { if (answer->tsp_seq != sequence) { if (trace) fprintf(fd,"acksend: seq # %u!=%u\n", diff --git a/usr.sbin/timed/timed/master.c b/usr.sbin/timed/timed/master.c index d19cc1eba0..f560256aff 100644 --- a/usr.sbin/timed/timed/master.c +++ b/usr.sbin/timed/timed/master.c @@ -32,7 +32,6 @@ * * @(#)master.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/timed/timed/master.c,v 1.6 1999/08/28 01:20:17 peter Exp $ - * $DragonFly: src/usr.sbin/timed/timed/master.c,v 1.8 2004/09/05 02:20:15 dillon Exp $ */ #include "globals.h" @@ -186,7 +185,7 @@ loop: tsp_time_sec = msg->tsp_time.tv_sec; strlcpy(newdate, ctime(&tsp_time_sec), sizeof(newdate)); htp = findhost(msg->tsp_name); - if (htp == 0) { + if (htp == NULL) { syslog(LOG_ERR, "attempted SET DATEREQ by uncontrolled %s to %s", msg->tsp_name, newdate); @@ -469,7 +468,7 @@ spreadtime(void) gettimeofday(&to.tsp_time, 0); answer = acksend(&to, &htp->addr, htp->name, TSP_ACK, 0, htp->noanswer); - if (answer == 0) { + if (answer == NULL) { /* We client does not respond, then we have * just wasted lots of time on it. */ @@ -558,7 +557,7 @@ addmach(char *name, struct sockaddr_in *addr, struct netinfo *ntp) struct hosttbl *ret, *p, *b, *f; ret = findhost(name); - if (ret == 0) { + if (ret == NULL) { if (slvcount >= NHOSTS) { if (trace) { fprintf(fd, "no more slots in host table\n"); diff --git a/usr.sbin/timed/timed/readmsg.c b/usr.sbin/timed/timed/readmsg.c index bc86b1ac14..4d4ea9dfa2 100644 --- a/usr.sbin/timed/timed/readmsg.c +++ b/usr.sbin/timed/timed/readmsg.c @@ -32,7 +32,6 @@ * * @(#)readmsg.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/timed/timed/readmsg.c,v 1.5.2.3 2001/08/31 08:02:05 kris Exp $ - * $DragonFly: src/usr.sbin/timed/timed/readmsg.c,v 1.6 2004/09/05 02:20:15 dillon Exp $ */ #include "globals.h" @@ -87,9 +86,9 @@ readmsg(int type, char *machfrom, struct timeval *intvl, fprintf(fd, "readmsg: looking for %s from %s, %s\n", tsptype[type], machfrom == NULL ? "ANY" : machfrom, netfrom == NULL ? "ANYNET" : inet_ntoa(netfrom->net)); - if (head->p != 0) { + if (head->p != NULL) { length = 1; - for (ptr = head->p; ptr != 0; ptr = ptr->p) { + for (ptr = head->p; ptr != NULL; ptr = ptr->p) { /* do not repeat the hundreds of messages */ if (++length > 3) { if (ptr == tail) { diff --git a/usr.sbin/timed/timed/slave.c b/usr.sbin/timed/timed/slave.c index 8021e7c748..7b7719088e 100644 --- a/usr.sbin/timed/timed/slave.c +++ b/usr.sbin/timed/timed/slave.c @@ -32,7 +32,6 @@ * * @(#)slave.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/timed/timed/slave.c,v 1.7 1999/08/28 01:20:18 peter Exp $ - * $DragonFly: src/usr.sbin/timed/timed/slave.c,v 1.9 2004/09/05 02:20:15 dillon Exp $ */ #include "globals.h" @@ -75,7 +74,7 @@ slave(void) struct hosttbl *htp; - old_slavenet = 0; + old_slavenet = NULL; seq = 0; refusetime = 0; adjusttime = 0; @@ -344,7 +343,7 @@ loop: tsp_time_sec = msg->tsp_time.tv_sec; strlcpy(newdate, ctime(&tsp_time_sec), sizeof(newdate)); htp = findhost(msg->tsp_name); - if (0 == htp) { + if (NULL == htp) { syslog(LOG_WARNING, "DATEREQ from uncontrolled machine"); break; @@ -541,7 +540,7 @@ loop: if (msg->tsp_hopcnt-- < 1) break; bytenetorder(msg); - for (ntp = nettab; ntp != 0; ntp = ntp->next) { + for (ntp = nettab; ntp != NULL; ntp = ntp->next) { if (ntp->status == MASTER && 0 > sendto(sock, (char *)msg, sizeof(struct tsp), 0, diff --git a/usr.sbin/timed/timed/timed.c b/usr.sbin/timed/timed/timed.c index 2c13276baa..3a61c864a4 100644 --- a/usr.sbin/timed/timed/timed.c +++ b/usr.sbin/timed/timed/timed.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1985, 1993 The Regents of the University of California. All rights reserved. * @(#)timed.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/timed/timed/timed.c,v 1.9 1999/08/28 01:20:19 peter Exp $ - * $DragonFly: src/usr.sbin/timed/timed/timed.c,v 1.8 2004/09/05 02:20:15 dillon Exp $ */ #define TSPTYPES @@ -63,7 +62,7 @@ FILE *fd; /* trace file FD */ jmp_buf jmpenv; -struct netinfo *nettab = 0; +struct netinfo *nettab = NULL; struct netinfo *slavenet; int Mflag; int justquit = 0; @@ -73,7 +72,7 @@ static struct nets { char *name; long net; struct nets *next; -} *nets = 0; +} *nets = NULL; struct hosttbl hosttbl[NHOSTS+1]; /* known hosts */ @@ -168,7 +167,7 @@ main(int argc, char *argv[]) debug = 1; break; case 'G': - if (goodgroup != 0) + if (goodgroup != NULL) errx(1, "only one net group"); goodgroup = optarg; break; @@ -183,7 +182,7 @@ main(int argc, char *argv[]) /* If we care about which machine is the master, then we must * be willing to be a master */ - if (0 != goodgroup || 0 != goodhosts) + if (NULL != goodgroup || NULL != goodhosts) Mflag = 1; if (gethostname(hostname, sizeof(hostname) - 1) < 0) @@ -195,11 +194,11 @@ main(int argc, char *argv[]) self.head = 1; self.good = 1; - if (goodhosts != 0) /* trust ourself */ + if (goodhosts != NULL) /* trust ourself */ add_good_host(hostname,1); srvp = getservbyname("timed", "udp"); - if (srvp == 0) + if (srvp == NULL) errx(1, "unknown service 'timed/udp'"); port = srvp->s_port; bzero(&server, sizeof(struct sockaddr_in)); @@ -232,12 +231,12 @@ main(int argc, char *argv[]) for (nt = nets; nt; nt = nt->next) { nentp = getnetbyname(nt->name); - if (nentp == 0) { + if (nentp == NULL) { nt->net = inet_network(nt->name); if (nt->net != (long)INADDR_NONE) nentp = getnetbyaddr(nt->net, AF_INET); } - if (nentp != 0) { + if (nentp != NULL) { nt->net = nentp->n_net; } else if (nt->net == (long)INADDR_NONE) { errx(1, "unknown net %s", nt->name); @@ -369,7 +368,7 @@ main(int argc, char *argv[]) break; case 1: /* Just lost our master */ - if (slavenet != 0) + if (slavenet != NULL) slavenet->status = election(slavenet); if (!slavenet || slavenet->status == MASTER) { checkignorednets(); @@ -481,12 +480,12 @@ lookformaster(struct netinfo *ntp) strlcpy(resp.tsp_name, hostname, sizeof(resp.tsp_name)); answer = acksend(&resp, &ntp->dest_addr, ANYADDR, TSP_MASTERACK, ntp, 0); - if (answer != 0 && !good_host_name(answer->tsp_name)) { + if (answer != NULL && !good_host_name(answer->tsp_name)) { suppress(&from, answer->tsp_name, ntp); ntp->status = NOMASTER; - answer = 0; + answer = NULL; } - if (answer == 0) { + if (answer == NULL) { /* * Various conditions can cause conflict: races between * two just started timedaemons when no master is @@ -497,7 +496,7 @@ lookformaster(struct netinfo *ntp) */ ntime.tv_sec = ntime.tv_usec = 0; answer = readmsg(TSP_MASTERREQ, ANYADDR, &ntime, ntp); - if (answer != 0) { + if (answer != NULL) { if (!good_host_name(answer->tsp_name)) { suppress(&from, answer->tsp_name, ntp); ntp->status = NOMASTER; @@ -507,7 +506,7 @@ lookformaster(struct netinfo *ntp) ntime.tv_sec = ntime.tv_usec = 0; answer = readmsg(TSP_MASTERUP, ANYADDR, &ntime, ntp); - if (answer != 0) { + if (answer != NULL) { if (!good_host_name(answer->tsp_name)) { suppress(&from, answer->tsp_name, ntp); ntp->status = NOMASTER; @@ -517,7 +516,7 @@ lookformaster(struct netinfo *ntp) ntime.tv_sec = ntime.tv_usec = 0; answer = readmsg(TSP_ELECTION, ANYADDR, &ntime, ntp); - if (answer != 0) { + if (answer != NULL) { if (!good_host_name(answer->tsp_name)) { suppress(&from, answer->tsp_name, ntp); ntp->status = NOMASTER; @@ -658,13 +657,13 @@ static void pickslavenet(struct netinfo *ntp) { - if (slavenet != 0 && slavenet->status == SLAVE) { + if (slavenet != NULL && slavenet->status == SLAVE) { makeslave(slavenet); /* prune extras */ return; } - if (ntp == 0 || ntp->status != SLAVE) { - for (ntp = nettab; ntp != 0; ntp = ntp->next) { + if (ntp == NULL || ntp->status != SLAVE) { + for (ntp = nettab; ntp != NULL; ntp = ntp->next) { if (ntp->status == SLAVE) break; } @@ -703,7 +702,7 @@ addnetname(char *name) while (*netlist) netlist = &((*netlist)->next); *netlist = (struct nets *)malloc(sizeof **netlist); - if (*netlist == 0) + if (*netlist == NULL) errx(1, "malloc failed"); bzero((char *)*netlist, sizeof(**netlist)); (*netlist)->name = name; @@ -730,7 +729,7 @@ add_good_host(char *name, goodhosts = ghp; hentp = gethostbyname(name); - if (0 == hentp && perm) + if (NULL == hentp && perm) warnx("unknown host %s", name); } @@ -752,7 +751,7 @@ get_goodgroup(int force) /* if no netgroup, then we are finished */ - if (goodgroup == 0 || !Mflag) + if (goodgroup == NULL || !Mflag) return; /* Do not chatter with the netgroup master too often. @@ -765,7 +764,7 @@ get_goodgroup(int force) /* forget the old temporary entries */ ghpp = &goodhosts; - while (0 != (ghp = *ghpp)) { + while (NULL != (ghp = *ghpp)) { if (!ghp->perm) { *ghpp = ghp->next; free((char*)ghp); @@ -790,7 +789,7 @@ get_goodgroup(int force) /* mark the entire netgroup as trusted */ setnetgrent(goodgroup); while (getnetgrent(&mach,&usr,&dom)) { - if (0 != mach) + if (NULL != mach) add_good_host(mach,0); } endnetgrent(); @@ -819,7 +818,7 @@ good_host_name(char *name) if (c == ghp->name[0] && !strcasecmp(name, ghp->name)) return 1; /* found him, so say so */ - } while (0 != (ghp = ghp->next)); + } while (NULL != (ghp = ghp->next)); if (!strcasecmp(name,hostname)) /* trust ourself */ return 1; diff --git a/usr.sbin/timed/timedc/cmds.c b/usr.sbin/timed/timedc/cmds.c index 947dea4407..9f79fe10be 100644 --- a/usr.sbin/timed/timedc/cmds.c +++ b/usr.sbin/timed/timedc/cmds.c @@ -32,7 +32,6 @@ * * @(#)cmds.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/timed/timedc/cmds.c,v 1.6.2.2 2001/08/31 08:02:06 kris Exp $ - * $DragonFly: src/usr.sbin/timed/timedc/cmds.c,v 1.4 2004/12/18 22:48:14 swildner Exp $ */ #include "timedc.h" @@ -278,7 +277,7 @@ msite(int argc, char *argv[]) } srvp = getservbyname("timed", "udp"); - if (srvp == 0) { + if (srvp == NULL) { warnx("udp/timed: unknown service"); return; } @@ -291,7 +290,7 @@ msite(int argc, char *argv[]) do { tgtname = (i >= argc) ? myname : argv[i]; hp = gethostbyname(tgtname); - if (hp == 0) { + if (hp == NULL) { warnx("%s: %s", tgtname, hstrerror(h_errno)); continue; } @@ -379,7 +378,7 @@ testing(int argc, char *argv[]) } srvp = getservbyname("timed", "udp"); - if (srvp == 0) { + if (srvp == NULL) { warnx("udp/timed: unknown service"); return; } @@ -433,7 +432,7 @@ tracing(int argc, char *argv[]) } srvp = getservbyname("timed", "udp"); - if (srvp == 0) { + if (srvp == NULL) { warnx("udp/timed: unknown service"); return; } diff --git a/usr.sbin/timed/timedc/timedc.c b/usr.sbin/timed/timedc/timedc.c index 94ae45cf32..9c7199cc69 100644 --- a/usr.sbin/timed/timedc/timedc.c +++ b/usr.sbin/timed/timedc/timedc.c @@ -33,7 +33,6 @@ * @(#) Copyright (c) 1985, 1993 The Regents of the University of California. All rights reserved. * @(#)timedc.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.sbin/timed/timedc/timedc.c,v 1.5 2003/10/11 07:35:35 tjr Exp $ - * $DragonFly: src/usr.sbin/timed/timedc/timedc.c,v 1.8 2004/05/11 19:22:25 cpressey Exp $ */ #include "timedc.h" @@ -47,7 +46,7 @@ #include int trace = 0; -FILE *fd = 0; +FILE *fd = NULL; int margc; int fromatty; #define MAX_MARGV 20 @@ -76,7 +75,7 @@ main(int argc, char **argv) printf("?Ambiguous command\n"); exit(1); } - if (c == 0) { + if (c == NULL) { printf("?Invalid command\n"); exit(1); } @@ -102,14 +101,14 @@ main(int argc, char **argv) if (cmdline[0] == 0) break; makeargv(); - if (margv[0] == 0) + if (margv[0] == NULL) continue; c = getcmd(margv[0]); if (c == (struct cmd *)-1) { printf("?Ambiguous command\n"); continue; } - if (c == 0) { + if (c == NULL) { printf("?Invalid command\n"); continue; } @@ -140,7 +139,7 @@ getcmd(char *name) longest = 0; nmatches = 0; - found = 0; + found = NULL; for (c = cmdtab; c < &cmdtab[NCMDS]; c++) { p = c->c_name; for (q = name; *q == *p++; q++) @@ -183,7 +182,7 @@ makeargv(void) break; *cp++ = '\0'; } - *argp++ = 0; + *argp++ = NULL; } #define HELPINDENT (sizeof("directory")) diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index 13eff5c445..78a62f40b7 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -32,7 +32,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/usr.sbin/traceroute/traceroute.c,v 1.9 2007/10/25 08:12:42 hasso Exp $ * @(#)traceroute.c 8.1 (Berkeley) 6/6/93 */ @@ -296,7 +295,7 @@ int sndsock; /* send (udp) socket file descriptor */ int datalen; /* How much data */ int headerlen; /* How long packet's header is */ -char *source = 0; +char *source = NULL; char *hostname; int nprobes = 3; @@ -367,7 +366,7 @@ main(int argc, char *argv[]) errx(1, "too many gateways; max %d", MAX_LSRR); if (inet_aton(optarg, &gateway[lsrr]) == 0) { hp = gethostbyname(optarg); - if (hp == 0) + if (hp == NULL) errx(1, "unknown host %s", optarg); memcpy(&gateway[lsrr], hp->h_addr, hp->h_length); } @@ -481,7 +480,7 @@ main(int argc, char *argv[]) hostname = *argv; else { hp = gethostbyname(*argv); - if (hp == 0) + if (hp == NULL) errx(1, "unknown host %s", *argv); to.sin_family = hp->h_addrtype; memcpy(&to.sin_addr, hp->h_addr, hp->h_length); diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 8ae3cdb8c9..5ed9b4210a 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -68,7 +68,6 @@ * The Regents of the University of California. All rights reserved. * * $FreeBSD: src/usr.sbin/traceroute6/traceroute6.c,v 1.22 2008/02/10 21:06:38 dwmalone Exp $ - * $DragonFly: src/usr.sbin/traceroute6/traceroute6.c,v 1.9 2008/09/04 09:08:22 hasso Exp $ */ /* @@ -332,7 +331,7 @@ u_long datalen; /* How much data */ /* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */ char rtbuf[2064]; -char *source = 0; +char *source = NULL; char *hostname; u_long nprobes = 3; diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 37c618c6a0..bc2630acbf 100644 --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -27,7 +27,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/tzsetup/tzsetup.c,v 1.16.2.2 2002/03/06 06:17:41 obrien Exp $ - * $DragonFly: src/usr.sbin/tzsetup/tzsetup.c,v 1.8 2008/06/03 09:33:27 swildner Exp $ */ /* @@ -181,7 +180,7 @@ read_iso3166_table(void) err(1, _PATH_ISO3166); lineno = 0; - while ((s = fgetln(fp, &len)) != 0) { + while ((s = fgetln(fp, &len)) != NULL) { lineno++; if (s[len - 1] != '\n') errx(1, _PATH_ISO3166 ":%d: invalid format", lineno); @@ -191,7 +190,7 @@ read_iso3166_table(void) /* Isolate the two-letter code. */ t = strsep(&s, "\t"); - if (t == 0 || strlen(t) != 2) + if (t == NULL || strlen(t) != 2) errx(1, _PATH_ISO3166 ":%d: invalid format", lineno); if (t[0] < 'A' || t[0] > 'Z' || t[1] < 'A' || t[1] > 'Z') errx(1, _PATH_ISO3166 ":%d: invalid code `%s'", @@ -237,7 +236,7 @@ add_zone_to_country(int lineno, const char *tlc, const char *descr, ":%d: conflicting zone definition", lineno); zp = malloc(sizeof *zp); - if (zp == 0) + if (zp == NULL) errx(1, "malloc(%lu)", (unsigned long)sizeof *zp); if (cp->nzones == 0) @@ -313,7 +312,7 @@ read_zones(void) err(1, _PATH_ZONETAB); lineno = 0; - while ((line = fgetln(fp, &len)) != 0) { + while ((line = fgetln(fp, &len)) != NULL) { lineno++; if (line[len - 1] != '\n') errx(1, _PATH_ZONETAB ":%d: invalid format", lineno); @@ -328,7 +327,7 @@ read_zones(void) coord = strsep(&line, "\t"); file = strsep(&line, "\t"); p = strchr(file, '/'); - if (p == 0) + if (p == NULL) errx(1, _PATH_ZONETAB ":%d: invalid zone name `%s'", lineno, file); contbuf[0] = '\0'; @@ -388,7 +387,7 @@ make_menus(void) continent_names[i].continent->menu = malloc(sizeof(dialogMenuItem) * continent_names[i].continent->nitems); - if (continent_names[i].continent->menu == 0) + if (continent_names[i].continent->menu == NULL) errx(1, "malloc for continent menu"); continent_names[i].continent->nitems = 0; } diff --git a/usr.sbin/usbdevs/usbdevs.c b/usr.sbin/usbdevs/usbdevs.c index 8c4dc5987c..0874026e5b 100644 --- a/usr.sbin/usbdevs/usbdevs.c +++ b/usr.sbin/usbdevs/usbdevs.c @@ -1,7 +1,6 @@ /* * $NetBSD: usbdevs.c,v 1.17 2001/02/19 23:22:48 cgd Exp $ * $FreeBSD: src/usr.sbin/usbdevs/usbdevs.c,v 1.8 2002/04/22 13:44:47 des Exp $ - * $DragonFly: src/usr.sbin/usbdevs/usbdevs.c,v 1.7 2005/12/05 01:23:23 swildner Exp $ */ /* @@ -176,7 +175,7 @@ main(int argc, char **argv) { int ch, i, f; char buf[50]; - char *dev = 0; + char *dev = NULL; int addr = 0; int ncont; @@ -201,7 +200,7 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (dev == 0) { + if (dev == NULL) { for (ncont = 0, i = 0; i < 10; i++) { sprintf(buf, "%s%d", USBDEV, i); f = open(buf, O_RDONLY); diff --git a/usr.sbin/zic/zic.c b/usr.sbin/zic/zic.c index 7a27ebf5d1..c0886cd8f6 100644 --- a/usr.sbin/zic/zic.c +++ b/usr.sbin/zic/zic.c @@ -993,7 +993,7 @@ inzsub(char ** const fields, const int nfields, const int iscont) z.z_filename = filename; z.z_linenum = linenum; z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UTC offset"), TRUE); - if ((cp = strchr(fields[i_format], '%')) != 0) { + if ((cp = strchr(fields[i_format], '%')) != NULL) { if (*++cp != 's' || strchr(cp, '%') != 0) { error(_("invalid abbreviation format")); return FALSE; @@ -1280,9 +1280,9 @@ rulesub(struct rule * const rp, rp->r_wday = lp->l_value; rp->r_dayofmonth = len_months[1][rp->r_month]; } else { - if ((ep = strchr(dp, '<')) != 0) + if ((ep = strchr(dp, '<')) != NULL) rp->r_dycode = DC_DOWLEQ; - else if ((ep = strchr(dp, '>')) != 0) + else if ((ep = strchr(dp, '>')) != NULL) rp->r_dycode = DC_DOWGEQ; else { ep = dp; @@ -2561,7 +2561,7 @@ mkdirs(char *argname) if (argname == NULL || *argname == '\0' || Dflag) return 0; cp = name = ecpyalloc(argname); - while ((cp = strchr(cp + 1, '/')) != 0) { + while ((cp = strchr(cp + 1, '/')) != NULL) { *cp = '\0'; #ifndef unix /* @@ -2616,7 +2616,7 @@ setgroup(gid_t *flag, const char *name) errx(EXIT_FAILURE, _("multiple -g flags specified")); gr = getgrnam(name); - if (gr == 0) { + if (gr == NULL) { char *ep; unsigned long ul; @@ -2639,7 +2639,7 @@ setuser(uid_t *flag, const char *name) errx(EXIT_FAILURE, _("multiple -u flags specified")); pw = getpwnam(name); - if (pw == 0) { + if (pw == NULL) { char *ep; unsigned long ul; -- 2.41.0