Don't use special null string pointer (NOSTR), just use NULL.

This commit is contained in:
wiz 2002-03-04 03:07:25 +00:00
parent 6f0fb25121
commit ab85015570
21 changed files with 247 additions and 248 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd1.c,v 1.15 2002/03/02 14:59:35 wiz Exp $ */
/* $NetBSD: cmd1.c,v 1.16 2002/03/04 03:07:25 wiz Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cmd1.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: cmd1.c,v 1.15 2002/03/02 14:59:35 wiz Exp $");
__RCSID("$NetBSD: cmd1.c,v 1.16 2002/03/04 03:07:25 wiz Exp $");
#endif
#endif /* not lint */
@ -145,7 +145,7 @@ screensize(void)
int s;
char *cp;
if ((cp = value("screen")) != NOSTR && (s = atoi(cp)) > 0)
if ((cp = value("screen")) != NULL && (s = atoi(cp)) > 0)
return s;
return screenheight - 4;
}
@ -183,7 +183,7 @@ printhead(int mesg)
mp = &message[mesg-1];
(void) readline(setinput(mp), headline, LINESIZE);
if ((subjline = hfield("subject", mp)) == NOSTR)
if ((subjline = hfield("subject", mp)) == NULL)
subjline = hfield("subj", mp);
/*
* Bletch!
@ -203,9 +203,9 @@ printhead(int mesg)
parse(headline, &hl, pbuf);
snprintf(wcount, LINESIZE, "%3ld/%-5ld", mp->m_lines, mp->m_size);
subjlen = screenwidth - 50 - strlen(wcount);
name = value("show-rcpt") != NOSTR ?
name = value("show-rcpt") != NULL ?
skin(hfield("to", mp)) : nameof(mp, 0);
if (subjline == NOSTR || subjlen < 0) /* pretty pathetic */
if (subjline == NULL || subjlen < 0) /* pretty pathetic */
printf("%c%c%3d %-20.20s %16.16s %s\n",
curind, dispc, mesg, name, hl.l_date, wcount);
else
@ -240,7 +240,7 @@ pcmdlist(void *v)
printf("\n");
cc = strlen(cp->c_name) + 2;
}
if ((cp+1)->c_name != NOSTR)
if ((cp+1)->c_name != NULL)
printf("%s, ", cp->c_name);
else
printf("%s\n", cp->c_name);
@ -312,8 +312,8 @@ type1(int *msgvec, int doign, int page)
obuf = stdout;
if (setjmp(pipestop))
goto close_pipe;
if (value("interactive") != NOSTR &&
(page || (cp = value("crt")) != NOSTR)) {
if (value("interactive") != NULL &&
(page || (cp = value("crt")) != NULL)) {
nlines = 0;
if (!page) {
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++)
@ -335,9 +335,9 @@ type1(int *msgvec, int doign, int page)
mp = &message[*ip - 1];
touch(mp);
dot = mp;
if (value("quiet") == NOSTR)
if (value("quiet") == NULL)
fprintf(obuf, "Message %d:\n", *ip);
(void) sendmessage(mp, obuf, doign ? ignore : 0, NOSTR);
(void) sendmessage(mp, obuf, doign ? ignore : 0, NULL);
}
close_pipe:
if (obuf != stdout) {
@ -378,7 +378,7 @@ top(void *v)
topl = 5;
valtop = value("toplines");
if (valtop != NOSTR) {
if (valtop != NULL) {
topl = atoi(valtop);
if (topl < 0 || topl > 10000)
topl = 5;
@ -388,7 +388,7 @@ top(void *v)
mp = &message[*ip - 1];
touch(mp);
dot = mp;
if (value("quiet") == NOSTR)
if (value("quiet") == NULL)
printf("Message %d:\n", *ip);
ibuf = setinput(mp);
c = mp->m_lines;
@ -452,9 +452,9 @@ folders(void *v)
printf("No value set for \"folder\"\n");
return 1;
}
if ((cmd = value("LISTER")) == NOSTR)
if ((cmd = value("LISTER")) == NULL)
cmd = "ls";
(void) run_command(cmd, 0, -1, -1, dirname, NOSTR, NOSTR);
(void) run_command(cmd, 0, -1, -1, dirname, NULL, NULL);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd2.c,v 1.13 2002/03/02 15:27:51 wiz Exp $ */
/* $NetBSD: cmd2.c,v 1.14 2002/03/04 03:07:25 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: cmd2.c,v 1.13 2002/03/02 15:27:51 wiz Exp $");
__RCSID("$NetBSD: cmd2.c,v 1.14 2002/03/04 03:07:25 wiz Exp $");
#endif
#endif /* not lint */
@ -170,7 +170,7 @@ save1(char str[], int markmsg, char *cmd, struct ignoretab *ignoretabs)
FILE *obuf;
msgvec = (int *) salloc((msgCount + 2) * sizeof *msgvec);
if ((fn = snarf(str, &f)) == NOSTR)
if ((fn = snarf(str, &f)) == NULL)
return(1);
if (!f) {
*msgvec = first(0, MMNORM);
@ -182,7 +182,7 @@ save1(char str[], int markmsg, char *cmd, struct ignoretab *ignoretabs)
}
if (f && getmsglist(str, msgvec, 0) < 0)
return(1);
if ((fn = expand(fn)) == NOSTR)
if ((fn = expand(fn)) == NULL)
return(1);
printf("\"%s\" ", fn);
fflush(stdout);
@ -191,13 +191,13 @@ save1(char str[], int markmsg, char *cmd, struct ignoretab *ignoretabs)
else
disp = "[New file]";
if ((obuf = Fopen(fn, "a")) == NULL) {
perror(NOSTR);
perror(NULL);
return(1);
}
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
mp = &message[*ip - 1];
touch(mp);
if (sendmessage(mp, obuf, ignoretabs, NOSTR) < 0) {
if (sendmessage(mp, obuf, ignoretabs, NULL) < 0) {
perror(fn);
Fclose(obuf);
return(1);
@ -228,7 +228,7 @@ swrite(void *v)
/*
* Snarf the file from the end of the command line and
* return a pointer to it. If there is no file attached,
* just return NOSTR. Put a null in front of the file
* just return NULL. Put a null in front of the file
* name so that the message list processing won't see it,
* unless the file name is the only thing on the line, in
* which case, return 0 in the reference flag variable.
@ -258,7 +258,7 @@ snarf(char linebuf[], int *flag)
cp--;
if (*cp == '\0') {
printf("No file specified.\n");
return(NOSTR);
return(NULL);
}
if (isspace((unsigned char)*cp))
*cp++ = 0;
@ -468,7 +468,7 @@ ignore1(char *list[], struct ignoretab *tab, char *which)
struct ignore *igp;
char **ap;
if (*list == NOSTR)
if (*list == NULL)
return igshow(tab, which);
for (ap = list; *ap != 0; ap++) {
istrcpy(field, *ap);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd3.c,v 1.13 2002/03/02 15:27:51 wiz Exp $ */
/* $NetBSD: cmd3.c,v 1.14 2002/03/04 03:07:25 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: cmd3.c,v 1.13 2002/03/02 15:27:51 wiz Exp $");
__RCSID("$NetBSD: cmd3.c,v 1.14 2002/03/04 03:07:25 wiz Exp $");
#endif
#endif /* not lint */
@ -67,9 +67,9 @@ shell(void *v)
(void) strcpy(cmd, str);
if (bangexp(cmd) < 0)
return 1;
if ((shellcmd = value("SHELL")) == NOSTR)
if ((shellcmd = value("SHELL")) == NULL)
shellcmd = _PATH_CSHELL;
(void) run_command(shellcmd, 0, -1, -1, "-c", cmd, NOSTR);
(void) run_command(shellcmd, 0, -1, -1, "-c", cmd, NULL);
(void) signal(SIGINT, sigint);
printf("!\n");
return 0;
@ -85,9 +85,9 @@ dosh(void *v)
sig_t sigint = signal(SIGINT, SIG_IGN);
char *shellcmd;
if ((shellcmd = value("SHELL")) == NOSTR)
if ((shellcmd = value("SHELL")) == NULL)
shellcmd = _PATH_CSHELL;
(void) run_command(shellcmd, 0, -1, -1, NOSTR, NOSTR, NOSTR);
(void) run_command(shellcmd, 0, -1, -1, NULL, NULL, NULL);
(void) signal(SIGINT, sigint);
putchar('\n');
return 0;
@ -176,10 +176,10 @@ schdir(void *v)
char **arglist = v;
char *cp;
if (*arglist == NOSTR)
if (*arglist == NULL)
cp = homedir;
else
if ((cp = expand(*arglist)) == NOSTR)
if ((cp = expand(*arglist)) == NULL)
return(1);
if (chdir(cp) < 0) {
perror(cp);
@ -192,7 +192,7 @@ int
respond(void *v)
{
int *msgvec = v;
if (value("Replyall") == NOSTR)
if (value("Replyall") == NULL)
return (_respond(msgvec));
else
return (_Respond(msgvec));
@ -218,11 +218,11 @@ _respond(int *msgvec)
mp = &message[msgvec[0] - 1];
touch(mp);
dot = mp;
if ((rcv = skin(hfield("from", mp))) == NOSTR)
if ((rcv = skin(hfield("from", mp))) == NULL)
rcv = skin(nameof(mp, 1));
if ((replyto = skin(hfield("reply-to", mp))) != NOSTR)
if ((replyto = skin(hfield("reply-to", mp))) != NULL)
np = extract(replyto, GTO);
else if ((cp = skin(hfield("to", mp))) != NOSTR)
else if ((cp = skin(hfield("to", mp))) != NULL)
np = extract(cp, GTO);
else
np = NIL;
@ -235,18 +235,18 @@ _respond(int *msgvec)
if (altnames)
for (ap = altnames; *ap; ap++)
np = delname(np, *ap);
if (np != NIL && replyto == NOSTR)
if (np != NIL && replyto == NULL)
np = cat(np, extract(rcv, GTO));
else if (np == NIL) {
if (replyto != NOSTR)
if (replyto != NULL)
printf("Empty reply-to field -- replying to author\n");
np = extract(rcv, GTO);
}
head.h_to = np;
if ((head.h_subject = hfield("subject", mp)) == NOSTR)
if ((head.h_subject = hfield("subject", mp)) == NULL)
head.h_subject = hfield("subj", mp);
head.h_subject = reedit(head.h_subject);
if (replyto == NOSTR && (cp = skin(hfield("cc", mp))) != NOSTR) {
if (replyto == NULL && (cp = skin(hfield("cc", mp))) != NULL) {
np = elide(extract(cp, GCC));
np = delname(np, myname);
if (altnames != 0)
@ -270,8 +270,8 @@ reedit(char *subj)
{
char *newsubj;
if (subj == NOSTR)
return NOSTR;
if (subj == NULL)
return NULL;
if ((subj[0] == 'r' || subj[0] == 'R') &&
(subj[1] == 'e' || subj[1] == 'E') &&
subj[2] == ':')
@ -368,7 +368,7 @@ set(void *v)
char varbuf[BUFSIZ], **ap, **p;
int errs, h, s;
if (*arglist == NOSTR) {
if (*arglist == NULL) {
for (h = 0, s = 1; h < HSHSIZE; h++)
for (vp = variables[h]; vp != NOVAR; vp = vp->v_link)
s++;
@ -376,14 +376,14 @@ set(void *v)
for (h = 0, p = ap; h < HSHSIZE; h++)
for (vp = variables[h]; vp != NOVAR; vp = vp->v_link)
*p++ = vp->v_name;
*p = NOSTR;
*p = NULL;
sort(ap);
for (p = ap; *p != NOSTR; p++)
for (p = ap; *p != NULL; p++)
printf("%s\t%s\n", *p, value(*p));
return(0);
}
errs = 0;
for (ap = arglist; *ap != NOSTR; ap++) {
for (ap = arglist; *ap != NULL; ap++) {
cp = *ap;
cp2 = varbuf;
while (*cp != '=' && *cp != '\0')
@ -415,7 +415,7 @@ unset(void *v)
char **ap;
errs = 0;
for (ap = arglist; *ap != NOSTR; ap++) {
for (ap = arglist; *ap != NULL; ap++) {
if ((vp2 = lookup(*ap)) == NOVAR) {
if (getenv(*ap)) {
unsetenv(*ap);
@ -456,7 +456,7 @@ group(void *v)
int s;
char **ap, *gname, **p;
if (*argv == NOSTR) {
if (*argv == NULL) {
for (h = 0, s = 1; h < HSHSIZE; h++)
for (gh = groups[h]; gh != NOGRP; gh = gh->g_link)
s++;
@ -464,13 +464,13 @@ group(void *v)
for (h = 0, p = ap; h < HSHSIZE; h++)
for (gh = groups[h]; gh != NOGRP; gh = gh->g_link)
*p++ = gh->g_name;
*p = NOSTR;
*p = NULL;
sort(ap);
for (p = ap; *p != NOSTR; p++)
for (p = ap; *p != NULL; p++)
printgroup(*p);
return(0);
}
if (argv[1] == NOSTR) {
if (argv[1] == NULL) {
printgroup(*argv);
return(0);
}
@ -490,7 +490,7 @@ group(void *v)
* later anyway.
*/
for (ap = argv+1; *ap != NOSTR; ap++) {
for (ap = argv+1; *ap != NULL; ap++) {
gp = (struct group *) calloc(sizeof *gp, 1);
gp->ge_name = vcopy(*ap);
gp->ge_link = gh->g_list;
@ -508,7 +508,7 @@ sort(char **list)
{
char **ap;
for (ap = list; *ap != NOSTR; ap++)
for (ap = list; *ap != NULL; ap++)
;
if (ap-list < 2)
return;
@ -545,7 +545,7 @@ file(void *v)
{
char **argv = v;
if (argv[0] == NOSTR) {
if (argv[0] == NULL) {
newfileinfo(0);
return 0;
}
@ -565,9 +565,9 @@ echo(void *v)
char **ap;
char *cp;
for (ap = argv; *ap != NOSTR; ap++) {
for (ap = argv; *ap != NULL; ap++) {
cp = *ap;
if ((cp = expand(cp)) != NOSTR) {
if ((cp = expand(cp)) != NULL) {
if (ap != argv)
putchar(' ');
printf("%s", cp);
@ -581,7 +581,7 @@ int
Respond(void *v)
{
int *msgvec = v;
if (value("Replyall") == NOSTR)
if (value("Replyall") == NULL)
return (_Respond(msgvec));
else
return (_respond(msgvec));
@ -605,14 +605,14 @@ _Respond(int msgvec[])
mp = &message[*ap - 1];
touch(mp);
dot = mp;
if ((cp = skin(hfield("from", mp))) == NOSTR)
if ((cp = skin(hfield("from", mp))) == NULL)
cp = skin(nameof(mp, 2));
head.h_to = cat(head.h_to, extract(cp, GTO));
}
if (head.h_to == NIL)
return 0;
mp = &message[msgvec[0] - 1];
if ((head.h_subject = hfield("subject", mp)) == NOSTR)
if ((head.h_subject = hfield("subject", mp)) == NULL)
head.h_subject = hfield("subj", mp);
head.h_subject = reedit(head.h_subject);
head.h_cc = NIL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: collect.c,v 1.23 2002/03/02 15:27:51 wiz Exp $ */
/* $NetBSD: collect.c,v 1.24 2002/03/04 03:07:25 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)collect.c 8.2 (Berkeley) 4/19/94";
#else
__RCSID("$NetBSD: collect.c,v 1.23 2002/03/02 15:27:51 wiz Exp $");
__RCSID("$NetBSD: collect.c,v 1.24 2002/03/04 03:07:25 wiz Exp $");
#endif
#endif /* not lint */
@ -133,14 +133,14 @@ collect(struct header *hp, int printheaders)
*/
t = GTO|GSUBJECT|GCC|GNL;
getsub = 0;
if (hp->h_subject == NOSTR && value("interactive") != NOSTR &&
(value("ask") != NOSTR || value("asksub") != NOSTR))
if (hp->h_subject == NULL && value("interactive") != NULL &&
(value("ask") != NULL || value("asksub") != NULL))
t &= ~GNL, getsub++;
if (printheaders) {
puthead(hp, stdout, t);
fflush(stdout);
}
if ((cp = value("escape")) != NOSTR)
if ((cp = value("escape")) != NULL)
escape = *cp;
else
escape = ESCAPE;
@ -173,8 +173,8 @@ cont:
c = readline(stdin, linebuf, LINESIZE);
colljmp_p = 0;
if (c < 0) {
if (value("interactive") != NOSTR &&
value("ignoreeof") != NOSTR && ++eofcount < 25) {
if (value("interactive") != NULL &&
value("ignoreeof") != NULL && ++eofcount < 25) {
printf("Use \".\" to terminate letter\n");
continue;
}
@ -185,10 +185,10 @@ cont:
eofcount = 0;
hadintr = 0;
if (linebuf[0] == '.' && linebuf[1] == '\0' &&
value("interactive") != NOSTR && !lastlong &&
(value("dot") != NOSTR || value("ignoreeof") != NOSTR))
value("interactive") != NULL && !lastlong &&
(value("dot") != NULL || value("ignoreeof") != NULL))
break;
if (linebuf[0] != escape || value("interactive") == NOSTR ||
if (linebuf[0] != escape || value("interactive") == NULL ||
lastlong) {
if (putline(collf, linebuf, !longline) < 0)
goto err;
@ -303,7 +303,7 @@ cont:
goto err;
}
if(*cp && (cp = value(cp)) != NOSTR) {
if(*cp && (cp = value(cp)) != NULL) {
printf("%s\n", cp);
if(putline(collf, cp, 1) < 0)
goto err;
@ -330,7 +330,7 @@ cont:
}
cp = expand(cp);
if (cp == NOSTR)
if (cp == NULL)
break;
if (*cp == '!') { /* insert stdout of command */
@ -349,10 +349,10 @@ cont:
}
(void) unlink(tempEdit);
if ((shellcmd = value("SHELL")) == NOSTR)
if ((shellcmd = value("SHELL")) == NULL)
shellcmd = _PATH_CSHELL;
rc2 = run_command(shellcmd, 0, nullfd, fileno(fbuf), "-c", cp+1, NOSTR);
rc2 = run_command(shellcmd, 0, nullfd, fileno(fbuf), "-c", cp+1, NULL);
close(nullfd);
@ -404,7 +404,7 @@ cont:
fprintf(stderr, "Write what file!?\n");
break;
}
if ((cp = expand(cp)) == NOSTR)
if ((cp = expand(cp)) == NULL)
break;
rewind(collf);
exwrite(cp, collf, 1);
@ -567,10 +567,10 @@ mespipe(FILE *fp, char cmd[])
* stdin = current message.
* stdout = new message.
*/
if ((shellcmd = value("SHELL")) == NOSTR)
if ((shellcmd = value("SHELL")) == NULL)
shellcmd = _PATH_CSHELL;
if (run_command(shellcmd,
0, fileno(fp), fileno(nf), "-c", cmd, NOSTR) < 0) {
0, fileno(fp), fileno(nf), "-c", cmd, NULL) < 0) {
(void) Fclose(nf);
goto out;
}
@ -605,7 +605,7 @@ forward(char ms[], FILE *fp, int f)
char *tabst;
msgvec = (int *) salloc((msgCount+1) * sizeof *msgvec);
if (msgvec == (int *) NOSTR)
if (msgvec == (int *) NULL)
return(0);
if (getmsglist(ms, msgvec, 0) < 0)
return(0);
@ -618,8 +618,8 @@ forward(char ms[], FILE *fp, int f)
msgvec[1] = 0;
}
if (f == 'f' || f == 'F')
tabst = NOSTR;
else if ((tabst = value("indentprefix")) == NOSTR)
tabst = NULL;
else if ((tabst = value("indentprefix")) == NULL)
tabst = "\t";
ig = isupper(f) ? NULL : ignore;
printf("Interpolating:");
@ -672,7 +672,7 @@ collint(int s)
* the control flow is subtle, because we can be called from ~q.
*/
if (!hadintr) {
if (value("ignore") != NOSTR) {
if (value("ignore") != NULL) {
puts("@");
fflush(stdout);
clearerr(stdin);
@ -682,7 +682,7 @@ collint(int s)
longjmp(colljmp, 1);
}
rewind(collf);
if (value("nosave") == NOSTR)
if (value("nosave") == NULL)
savedeadletter(collf);
longjmp(collabort, 1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: def.h,v 1.12 2002/03/02 14:59:38 wiz Exp $ */
/* $NetBSD: def.h,v 1.13 2002/03/04 03:07:25 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* @(#)def.h 8.4 (Berkeley) 4/20/95
* $NetBSD: def.h,v 1.12 2002/03/02 14:59:38 wiz Exp $
* $NetBSD: def.h,v 1.13 2002/03/04 03:07:25 wiz Exp $
*/
/*
@ -73,7 +73,6 @@
#define LINESIZE BUFSIZ /* max readable line width */
#define STRINGSIZE ((unsigned) 128)/* Dynamic allocation units */
#define MAXARGC 1024 /* Maximum list of raw strings */
#define NOSTR ((char *) 0) /* Null string pointer */
#define MAXEXP 25 /* Maximum expansion of aliases */
#define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */

View File

@ -1,4 +1,4 @@
/* $NetBSD: edit.c,v 1.10 2002/03/02 15:27:51 wiz Exp $ */
/* $NetBSD: edit.c,v 1.11 2002/03/04 03:07:25 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: edit.c,v 1.10 2002/03/02 15:27:51 wiz Exp $");
__RCSID("$NetBSD: edit.c,v 1.11 2002/03/04 03:07:25 wiz Exp $");
#endif
#endif /* not lint */
@ -187,9 +187,9 @@ run_editor(FILE *fp, off_t size, int editortype, int readonlyflag)
}
nf = NULL;
if ((editcmd =
value(editortype == 'e' ? "EDITOR" : "VISUAL")) == NOSTR)
value(editortype == 'e' ? "EDITOR" : "VISUAL")) == NULL)
editcmd = editortype == 'e' ? _PATH_EX : _PATH_VI;
if (run_command(editcmd, 0, -1, -1, tempEdit, NOSTR, NOSTR) < 0) {
if (run_command(editcmd, 0, -1, -1, tempEdit, NULL, NULL) < 0) {
(void) unlink(tempEdit);
goto out;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fio.c,v 1.16 2002/03/02 15:27:51 wiz Exp $ */
/* $NetBSD: fio.c,v 1.17 2002/03/04 03:07:25 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: fio.c,v 1.16 2002/03/02 15:27:51 wiz Exp $");
__RCSID("$NetBSD: fio.c,v 1.17 2002/03/04 03:07:25 wiz Exp $");
#endif
#endif /* not lint */
@ -351,11 +351,11 @@ expand(char *name)
break;
if (prevfile[0] == 0) {
printf("No previous file\n");
return NOSTR;
return NULL;
}
return savestr(prevfile);
case '&':
if (name[1] == 0 && (name = value("MBOX")) == NOSTR)
if (name[1] == 0 && (name = value("MBOX")) == NULL)
name = "~/mbox";
/* fall through */
}
@ -375,32 +375,32 @@ expand(char *name)
return name;
}
snprintf(cmdbuf, PATHSIZE, "echo %s", name);
if ((shellcmd = value("SHELL")) == NOSTR)
if ((shellcmd = value("SHELL")) == NULL)
shellcmd = _PATH_CSHELL;
pid = start_command(shellcmd, 0, -1, pivec[1], "-c", cmdbuf, NOSTR);
pid = start_command(shellcmd, 0, -1, pivec[1], "-c", cmdbuf, NULL);
if (pid < 0) {
close(pivec[0]);
close(pivec[1]);
return NOSTR;
return NULL;
}
close(pivec[1]);
l = read(pivec[0], xname, PATHSIZE);
close(pivec[0]);
if (wait_child(pid) < 0 && WTERMSIG(wait_status) != SIGPIPE) {
fprintf(stderr, "\"%s\": Expansion failed.\n", name);
return NOSTR;
return NULL;
}
if (l < 0) {
perror("read");
return NOSTR;
return NULL;
}
if (l == 0) {
fprintf(stderr, "\"%s\": No match.\n", name);
return NOSTR;
return NULL;
}
if (l == PATHSIZE) {
fprintf(stderr, "\"%s\": Expansion buffer overflow.\n", name);
return NOSTR;
return NULL;
}
xname[l] = '\0';
for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--)
@ -408,7 +408,7 @@ expand(char *name)
cp[1] = '\0';
if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) {
fprintf(stderr, "\"%s\": Ambiguous.\n", name);
return NOSTR;
return NULL;
}
return savestr(xname);
}
@ -421,7 +421,7 @@ getfold(char *name)
{
char *folder;
if ((folder = value("folder")) == NOSTR)
if ((folder = value("folder")) == NULL)
return (-1);
if (*folder == '/') {
strncpy(name, folder, PATHSIZE - 1);
@ -440,7 +440,7 @@ getdeadletter(void)
{
char *cp;
if ((cp = value("DEAD")) == NOSTR || (cp = expand(cp)) == NOSTR)
if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL)
cp = expand("~/dead.letter");
else if (*cp != '/') {
char buf[PATHSIZE];

View File

@ -1,4 +1,4 @@
/* $NetBSD: getname.c,v 1.7 2002/03/02 14:59:36 wiz Exp $ */
/* $NetBSD: getname.c,v 1.8 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)getname.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: getname.c,v 1.7 2002/03/02 14:59:36 wiz Exp $");
__RCSID("$NetBSD: getname.c,v 1.8 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -48,7 +48,7 @@ __RCSID("$NetBSD: getname.c,v 1.7 2002/03/02 14:59:36 wiz Exp $");
/* Getname / getuserid for those with hashed passwd data base). */
/*
* Search the passwd file for a uid. Return name on success, NOSTR on failure
* Search the passwd file for a uid. Return name on success, NULL on failure
*/
const char *
getname(int uid)
@ -56,7 +56,7 @@ getname(int uid)
struct passwd *pw;
if ((pw = getpwuid(uid)) == NULL)
return NOSTR;
return NULL;
return pw->pw_name;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: head.c,v 1.10 2002/03/02 14:00:26 wiz Exp $ */
/* $NetBSD: head.c,v 1.11 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: head.c,v 1.10 2002/03/02 14:00:26 wiz Exp $");
__RCSID("$NetBSD: head.c,v 1.11 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -68,7 +68,7 @@ ishead(char linebuf[])
*cp++ != ' ')
return (0);
parse(linebuf, &hl, parbuf);
if (hl.l_from == NOSTR || hl.l_date == NOSTR) {
if (hl.l_from == NULL || hl.l_date == NULL) {
fail(linebuf, "No from or date field");
return (0);
}
@ -88,7 +88,7 @@ fail(char linebuf[], char reason[])
{
/*
if (value("debug") == NOSTR)
if (value("debug") == NULL)
return;
fprintf(stderr, "\"%s\"\nnot a header because %s\n", linebuf, reason);
*/
@ -107,9 +107,9 @@ parse(char line[], struct headline *hl, char pbuf[])
char *sp;
char word[LINESIZE];
hl->l_from = NOSTR;
hl->l_tty = NOSTR;
hl->l_date = NOSTR;
hl->l_from = NULL;
hl->l_tty = NULL;
hl->l_date = NULL;
cp = line;
sp = pbuf;
/*
@ -119,11 +119,11 @@ parse(char line[], struct headline *hl, char pbuf[])
cp = nextword(cp, word);
if (*word)
hl->l_from = copyin(word, &sp);
if (cp != NOSTR && cp[0] == 't' && cp[1] == 't' && cp[2] == 'y') {
if (cp != NULL && cp[0] == 't' && cp[1] == 't' && cp[2] == 'y') {
cp = nextword(cp, word);
hl->l_tty = copyin(word, &sp);
}
if (cp != NOSTR)
if (cp != NULL)
hl->l_date = copyin(cp, &sp);
}
@ -225,16 +225,16 @@ cmatch(char *cp, char *tp)
/*
* Collect a liberal (space, tab delimited) word into the word buffer
* passed. Also, return a pointer to the next word following that,
* or NOSTR if none follow.
* or NULL if none follow.
*/
char *
nextword(char *wp, char *wbuf)
{
int c;
if (wp == NOSTR) {
if (wp == NULL) {
*wbuf = 0;
return (NOSTR);
return (NULL);
}
while ((c = *wp++) && c != ' ' && c != '\t') {
*wbuf++ = c;
@ -251,6 +251,6 @@ nextword(char *wp, char *wbuf)
for (; c == ' ' || c == '\t'; c = *wp++)
;
if (c == 0)
return (NOSTR);
return (NULL);
return (wp - 1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lex.c,v 1.17 2002/03/02 14:59:36 wiz Exp $ */
/* $NetBSD: lex.c,v 1.18 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: lex.c,v 1.17 2002/03/02 14:59:36 wiz Exp $");
__RCSID("$NetBSD: lex.c,v 1.18 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -73,7 +73,7 @@ setfile(char *name)
char *who = name[1] ? name + 1 : myname;
static int shudclob;
if ((name = expand(name)) == NOSTR)
if ((name = expand(name)) == NULL)
return -1;
if ((ibuf = Fopen(name, "r")) == NULL) {
@ -230,8 +230,8 @@ commands(void)
* Print the prompt, if needed. Clear out
* string space, and flush the output.
*/
if (!sourcing && value("interactive") != NOSTR) {
if ((value("autoinc") != NOSTR) && (incfile() > 0))
if (!sourcing && value("interactive") != NULL) {
if ((value("autoinc") != NULL) && (incfile() > 0))
printf("New mail has arrived.\n");
reset_on_stop = 1;
printf("%s", prompt);
@ -265,8 +265,8 @@ commands(void)
unstack();
continue;
}
if (value("interactive") != NOSTR &&
value("ignoreeof") != NOSTR &&
if (value("interactive") != NULL &&
value("ignoreeof") != NULL &&
++eofloop < 25) {
printf("Use \"quit\" to quit.\n");
continue;
@ -317,7 +317,7 @@ execute(char linebuf[], int contxt)
return(0);
}
cp2 = word;
while (*cp && strchr(" \t0123456789$^.:/-+*'\"", *cp) == NOSTR)
while (*cp && strchr(" \t0123456789$^.:/-+*'\"", *cp) == NULL)
*cp2++ = *cp++;
*cp2 = '\0';
@ -468,7 +468,7 @@ out:
}
if (com == NULL)
return(0);
if (value("autoprint") != NOSTR && com->c_argtype & P)
if (value("autoprint") != NULL && com->c_argtype & P)
if ((dot->m_flag & MDELETED) == 0) {
muvec[0] = dot - &message[0] + 1;
muvec[1] = 0;
@ -502,7 +502,7 @@ lex(char word[])
{
const struct cmd *cp;
for (cp = &cmdtab[0]; cp->c_name != NOSTR; cp++)
for (cp = &cmdtab[0]; cp->c_name != NULL; cp++)
if (isprefix(word, cp->c_name))
return(cp);
return(NONE);
@ -603,7 +603,7 @@ announce(void)
vec[0] = mdot;
vec[1] = 0;
dot = &message[mdot - 1];
if (msgCount > 0 && value("noheader") == NOSTR) {
if (msgCount > 0 && value("noheader") == NULL) {
inithdr++;
headers(vec);
inithdr = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: list.c,v 1.11 2002/03/02 14:59:37 wiz Exp $ */
/* $NetBSD: list.c,v 1.12 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: list.c,v 1.11 2002/03/02 14:59:37 wiz Exp $");
__RCSID("$NetBSD: list.c,v 1.12 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -238,7 +238,7 @@ number:
tok = scan(&bufp);
}
lastcolmod = colmod;
*np = NOSTR;
*np = NULL;
mc = 0;
if (star) {
for (i = 0; i < msgCount; i++)
@ -271,7 +271,7 @@ number:
if (np > namelist) {
for (i = 1; i <= msgCount; i++) {
for (mc = 0, np = &namelist[0]; *np != NOSTR; np++)
for (mc = 0, np = &namelist[0]; *np != NULL; np++)
if (**np == '/') {
if (matchsubj(*np, i)) {
mc++;
@ -301,7 +301,7 @@ number:
if (mc == 0) {
printf("No applicable messages from {%s",
namelist[0]);
for (np = &namelist[1]; *np != NOSTR; np++)
for (np = &namelist[1]; *np != NULL; np++)
printf(", %s", *np);
printf("}\n");
return(-1);
@ -471,7 +471,7 @@ getrawlist(char line[], char **argv, int argc)
*cp2 = '\0';
argv[argn++] = savestr(linebuf);
}
argv[argn] = NOSTR;
argv[argn] = NULL;
return argn;
}
@ -687,7 +687,7 @@ matchto(char *str, int mesg)
for (to = to_fields; *to; to++) {
cp = str;
cp2 = hfield(*to, mp);
if (cp2 != NOSTR) {
if (cp2 != NULL) {
backup = cp2;
while (*cp2) {
if (*cp == 0)
@ -745,7 +745,7 @@ matchsubj(char *str, int mesg)
cp = str;
cp2 = hfield("subject", mp);
}
if (cp2 == NOSTR)
if (cp2 == NULL)
return(0);
backup = cp2;
while (*cp2) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.13 2002/03/02 14:59:37 wiz Exp $ */
/* $NetBSD: main.c,v 1.14 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: main.c,v 1.13 2002/03/02 14:59:37 wiz Exp $");
__RCSID("$NetBSD: main.c,v 1.14 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -92,12 +92,12 @@ main(int argc, char *argv[])
* of users to mail to. Argp will be set to point to the
* first of these users.
*/
ef = NOSTR;
ef = NULL;
to = NIL;
cc = NIL;
bcc = NIL;
smopts = NIL;
subject = NOSTR;
subject = NULL;
while ((i = getopt(argc, argv, "~EINT:b:c:dfins:u:v")) != -1) {
switch (i) {
case 'T':
@ -211,11 +211,11 @@ Usage: mail [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
/*
* Check for inconsistent arguments.
*/
if (to == NIL && (subject != NOSTR || cc != NIL || bcc != NIL)) {
if (to == NIL && (subject != NULL || cc != NIL || bcc != NIL)) {
fputs("You must specify direct recipients with -s, -c, or -b.\n", stderr);
exit(1);
}
if (ef != NOSTR && to != NIL) {
if (ef != NULL && to != NIL) {
fprintf(stderr, "Cannot give -f and people to send to.\n");
exit(1);
}
@ -245,14 +245,14 @@ Usage: mail [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
* Decide whether we are editing a mailbox or reading
* the system mailbox, and open up the right stuff.
*/
if (ef == NOSTR)
if (ef == NULL)
ef = "%";
if (setfile(ef) < 0)
exit(1); /* error already reported */
if (setjmp(hdrjmp) == 0) {
if ((prevint = signal(SIGINT, SIG_IGN)) != SIG_IGN)
signal(SIGINT, hdrstop);
if (value("quiet") == NOSTR)
if (value("quiet") == NULL)
printf("Mail version %s. Type ? for help.\n",
version);
announce();

View File

@ -1,4 +1,4 @@
/* $NetBSD: names.c,v 1.11 2002/03/02 15:27:52 wiz Exp $ */
/* $NetBSD: names.c,v 1.12 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)names.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: names.c,v 1.11 2002/03/02 15:27:52 wiz Exp $");
__RCSID("$NetBSD: names.c,v 1.12 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -99,12 +99,12 @@ extract(char line[], int ntype)
struct name *begin, *np, *t;
char nbuf[BUFSIZ];
if (line == NOSTR || *line == '\0')
if (line == NULL || *line == '\0')
return NIL;
begin = NIL;
np = NIL;
cp = line;
while ((cp = yankword(cp, nbuf)) != NOSTR) {
while ((cp = yankword(cp, nbuf)) != NULL) {
t = nalloc(nbuf, ntype);
if (begin == NIL)
begin = t;
@ -129,7 +129,7 @@ detract(struct name *np, int ntype)
comma = ntype & GCOMMA;
if (np == NIL)
return(NOSTR);
return(NULL);
ntype &= ~GCOMMA;
s = 0;
if (debug && comma)
@ -142,7 +142,7 @@ detract(struct name *np, int ntype)
s++;
}
if (s == 0)
return(NOSTR);
return(NULL);
s += 2;
begin = salloc(s);
cp = begin;
@ -172,7 +172,7 @@ yankword(char *ap, char wbuf[])
cp = ap;
for (;;) {
if (*cp == '\0')
return NOSTR;
return NULL;
if (*cp == '(') {
int nesting = 0;
@ -290,14 +290,14 @@ outof(struct name *names, FILE *fo, struct header *hp)
* share the same lseek location and trample
* on one another.
*/
if ((shellcmd = value("SHELL")) == NOSTR)
if ((shellcmd = value("SHELL")) == NULL)
shellcmd = _PATH_CSHELL;
sigemptyset(&nset);
sigaddset(&nset, SIGHUP);
sigaddset(&nset, SIGINT);
sigaddset(&nset, SIGQUIT);
pid = start_command(shellcmd, &nset,
image, -1, "-c", fname, NOSTR);
image, -1, "-c", fname, NULL);
if (pid < 0) {
senderr++;
goto cant;
@ -387,7 +387,7 @@ usermap(struct name *names)
new = NIL;
np = names;
metoo = (value("metoo") != NOSTR);
metoo = (value("metoo") != NULL);
while (np != NIL) {
if (np->n_name[0] == '\\') {
cp = np->n_flink;
@ -493,10 +493,10 @@ unpack(struct name *np)
*/
extra = 2;
extra++;
metoo = value("metoo") != NOSTR;
metoo = value("metoo") != NULL;
if (metoo)
extra++;
verbose = value("verbose") != NOSTR;
verbose = value("verbose") != NULL;
if (verbose)
extra++;
begin = (char **) salloc((t + extra) * sizeof *begin);
@ -510,7 +510,7 @@ unpack(struct name *np)
for (; n != NIL; n = n->n_flink)
if ((n->n_type & GDEL) == 0)
*ap++ = n->n_name;
*ap = NOSTR;
*ap = NULL;
return(begin);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: popen.c,v 1.11 2002/03/02 15:27:52 wiz Exp $ */
/* $NetBSD: popen.c,v 1.12 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: popen.c,v 1.11 2002/03/02 15:27:52 wiz Exp $");
__RCSID("$NetBSD: popen.c,v 1.12 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -122,7 +122,7 @@ Popen(char *cmd, char *mode)
fd1 = -1;
}
sigemptyset(&nset);
if ((pid = start_command(cmd, &nset, fd0, fd1, NOSTR, NOSTR, NOSTR)) < 0) {
if ((pid = start_command(cmd, &nset, fd0, fd1, NULL, NULL, NULL)) < 0) {
close(p[READ]);
close(p[WRITE]);
return NULL;
@ -236,10 +236,10 @@ start_command(char *cmd, sigset_t *mask, int infd, int outfd,
char *argv[100];
int i = getrawlist(cmd, argv, sizeof argv / sizeof *argv);
if ((argv[i++] = a0) != NOSTR &&
(argv[i++] = a1) != NOSTR &&
(argv[i++] = a2) != NOSTR)
argv[i] = NOSTR;
if ((argv[i++] = a0) != NULL &&
(argv[i++] = a1) != NULL &&
(argv[i++] = a2) != NULL)
argv[i] = NULL;
prepare_child(mask, infd, outfd);
execvp(argv[0], argv);
perror(argv[0]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: quit.c,v 1.13 2002/03/02 14:59:37 wiz Exp $ */
/* $NetBSD: quit.c,v 1.14 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)quit.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: quit.c,v 1.13 2002/03/02 14:59:37 wiz Exp $");
__RCSID("$NetBSD: quit.c,v 1.14 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -162,10 +162,10 @@ nolock:
*/
anystat = 0;
autohold = value("hold") != NOSTR;
autohold = value("hold") != NULL;
holdbit = autohold ? MPRESERVE : MBOX;
nohold = MBOX|MSAVED|MDELETED|MPRESERVE;
if (value("keepsave") != NOSTR)
if (value("keepsave") != NULL)
nohold &= ~MSAVED;
for (mp = &message[0]; mp < &message[msgCount]; mp++) {
if (mp->m_flag & MNEW) {
@ -180,9 +180,9 @@ nolock:
mp->m_flag |= holdbit;
}
modify = 0;
if (Tflag != NOSTR) {
if (Tflag != NULL) {
if ((readstat = Fopen(Tflag, "w")) == NULL)
Tflag = NOSTR;
Tflag = NULL;
}
for (c = 0, p = 0, mp = &message[0]; mp < &message[msgCount]; mp++) {
if (mp->m_flag & MBOX)
@ -191,14 +191,14 @@ nolock:
p++;
if (mp->m_flag & MODIFY)
modify++;
if (Tflag != NOSTR && (mp->m_flag & (MREAD|MDELETED)) != 0) {
if (Tflag != NULL && (mp->m_flag & (MREAD|MDELETED)) != 0) {
char *id;
if ((id = hfield("article-id", mp)) != NOSTR)
if ((id = hfield("article-id", mp)) != NULL)
fprintf(readstat, "%s\n", id);
}
}
if (Tflag != NOSTR)
if (Tflag != NULL)
Fclose(readstat);
if (p == msgCount && !modify && !anystat) {
printf("Held %d message%s in %s\n",
@ -226,7 +226,7 @@ nolock:
mbox = expand("&");
mcount = c;
if (value("append") == NOSTR) {
if (value("append") == NULL) {
if ((obuf = Fopen(tempQuit, "w")) == NULL) {
perror(tempQuit);
Fclose(fbuf);
@ -276,7 +276,7 @@ nolock:
}
for (mp = &message[0]; mp < &message[msgCount]; mp++)
if (mp->m_flag & MBOX)
if (sendmessage(mp, obuf, saveignore, NOSTR) < 0) {
if (sendmessage(mp, obuf, saveignore, NULL) < 0) {
perror(mbox);
Fclose(ibuf);
Fclose(obuf);
@ -291,7 +291,7 @@ nolock:
* If we are appending, this is unnecessary.
*/
if (value("append") == NOSTR) {
if (value("append") == NULL) {
rewind(ibuf);
c = getc(ibuf);
while (c != EOF) {
@ -404,7 +404,7 @@ writeback(FILE *res)
for (mp = &message[0]; mp < &message[msgCount]; mp++)
if ((mp->m_flag&MPRESERVE)||(mp->m_flag&MTOUCH)==0) {
p++;
if (sendmessage(mp, obuf, (struct ignoretab *)0, NOSTR) < 0) {
if (sendmessage(mp, obuf, (struct ignoretab *)0, NULL) < 0) {
perror(mailname);
Fclose(obuf);
return(-1);
@ -450,9 +450,9 @@ edstop(void)
if (readonly)
return;
holdsigs();
if (Tflag != NOSTR) {
if (Tflag != NULL) {
if ((readstat = Fopen(Tflag, "w")) == NULL)
Tflag = NOSTR;
Tflag = NULL;
}
for (mp = &message[0], gotcha = 0; mp < &message[msgCount]; mp++) {
if (mp->m_flag & MNEW) {
@ -461,16 +461,16 @@ edstop(void)
}
if (mp->m_flag & (MODIFY|MDELETED|MSTATUS))
gotcha++;
if (Tflag != NOSTR && (mp->m_flag & (MREAD|MDELETED)) != 0) {
if (Tflag != NULL && (mp->m_flag & (MREAD|MDELETED)) != 0) {
char *id;
if ((id = hfield("article-id", mp)) != NOSTR)
if ((id = hfield("article-id", mp)) != NULL)
fprintf(readstat, "%s\n", id);
}
}
if (Tflag != NOSTR)
if (Tflag != NULL)
Fclose(readstat);
if (!gotcha || Tflag != NOSTR)
if (!gotcha || Tflag != NULL)
goto done;
ibuf = NULL;
if (stat(mailname, &statb) >= 0 && statb.st_size > mailsize) {
@ -524,7 +524,7 @@ edstop(void)
if ((mp->m_flag & MDELETED) != 0)
continue;
c++;
if (sendmessage(mp, obuf, (struct ignoretab *) NULL, NOSTR) < 0) {
if (sendmessage(mp, obuf, (struct ignoretab *) NULL, NULL) < 0) {
perror(mailname);
relsesigs();
reset(0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: send.c,v 1.15 2002/03/02 15:27:52 wiz Exp $ */
/* $NetBSD: send.c,v 1.16 2002/03/04 03:07:26 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)send.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: send.c,v 1.15 2002/03/02 15:27:52 wiz Exp $");
__RCSID("$NetBSD: send.c,v 1.16 2002/03/04 03:07:26 wiz Exp $");
#endif
#endif /* not lint */
@ -76,7 +76,7 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign,
/*
* Compute the prefix string, without trailing whitespace
*/
if (prefix != NOSTR) {
if (prefix != NULL) {
cp2 = 0;
for (cp = prefix; *cp; cp++)
if (*cp != ' ' && *cp != '\t')
@ -178,7 +178,7 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign,
* Strip trailing whitespace from prefix
* if line is blank.
*/
if (prefix != NOSTR) {
if (prefix != NULL) {
if (length > 1)
fputs(prefix, obuf);
else
@ -195,7 +195,7 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign,
*/
if (doign == ignoreall)
len--; /* skip final blank line */
if (prefix != NOSTR)
if (prefix != NULL)
while (len > 0) {
if (fgets(line, LINESIZE, ibuf) == NULL) {
c = 0;
@ -247,7 +247,7 @@ statusput(struct message *mp, FILE *obuf, char *prefix)
*cp = 0;
if (statout[0])
fprintf(obuf, "%sStatus: %s\n",
prefix == NOSTR ? "" : prefix, statout);
prefix == NULL ? "" : prefix, statout);
}
/*
@ -281,7 +281,7 @@ sendmail(void *v)
struct header head;
head.h_to = extract(str, GTO);
head.h_subject = NOSTR;
head.h_subject = NULL;
head.h_cc = NIL;
head.h_bcc = NIL;
head.h_smopts = NIL;
@ -308,11 +308,11 @@ mail1(struct header *hp, int printheaders)
*/
if ((mtf = collect(hp, printheaders)) == NULL)
return;
if (value("interactive") != NOSTR) {
if (value("askcc") != NOSTR || value("askbcc") != NOSTR) {
if (value("askcc") != NOSTR)
if (value("interactive") != NULL) {
if (value("askcc") != NULL || value("askbcc") != NULL) {
if (value("askcc") != NULL)
grabh(hp, GCC);
if (value("askbcc") != NOSTR)
if (value("askbcc") != NULL)
grabh(hp, GBCC);
} else {
printf("EOT\n");
@ -320,9 +320,9 @@ mail1(struct header *hp, int printheaders)
}
}
if (fsize(mtf) == 0) {
if (value("dontsendempty") != NOSTR)
if (value("dontsendempty") != NULL)
goto out;
if (hp->h_subject == NOSTR)
if (hp->h_subject == NULL)
printf("No message, no subject; hope that's ok\n");
else
printf("Null message body; hope that's ok\n");
@ -358,12 +358,12 @@ mail1(struct header *hp, int printheaders)
char **t;
printf("Sendmail arguments:");
for (t = namelist; *t != NOSTR; t++)
for (t = namelist; *t != NULL; t++)
printf(" \"%s\"", *t);
printf("\n");
goto out;
}
if ((cp = value("record")) != NOSTR)
if ((cp = value("record")) != NULL)
(void) savemail(expand(cp), mtf);
/*
* Fork, set up the temporary mail file as standard
@ -386,7 +386,7 @@ mail1(struct header *hp, int printheaders)
sigaddset(&nset, SIGTTIN);
sigaddset(&nset, SIGTTOU);
prepare_child(&nset, fileno(mtf), -1);
if ((cp = value("sendmail")) != NOSTR)
if ((cp = value("sendmail")) != NULL)
cp = expand(cp);
else
cp = _PATH_SENDMAIL;
@ -394,7 +394,7 @@ mail1(struct header *hp, int printheaders)
perror(cp);
_exit(1);
}
if (value("verbose") != NOSTR)
if (value("verbose") != NULL)
(void) wait_child(pid);
else
free_child(pid);
@ -486,7 +486,7 @@ puthead(struct header *hp, FILE *fo, int w)
gotcha = 0;
if (hp->h_to != NIL && w & GTO)
fmt("To:", hp->h_to, fo, w&GCOMMA), gotcha++;
if (hp->h_subject != NOSTR && w & GSUBJECT)
if (hp->h_subject != NULL && w & GSUBJECT)
fprintf(fo, "Subject: %s\n", hp->h_subject), gotcha++;
if (hp->h_cc != NIL && w & GCC)
fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: strings.c,v 1.8 2002/03/02 15:27:52 wiz Exp $ */
/* $NetBSD: strings.c,v 1.9 2002/03/04 03:07:27 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)strings.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: strings.c,v 1.8 2002/03/02 15:27:52 wiz Exp $");
__RCSID("$NetBSD: strings.c,v 1.9 2002/03/04 03:07:27 wiz Exp $");
#endif
#endif /* not lint */
@ -74,7 +74,7 @@ salloc(int size)
s &= ~(sizeof (char *) - 1);
idx = 0;
for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
if (sp->s_topFree == NOSTR && (STRINGSIZE << idx) >= s)
if (sp->s_topFree == NULL && (STRINGSIZE << idx) >= s)
break;
if (sp->s_nleft >= s)
break;
@ -82,10 +82,10 @@ salloc(int size)
}
if (sp >= &stringdope[NSPACE])
errx(1, "String too large");
if (sp->s_topFree == NOSTR) {
if (sp->s_topFree == NULL) {
idx = sp - &stringdope[0];
sp->s_topFree = malloc(STRINGSIZE << idx);
if (sp->s_topFree == NOSTR)
if (sp->s_topFree == NULL)
errx(1, "No room for space %d", idx);
sp->s_nextFree = sp->s_topFree;
sp->s_nleft = STRINGSIZE << idx;
@ -111,7 +111,7 @@ sreset(void)
return;
idx = 0;
for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) {
if (sp->s_topFree == NOSTR)
if (sp->s_topFree == NULL)
continue;
sp->s_nextFree = sp->s_topFree;
sp->s_nleft = STRINGSIZE << idx;
@ -129,5 +129,5 @@ spreserve(void)
struct strings *sp;
for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++)
sp->s_topFree = NOSTR;
sp->s_topFree = NULL;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: support.c,v 1.3 2002/03/02 15:27:52 wiz Exp $ */
/* $NetBSD: support.c,v 1.4 2002/03/04 03:07:27 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: support.c,v 1.3 2002/03/02 15:27:52 wiz Exp $");
__RCSID("$NetBSD: support.c,v 1.4 2002/03/04 03:07:27 wiz Exp $");
#endif
#endif /* not lint */
@ -61,7 +61,7 @@ savestr(const char *str)
char *new;
int size = strlen(str) + 1;
if ((new = salloc(size)) != NOSTR)
if ((new = salloc(size)) != NULL)
memmove(new, str, size);
return new;
}
@ -76,7 +76,7 @@ save2str(char *str, char *old)
int newsize = strlen(str) + 1;
int oldsize = old ? strlen(old) + 1 : 0;
if ((new = salloc(newsize + oldsize)) != NOSTR) {
if ((new = salloc(newsize + oldsize)) != NULL) {
if (oldsize) {
memmove(new, old, oldsize);
new[oldsize - 1] = ' ';
@ -122,14 +122,14 @@ argcount(char **argv)
{
char **ap;
for (ap = argv; *ap++ != NOSTR;)
for (ap = argv; *ap++ != NULL;)
;
return ap - argv - 1;
}
/*
* Return the desired header line from the passed message
* pointer (or NOSTR if the desired header field is not available).
* pointer (or NULL if the desired header field is not available).
*/
char *
hfield(char field[], struct message *mp)
@ -138,13 +138,13 @@ hfield(char field[], struct message *mp)
char linebuf[LINESIZE];
int lc;
char *headerfield;
char *colon, *oldhfield = NOSTR;
char *colon, *oldhfield = NULL;
ibuf = setinput(mp);
if ((lc = mp->m_lines - 1) < 0)
return NOSTR;
return NULL;
if (readline(ibuf, linebuf, LINESIZE) < 0)
return NOSTR;
return NULL;
while (lc > 0) {
if ((lc = gethfield(ibuf, linebuf, lc, &colon)) < 0)
return oldhfield;
@ -273,7 +273,7 @@ source(void *v)
FILE *fi;
char *cp;
if ((cp = expand(*arglist)) == NOSTR)
if ((cp = expand(*arglist)) == NULL)
return(1);
if ((fi = Fopen(cp, "r")) == NULL) {
perror(cp);
@ -413,10 +413,10 @@ skin(char *name)
int gotlt, lastsp;
char nbuf[BUFSIZ];
if (name == NOSTR)
return(NOSTR);
if (strchr(name, '(') == NOSTR && strchr(name, '<') == NOSTR
&& strchr(name, ' ') == NOSTR)
if (name == NULL)
return(NULL);
if (strchr(name, '(') == NULL && strchr(name, '<') == NULL
&& strchr(name, ' ') == NULL)
return(name);
gotlt = 0;
lastsp = 0;
@ -520,9 +520,9 @@ name1(struct message *mp, int reptype)
FILE *ibuf;
int firstrun = 1;
if ((cp = hfield("from", mp)) != NOSTR)
if ((cp = hfield("from", mp)) != NULL)
return cp;
if (reptype == 0 && (cp = hfield("sender", mp)) != NOSTR)
if (reptype == 0 && (cp = hfield("sender", mp)) != NULL)
return cp;
ibuf = setinput(mp);
namebuf[0] = '\0';

View File

@ -1,4 +1,4 @@
/* $NetBSD: temp.c,v 1.8 2002/03/02 14:59:38 wiz Exp $ */
/* $NetBSD: temp.c,v 1.9 2002/03/04 03:07:27 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)temp.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: temp.c,v 1.8 2002/03/02 14:59:38 wiz Exp $");
__RCSID("$NetBSD: temp.c,v 1.9 2002/03/04 03:07:27 wiz Exp $");
#endif
#endif /* not lint */
@ -77,21 +77,21 @@ tinit(void)
* It's okay to call savestr in here because main will
* do a spreserve() after us.
*/
if (myname != NOSTR) {
if (myname != NULL) {
if (getuserid(myname) < 0) {
printf("\"%s\" is not a user of this system\n",
myname);
exit(1);
}
} else {
if ((cp = username()) == NOSTR) {
if ((cp = username()) == NULL) {
myname = "nobody";
if (rcvmode)
exit(1);
} else
myname = savestr(cp);
}
if ((cp = getenv("HOME")) == NOSTR)
if ((cp = getenv("HOME")) == NULL)
cp = ".";
homedir = savestr(cp);
if (debug)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.12 2002/03/02 14:59:38 wiz Exp $ */
/* $NetBSD: tty.c,v 1.13 2002/03/04 03:07:27 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.2 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: tty.c,v 1.12 2002/03/02 14:59:38 wiz Exp $");
__RCSID("$NetBSD: tty.c,v 1.13 2002/03/04 03:07:27 wiz Exp $");
#endif
#endif /* not lint */
@ -131,7 +131,7 @@ grabh(struct header *hp, int gflags)
}
if (gflags & GSUBJECT) {
#ifndef TIOCSTI
if (!ttyset && hp->h_subject != NOSTR)
if (!ttyset && hp->h_subject != NULL)
ttyset++, tcsetattr(fileno(stdin), TCSADRAIN, &ttybuf);
#endif
hp->h_subject = readtty("Subject: ", hp->h_subject);
@ -196,19 +196,19 @@ readtty(char pr[], char src[])
fputs(pr, stdout);
fflush(stdout);
if (src != NOSTR && strlen(src) > BUFSIZ - 2) {
if (src != NULL && strlen(src) > BUFSIZ - 2) {
printf("too long to edit\n");
return(src);
}
#ifndef TIOCSTI
if (src != NOSTR)
if (src != NULL)
cp = copy(src, canonb);
else
cp = copy("", canonb);
fputs(canonb, stdout);
fflush(stdout);
#else
cp = src == NOSTR ? "" : src;
cp = src == NULL ? "" : src;
while ((c = *cp++) != '\0') {
if ((c_erase != _POSIX_VDISABLE && c == c_erase) ||
(c_kill != _POSIX_VDISABLE && c == c_kill)) {
@ -243,16 +243,16 @@ readtty(char pr[], char src[])
signal(SIGTTIN, SIG_DFL);
if (c == EOF && ferror(stdin)) {
redo:
cp = strlen(canonb) > 0 ? canonb : NOSTR;
cp = strlen(canonb) > 0 ? canonb : NULL;
clearerr(stdin);
return(readtty(pr, cp));
}
#ifndef TIOCSTI
if (cp == NOSTR || *cp == '\0')
if (cp == NULL || *cp == '\0')
return(src);
cp2 = cp;
if (!ttyset)
return(strlen(canonb) > 0 ? savestr(canonb) : NOSTR);
return(strlen(canonb) > 0 ? savestr(canonb) : NULL);
while (*cp != '\0') {
c = *cp++;
if (c_erase != _POSIX_VDISABLE && c == c_erase) {
@ -280,7 +280,7 @@ redo:
*cp2 = '\0';
#endif
if (equal("", canonb))
return(NOSTR);
return(NULL);
return(savestr(canonb));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: v7.local.c,v 1.11 2002/03/02 14:59:38 wiz Exp $ */
/* $NetBSD: v7.local.c,v 1.12 2002/03/04 03:07:27 wiz Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)v7.local.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: v7.local.c,v 1.11 2002/03/02 14:59:38 wiz Exp $");
__RCSID("$NetBSD: v7.local.c,v 1.12 2002/03/04 03:07:27 wiz Exp $");
#endif
#endif /* not lint */
@ -77,7 +77,7 @@ void
demail(void)
{
if (value("keep") != NOSTR || rm(mailname) < 0)
if (value("keep") != NULL || rm(mailname) < 0)
(void)close(creat(mailname, 0600));
}
@ -90,10 +90,10 @@ username(void)
const char *np;
uid_t uid;
if ((np = getenv("USER")) != NOSTR)
if ((np = getenv("USER")) != NULL)
return np;
if ((np = getname(uid = getuid())) != NOSTR)
if ((np = getname(uid = getuid())) != NULL)
return np;
printf("Cannot associate a name with uid %u\n", (unsigned)uid);
return NOSTR;
return NULL;
}