From 8bcd62f2ff6745726c72cb2d2b8c12180a820608 Mon Sep 17 00:00:00 2001 From: Kevin Lo Date: Fri, 21 Sep 2007 01:55:11 +0000 Subject: [PATCH] Use NULL instead of 0 for the return value of fopen(). Approved by: re (kensmith) --- usr.bin/at/at.c | 4 ++-- usr.bin/login/login_fbtab.c | 4 ++-- usr.bin/m4/gnum4.c | 2 +- usr.bin/mklocale/yacc.y | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c index 3eb3e740f7e4..71d8e607f9c9 100644 --- a/usr.bin/at/at.c +++ b/usr.bin/at/at.c @@ -184,7 +184,7 @@ nextjob() long jobno; FILE *fid; - if ((fid = fopen(ATJOB_DIR ".SEQ", "r+")) != (FILE*)0) { + if ((fid = fopen(ATJOB_DIR ".SEQ", "r+")) != NULL) { if (fscanf(fid, "%5lx", &jobno) == 1) { rewind(fid); jobno = (1+jobno) % 0xfffff; /* 2^20 jobs enough? */ @@ -195,7 +195,7 @@ nextjob() fclose(fid); return jobno; } - else if ((fid = fopen(ATJOB_DIR ".SEQ", "w")) != (FILE*)0) { + else if ((fid = fopen(ATJOB_DIR ".SEQ", "w")) != NULL) { fprintf(fid, "%05lx\n", jobno = 1); fclose(fid); return 1; diff --git a/usr.bin/login/login_fbtab.c b/usr.bin/login/login_fbtab.c index 684cf6131696..f6111a1cd352 100644 --- a/usr.bin/login/login_fbtab.c +++ b/usr.bin/login/login_fbtab.c @@ -93,8 +93,8 @@ gid_t gid; int prot; const char *table; - if ((fp = fopen(table = _PATH_FBTAB, "r")) == 0 - && (fp = fopen(table = _PATH_LOGINDEVPERM, "r")) == 0) + if ((fp = fopen(table = _PATH_FBTAB, "r")) == NULL + && (fp = fopen(table = _PATH_LOGINDEVPERM, "r")) == NULL) return; while (fgets(buf, sizeof(buf), fp)) { diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c index 8940bb820f77..f4cfa7786017 100644 --- a/usr.bin/m4/gnum4.c +++ b/usr.bin/m4/gnum4.c @@ -133,7 +133,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/mklocale/yacc.y b/usr.bin/mklocale/yacc.y index 84149f019480..899b186d93c4 100644 --- a/usr.bin/mklocale/yacc.y +++ b/usr.bin/mklocale/yacc.y @@ -234,7 +234,7 @@ main(int ac, char *av[]) break; case 'o': locale_file = optarg; - if ((fp = fopen(locale_file, "w")) == 0) + if ((fp = fopen(locale_file, "w")) == NULL) err(1, "%s", locale_file); atexit(cleanout); break;