From d8ac4091605cafeed429956439b3365036470356 Mon Sep 17 00:00:00 2001 From: phk Date: Thu, 18 Sep 1997 14:08:40 +0000 Subject: Many places in the code NULL is used in integer context, where plain 0 should be used. This happens to work because we #define NULL to 0, but is stylistically wrong and can cause problems for people trying to port bits of code to other environments. PR: 2752 Submitted by: Arne Henrik Juul --- usr.bin/mail/cmd1.c | 2 +- usr.bin/mail/cmd2.c | 26 +++++++++++++------------- usr.bin/mail/cmd3.c | 6 +++--- usr.bin/mail/collect.c | 4 ++-- usr.bin/mail/lex.c | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'usr.bin/mail') diff --git a/usr.bin/mail/cmd1.c b/usr.bin/mail/cmd1.c index e83a036..1f87fa8 100644 --- a/usr.bin/mail/cmd1.c +++ b/usr.bin/mail/cmd1.c @@ -152,7 +152,7 @@ from(msgvec) { register int *ip; - for (ip = msgvec; *ip != NULL; ip++) + for (ip = msgvec; *ip != 0; ip++) printhead(*ip); if (--ip >= msgvec) dot = &message[*ip - 1]; diff --git a/usr.bin/mail/cmd2.c b/usr.bin/mail/cmd2.c index ed46fb3..2c22dbe 100644 --- a/usr.bin/mail/cmd2.c +++ b/usr.bin/mail/cmd2.c @@ -58,7 +58,7 @@ next(msgvec) register int *ip, *ip2; int list[2], mdot; - if (*msgvec != NULL) { + if (*msgvec != 0) { /* * If some messages were supplied, find the @@ -73,10 +73,10 @@ next(msgvec) * message list which follows dot. */ - for (ip = msgvec; *ip != NULL; ip++) + for (ip = msgvec; *ip != 0; ip++) if (*ip > mdot) break; - if (*ip == NULL) + if (*ip == 0) ip = msgvec; ip2 = ip; do { @@ -85,9 +85,9 @@ next(msgvec) dot = mp; goto hitit; } - if (*ip2 != NULL) + if (*ip2 != 0) ip2++; - if (*ip2 == NULL) + if (*ip2 == 0) ip2 = msgvec; } while (ip2 != ip); printf("No messages applicable\n"); @@ -121,7 +121,7 @@ hitit: */ list[0] = dot - &message[0] + 1; - list[1] = NULL; + list[1] = 0; return(type(list)); } @@ -170,11 +170,11 @@ save1(str, mark, cmd, ignore) return(1); if (!f) { *msgvec = first(0, MMNORM); - if (*msgvec == NULL) { + if (*msgvec == 0) { printf("No messages to %s.\n", cmd); return(1); } - msgvec[1] = NULL; + msgvec[1] = 0; } if (f && getmsglist(str, msgvec, 0) < 0) return(1); @@ -291,7 +291,7 @@ deltype(msgvec) list[0] = dot - &message[0] + 1; if (list[0] > lastdot) { touch(dot); - list[1] = NULL; + list[1] = 0; return(type(list)); } printf("At EOF\n"); @@ -313,18 +313,18 @@ delm(msgvec) register *ip; int last; - last = NULL; - for (ip = msgvec; *ip != NULL; ip++) { + last = 0; + for (ip = msgvec; *ip != 0; ip++) { mp = &message[*ip - 1]; touch(mp); mp->m_flag |= MDELETED|MTOUCH; mp->m_flag &= ~(MPRESERVE|MSAVED|MBOX); last = *ip; } - if (last != NULL) { + if (last != 0) { dot = &message[last-1]; last = first(0, MDELETED); - if (last != NULL) { + if (last != 0) { dot = &message[last-1]; return(0); } diff --git a/usr.bin/mail/cmd3.c b/usr.bin/mail/cmd3.c index 54a5d5e..bb0c1e5 100644 --- a/usr.bin/mail/cmd3.c +++ b/usr.bin/mail/cmd3.c @@ -293,7 +293,7 @@ preserve(msgvec) printf("Cannot \"preserve\" in edit mode\n"); return(1); } - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; mp->m_flag |= MPRESERVE; @@ -312,7 +312,7 @@ unread(msgvec) { register int *ip; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { dot = &message[*ip-1]; dot->m_flag &= ~(MREAD|MTOUCH); dot->m_flag |= MSTATUS; @@ -330,7 +330,7 @@ messize(msgvec) register struct message *mp; register int *ip, mesg; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; printf("%d: %d/%ld\n", mesg, mp->m_lines, mp->m_size); diff --git a/usr.bin/mail/collect.c b/usr.bin/mail/collect.c index 9d54fd3..ab3a9a3 100644 --- a/usr.bin/mail/collect.c +++ b/usr.bin/mail/collect.c @@ -523,11 +523,11 @@ forward(ms, fp, f) return(0); if (*msgvec == 0) { *msgvec = first(0, MMNORM); - if (*msgvec == NULL) { + if (*msgvec == 0) { printf("No appropriate messages\n"); return(0); } - msgvec[1] = NULL; + msgvec[1] = 0; } if (f == 'f' || f == 'F') tabst = NOSTR; diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c index 2c7cb3e..c6fee20 100644 --- a/usr.bin/mail/lex.c +++ b/usr.bin/mail/lex.c @@ -342,9 +342,9 @@ execute(linebuf, contxt) if (c == 0) { *msgvec = first(com->c_msgflag, com->c_msgmask); - msgvec[1] = NULL; + msgvec[1] = 0; } - if (*msgvec == NULL) { + if (*msgvec == 0) { printf("No applicable messages\n"); break; } -- cgit v1.1