Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 678e8cc6002ecd3a79cdae95ac8b454437219fc5 1 parent 7a6da63
Sascha Wildner authored
Showing with 1,042 additions and 1,247 deletions.
  1. +3 −4 bin/df/df.c
  2. +3 −4 bin/ps/fmt.c
  3. +1 −2  bin/ps/ps.c
  4. +1 −1  bin/rcp/rcp.c
  5. +1 −1  bin/sh/miscbltin.c
  6. +1 −1  bin/sh/parser.c
  7. +1 −1  bin/test/test.c
  8. +2 −3 games/adventure/io.c
  9. +2 −3 games/adventure/subr.c
  10. +10 −11 games/backgammon/backgammon/move.c
  11. +1 −2  games/backgammon/backgammon/text.c
  12. +1 −2  games/backgammon/common_source/fancy.c
  13. +1 −2  games/backgammon/common_source/subs.c
  14. +3 −4 games/battlestar/save.c
  15. +2 −3 games/canfield/canfield/canfield.c
  16. +3 −4 games/canfield/cfscores/cfscores.c
  17. +6 −7 games/hack/hack.Decl.c
  18. +1 −2  games/hack/hack.c
  19. +2 −3 games/hack/hack.dog.c
  20. +2 −3 games/hack/hack.end.c
  21. +4 −5 games/hack/hack.engrave.c
  22. +2 −3 games/hack/hack.invent.c
  23. +2 −3 games/hack/hack.lev.c
  24. +3 −4 games/hack/hack.main.c
  25. +1 −2  games/hack/hack.objnam.c
  26. +2 −3 games/hack/hack.pager.c
  27. +1 −2  games/hack/hack.rumors.c
  28. +4 −5 games/hack/hack.save.c
  29. +8 −9 games/hack/hack.shk.c
  30. +1 −2  games/hack/hack.termcap.c
  31. +2 −3 games/hack/hack.topl.c
  32. +3 −4 games/hack/hack.unix.c
  33. +5 −6 games/hack/hack.vault.c
  34. +2 −3 games/hack/hack.worm.c
  35. +1 −2  games/hack/hack.worn.c
  36. +1 −2  games/larn/data.c
  37. +2 −3 games/larn/diag.c
  38. +2 −3 games/larn/io.c
  39. +5 −6 games/larn/main.c
  40. +5 −6 games/larn/monster.c
  41. +2 −3 games/larn/movem.c
  42. +5 −6 games/larn/tok.c
  43. +4 −5 games/rogue/hit.c
  44. +4 −5 games/sail/dr_1.c
  45. +2 −3 games/sail/dr_3.c
  46. +1 −2  games/sail/dr_5.c
  47. +1 −2  games/sail/lo_main.c
  48. +1 −2  games/sail/misc.c
  49. +1 −2  games/sail/pl_2.c
  50. +1 −2  games/sail/pl_3.c
  51. +1 −2  games/sail/pl_7.c
  52. +2 −3 games/sail/sync.c
  53. +1 −2  games/trek/getpar.c
  54. +1 −2  games/trek/kill.c
  55. +1 −2  games/trek/klmove.c
  56. +1 −2  lib/libalias/alias_db.c
  57. +2 −3 lib/libbluetooth/bluetooth.c
  58. +1 −2  lib/libc/citrus/citrus_iconv.h
  59. +1 −2  lib/libc/citrus/citrus_none.c
  60. +2 −3 lib/libc/citrus/modules/citrus_big5.c
  61. +2 −3 lib/libc/citrus/modules/citrus_euc.c
  62. +2 −3 lib/libc/citrus/modules/citrus_euctw.c
  63. +3 −4 lib/libc/citrus/modules/citrus_iso2022.c
  64. +1 −2  lib/libc/citrus/modules/citrus_johab.c
  65. +1 −2  lib/libc/citrus/modules/citrus_mskanji.c
  66. +2 −3 lib/libc/citrus/modules/citrus_utf1632.c
  67. +2 −3 lib/libc/citrus/modules/citrus_utf8.c
  68. +4 −5 lib/libc/gen/err.c
  69. +1 −2  lib/libc/gen/getmntinfo.c
  70. +2 −3 lib/libc/gen/getmntvinfo.c
  71. +7 −8 lib/libc/gen/getvfsent.c
  72. +2 −3 lib/libc/gen/tls.c
  73. +1 −2  lib/libc/locale/_wcstol.h
  74. +1 −2  lib/libc/locale/_wcstoul.h
  75. +1 −2  lib/libc/locale/setlocale.c
  76. +1 −2  lib/libc/net/base64.c
  77. +1 −2  lib/libc/net/gethostbyht.c
  78. +1 −2  lib/libc/net/getifaddrs.c
  79. +1 −2  lib/libc/net/getnetbyht.c
  80. +1 −2  lib/libc/net/getprotoname.c
  81. +2 −3 lib/libc/net/getservent.c
  82. +1 −2  lib/libc/net/rcmd.c
  83. +4 −4 lib/libc/resolv/mtctxres.c
  84. +2 −2 lib/libc/resolv/res_init.c
  85. +2 −2 lib/libc/resolv/res_mkupdate.c
  86. +2 −3 lib/libc/rpc/auth_none.c
  87. +3 −4 lib/libc/rpc/clnt_perror.c
  88. +1 −2  lib/libc/rpc/des_crypt.c
  89. +1 −1  lib/libc/rpc/getnetpath.c
  90. +1 −2  lib/libc/rpc/getpublickey.c
  91. +3 −3 lib/libc/rpc/key_call.c
  92. +2 −2 lib/libc/rpc/mt_misc.c
  93. +3 −4 lib/libc/rpc/rpcdname.c
  94. +1 −2  lib/libc/stdio/fputwc.c
  95. +1 −2  lib/libc/stdio/ungetwc.c
  96. +1 −3 lib/libc/stdlib/_strtol.h
  97. +1 −3 lib/libc/stdlib/_strtoul.h
  98. +1 −2  lib/libc/stdlib/tsearch.c
  99. +1 −2  lib/libc/uuid/uuid_to_string.c
  100. +1 −2  lib/libc/xdr/xdr_mem.c
  101. +1 −2  lib/libcompat/4.1/getpw.c
  102. +6 −6 lib/libcompat/4.3/rexec.c
  103. +1 −2  lib/libcompat/regexp/regexp.c
  104. +2 −2 lib/libedit/filecomplete.c
  105. +4 −4 lib/libevtr/ktrfmt.yy.c
  106. +1 −2  lib/libfetch/ftp.c
  107. +1 −2  lib/libipsec/pfkey.c
  108. +2 −3 lib/libipx/ipx_addr.c
  109. +1 −3 lib/libkcore/kcore_proc.c
  110. +3 −4 lib/libkvm/kvm.c
  111. +1 −2  lib/libkvm/kvm_file.c
  112. +1 −2  lib/libkvm/kvm_i386.c
  113. +1 −1  lib/libkvm/kvm_minidump_i386.c
  114. +1 −1  lib/libkvm/kvm_minidump_x86_64.c
  115. +9 −10 lib/libkvm/kvm_proc.c
  116. +1 −2  lib/libkvm/kvm_sparc.c
  117. +1 −1  lib/libkvm/kvm_x86_64.c
  118. +3 −2 lib/libm/src/e_j0.c
  119. +3 −2 lib/libm/src/e_j0f.c
  120. +3 −2 lib/libm/src/e_j1.c
  121. +3 −2 lib/libm/src/e_j1f.c
  122. +1 −1  lib/libpuffs/null.c
  123. +2 −3 lib/libstand/cd9660.c
  124. +3 −4 lib/libstand/nfs.c
  125. +1 −2  lib/libstand/strtol.c
  126. +2 −3 lib/libtelnet/auth.c
  127. +10 −11 lib/libtelnet/encrypt.c
  128. +4 −4 lib/libtelnet/genget.c
  129. +1 −2  lib/libtelnet/kerberos5.c
  130. +2 −3 lib/libtelnet/krb4encpwd.c
  131. +1 −2  lib/libtelnet/misc.c
  132. +1 −2  lib/libtelnet/pk.c
  133. +1 −2  lib/libtelnet/rsaencpwd.c
  134. +2 −2 lib/libthread_xu/thread/thr_private.h
  135. +3 −4 lib/libusbhid/usage.c
  136. +1 −2  lib/libvgl/text.c
  137. +2 −2 lib/libypclnt/ypclnt_passwd.c
  138. +2 −2 lib/pam_module/pam_login_access/login_access.c
  139. +2 −3 libexec/bootpd/tools/bootptest/print-bootp.c
  140. +6 −7 libexec/ftpd/ftpd.c
  141. +1 −2  libexec/ftpd/popen.c
  142. +1 −2  libexec/getty/subr.c
  143. +2 −3 libexec/rbootd/bpf.c
  144. +1 −2  libexec/rlogind/rlogind.c
  145. +1 −1  libexec/rtld-elf/rtld.c
  146. +3 −4 libexec/telnetd/state.c
  147. +3 −3 libexec/telnetd/sys_term.c
  148. +2 −3 libexec/telnetd/telnetd.c
  149. +1 −2  libexec/tftpd/tftpd.c
  150. +6 −6 sbin/disklabel32/disklabel.c
  151. +2 −2 sbin/disklabel64/disklabel64.c
  152. +1 −1  sbin/dump/itime.c
  153. +2 −2 sbin/fsck/fsutil.c
  154. +1 −2  sbin/fsck/inode.c
  155. +1 −2  sbin/fsck/pass4.c
  156. +1 −2  sbin/fsck/pass5.c
  157. +4 −5 sbin/fsck/preen.c
  158. +1 −2  sbin/fsck/utilities.c
  159. +1 −1  sbin/fsck_msdosfs/dir.c
  160. +1 −2  sbin/fsdb/fsdbutil.c
  161. +2 −2 sbin/ifconfig/af_inet.c
  162. +28 −28 sbin/init/init.c
  163. +2 −3 sbin/ip6fw/ip6fw.c
  164. +2 −2 sbin/ipfw/ipfw2.c
  165. +1 −1  sbin/iscontrol/config.c
  166. +1 −1  sbin/iscontrol/iscontrol.c
  167. +1 −1  sbin/mkinitrd/mini_init/oinit.c
  168. +3 −4 sbin/mount_portal/conf.c
  169. +3 −4 sbin/mount_portal/pt_tcp.c
  170. +3 −4 sbin/mount_portal/pt_tcplisten.c
  171. +1 −2  sbin/mountd/mountd.c
  172. +2 −3 sbin/ping6/ping6.c
  173. +2 −3 sbin/quotacheck/quotacheck.c
  174. +1 −2  sbin/restore/utilities.c
  175. +3 −3 sbin/route/route.c
  176. +46 −47 sbin/routed/if.c
  177. +26 −27 sbin/routed/input.c
  178. +11 −12 sbin/routed/main.c
  179. +19 −20 sbin/routed/output.c
  180. +12 −13 sbin/routed/parms.c
  181. +12 −13 sbin/routed/radix.c
  182. +18 −19 sbin/routed/rdisc.c
  183. +18 −19 sbin/routed/rtquery/rtquery.c
  184. +45 −46 sbin/routed/table.c
  185. +26 −27 sbin/routed/trace.c
  186. +3 −4 sbin/slattach/slattach.c
  187. +1 −2  sbin/startslip/startslip.c
  188. +1 −2  sbin/umount/umount.c
  189. +1 −1  test/interbench/hackbench.c
  190. +1 −1  test/stress/stress2/testcases/fts/fts.c
  191. +1 −1  test/stress/stress2/testcases/run/run.c
  192. +1 −1  test/stress/stress2/testcases/shm/shm.c
  193. +2 −2 test/testcases/crypto/aesctr/aesctr.c
  194. +1 −2  tools/regression/p1003_1b/sched.c
  195. +2 −6 tools/test/malloc/main.c
  196. +4 −4 tools/tools/net80211/stumbler/stumbler.c
  197. +1 −1  tools/tools/net80211/w00t/assoc/assoc.c
  198. +1 −1  tools/tools/net80211/w00t/expand/expand.c
  199. +1 −1  tools/tools/net80211/w00t/libw00t/w00t.c
  200. +2 −2 tools/tools/net80211/w00t/redir/redir.c
  201. +1 −1  tools/tools/net80211/wesside/dics/dics.c
  202. +7 −7 tools/tools/net80211/wesside/wesside/wesside.c
  203. +2 −2 tools/tools/net80211/wlanwatch/wlanwatch.c
  204. +1 −2  usr.bin/chat/chat.c
  205. +6 −7 usr.bin/doscmd/AsyncIO.c
  206. +1 −2  usr.bin/doscmd/config.c
  207. +6 −7 usr.bin/doscmd/cwd.c
  208. +7 −8 usr.bin/doscmd/doscmd.c
  209. +13 −14 usr.bin/doscmd/int13.c
  210. +3 −4 usr.bin/doscmd/int17.c
  211. +3 −4 usr.bin/doscmd/intff.c
  212. +1 −2  usr.bin/doscmd/mouse.c
  213. +3 −4 usr.bin/doscmd/port.c
  214. +6 −7 usr.bin/doscmd/tty.c
  215. +1 −2  usr.bin/ee/new_curse.c
  216. +1 −2  usr.bin/find/find.c
  217. +1 −2  usr.bin/find/function.c
  218. +2 −3 usr.bin/finger/net.c
  219. +2 −3 usr.bin/fmt/fmt.c
  220. +1 −2  usr.bin/gzip/gzip.c
  221. +2 −2 usr.bin/indent/lexi.c
  222. +4 −4 usr.bin/indent/pr_comment.c
  223. +1 −2  usr.bin/killall/killall.c
  224. +4 −4 usr.bin/lex/initscan.c
  225. +1 −2  usr.bin/lex/main.c
  226. +1 −1  usr.bin/lex/misc.c
  227. +1 −2  usr.bin/lex/sym.c
  228. +3 −4 usr.bin/login/login_fbtab.c
  229. +2 −3 usr.bin/m4/gnum4.c
  230. +4 −5 usr.bin/mail/cmd2.c
  231. +1 −2  usr.bin/mail/cmd3.c
  232. +2 −3 usr.bin/mail/lex.c
  233. +2 −3 usr.bin/mail/send.c
  234. +1 −2  usr.bin/make/job.c
  235. +2 −3 usr.bin/mkstr/mkstr.c
  236. +1 −1  usr.bin/netstat/if.c
  237. +4 −5 usr.bin/netstat/inet.c
  238. +2 −3 usr.bin/netstat/inet6.c
  239. +2 −3 usr.bin/netstat/ipx.c
  240. +2 −3 usr.bin/netstat/iso.c
  241. +1 −1  usr.bin/netstat/main.c
  242. +7 −7 usr.bin/netstat/route.c
  243. +1 −2  usr.bin/netstat/unix.c
  244. +1 −2  usr.bin/newkey/generic.c
  245. +1 −2  usr.bin/nfsstat/nfsstat.c
  246. +1 −2  usr.bin/quota/quota.c
  247. +3 −4 usr.bin/rdist/expand.c
  248. +1 −2  usr.bin/rdist/main.c
  249. +2 −3 usr.bin/rdist/rshrcmd.c
  250. +1 −2  usr.bin/rdist/server.c
  251. +7 −8 usr.bin/rpcgen/rpc_main.c
  252. +1 −2  usr.bin/rs/rs.c
  253. +3 −4 usr.bin/sed/compile.c
  254. +1 −1  usr.bin/sort/sort.c
  255. +2 −3 usr.bin/systat/mbufs.c
  256. +7 −7 usr.bin/systat/netcmds.c
  257. +3 −4 usr.bin/systat/netstat.c
  258. +1 −1  usr.bin/talk/get_addrs.c
  259. +34 −35 usr.bin/telnet/commands.c
  260. +1 −2  usr.bin/telnet/main.c
  261. +10 −11 usr.bin/telnet/telnet.c
  262. +1 −2  usr.bin/telnet/utilities.c
  263. +3 −3 usr.bin/tftp/main.c
  264. +1 −1  usr.bin/tip/libacu/v831.c
  265. +1 −1  usr.bin/tip/tip/value.c
  266. +2 −3 usr.bin/units/units.c
  267. +6 −6 usr.bin/usbhidctl/usbhid.c
  268. +1 −2  usr.bin/vmstat/vmstat.c
  269. +4 −5 usr.bin/whereis/whereis.c
  270. +10 −10 usr.bin/window/cmd.c
  271. +1 −1  usr.bin/window/cmd2.c
  272. +3 −3 usr.bin/window/cmd6.c
  273. +3 −3 usr.bin/window/cmd7.c
  274. +28 −28 usr.bin/window/compress.c
  275. +2 −2 usr.bin/window/context.c
  276. +4 −4 usr.bin/window/error.c
  277. +10 −10 usr.bin/window/lcmd1.c
  278. +12 −12 usr.bin/window/lcmd2.c
  279. +4 −4 usr.bin/window/main.c
  280. +17 −17 usr.bin/window/parser2.c
  281. +1 −1  usr.bin/window/parser4.c
  282. +2 −2 usr.bin/window/parser5.c
  283. +2 −2 usr.bin/window/startup.c
  284. +4 −4 usr.bin/window/string.c
  285. +11 −11 usr.bin/window/ttgeneric.c
  286. +2 −2 usr.bin/window/ttinit.c
  287. +3 −3 usr.bin/window/tttermcap.c
  288. +2 −2 usr.bin/window/ttwyse60.c
  289. +2 −2 usr.bin/window/ttwyse75.c
  290. +6 −6 usr.bin/window/var.c
  291. +8 −8 usr.bin/window/win.c
  292. +1 −1  usr.bin/window/wwalloc.c
  293. +1 −1  usr.bin/window/wwinit.c
  294. +1 −1  usr.bin/window/wwiomux.c
  295. +2 −2 usr.bin/window/wwopen.c
  296. +15 −15 usr.bin/window/wwsize.c
  297. +1 −1  usr.bin/window/wwunframe.c
  298. +5 −5 usr.bin/window/wwwrite.c
  299. +6 −6 usr.bin/window/xx.c
  300. +3 −3 usr.bin/window/xxflush.c
Sorry, we could not display the entire diff because too many files (368) changed.
View
7 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 <sys/cdefs.h>
@@ -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);
View
7 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 <sys/types.h>
@@ -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;
View
3  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 <sys/user.h>
@@ -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)
View
2  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++;
View
2  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);
View
2  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;
View
2  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;
}
View
5 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(&ltext[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(&ltext[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;
View
5 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);
View
21 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);
}
View
3  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++;
View
3  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 <string.h>
@@ -569,7 +568,7 @@ clear(void)
int i;
/* double space if can't clear */
- if (CL == 0) {
+ if (CL == NULL) {
writel("\n\n");
return;
}
View
3  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 <stdio.h>
@@ -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();
}
View
7 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 <sys/stat.h>
@@ -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;
}
View
5 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();
View
7 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 <sys/types.h>
@@ -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);
}
View
13 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 */
View
3  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) {
View
5 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
View
5 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;
View
9 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 *)&lth, sizeof(unsigned));
if (lth == 0)
View
5 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);
View
5 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 */
View
7 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 <sys/stat.h>
#include "hack.h"
@@ -345,7 +344,7 @@ main(int argc, char *argv[])
nomovemsg = 0;
if (afternmv)
(*afternmv)();
- afternmv = 0;
+ afternmv = NULL;
}
}
find_ac();
@@ -366,7 +365,7 @@ main(int argc, char *argv[])
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;
}
}
View
3  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';
View
5 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)
View
3  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);
View
9 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)
View
17 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;
View
3  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 <termcap.h>
#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(
View
5 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;
}
}
View
7 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")))
View
11 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 @@ invault(void)
gdlevel = dlevel;
if (!cansee(guard->mx, guard->my)) {
mondead(guard);
- guard = 0;
+ guard = NULL;
return;
}
@@ -175,7 +174,7 @@ invault(void)
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 @@ nextnxy: ;
void
gddead(void)
{
- guard = 0;
+ guard = NULL;
}
void
View
5 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
View
3  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) {
View
3  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" };
View
5 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 <sys/types.h>
#include <sys/times.h>
#include <sys/stat.h>
@@ -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;
}
View
5 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 */
}
View
11 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 <sys/types.h>
#include <sys/stat.h>
@@ -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 */
View
11 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 */
View
5 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 */
View
11 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 <sys/types.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
@@ -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;
View
9 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;
}
}
}
View
9 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;
}
View
5 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
View
3  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);
View
3  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);
}
View
3  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 <sys/file.h>
@@ -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) {
View
3  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);
View
3  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;