{
char buf[4096];
int r1 = tgetent(buf, "vt100");
- int r2 = tgetent((char*)0,"vt100");
+ int r2 = tgetent(NULL,"vt100");
if (r1 >= 0 && r1 == r2) {
char tbuf[1024], *u;
u = tbuf;
** Find user's home directory. Try the HOME environment variable first,
** the home directory field in the password file if that's not found.
*/
- if ((mypath = getenv("HOME")) == (char *)0) {
+ if ((mypath = getenv("HOME")) == NULL) {
if ((pw = getpwuid(getuid())) == (struct passwd *)0 ||
*pw->pw_dir == '\0')
adios(NULL, "cannot determine your home directory");
defpath = getcpy(expanddir(cp));
if (stat(defpath, &st) != -1 && (st.st_mode & S_IFREG) == 0)
- adios((char *)0, "`%s' specified by your MH environment variable is not a normal file", cp);
+ adios(NULL, "`%s' specified by your MH environment variable is not a normal file", cp);
if ((ib = fopen(defpath, "r")) == (FILE *)0)
- adios((char *)0, "unable to read the `%s' profile specified by your MH environment variable", defpath);
+ adios(NULL, "unable to read the `%s' profile specified by your MH environment variable", defpath);
} else {
defpath = concat(mypath, "/", mh_profile, NULL);
if ((ib = fopen(defpath, "r")) == (FILE *)0)
- adios((char *)0, "Doesn't look like nmh is installed. Run install-mh to do so.");
+ adios(NULL, "Doesn't look like nmh is installed. Run install-mh to do so.");
cp = mh_profile;
}
** one rooted in the home directory.
*/
- if ((cp = context_find("path")) == (char *)0)
+ if ((cp = context_find("path")) == NULL)
adios(NULL, "Your %s file does not contain a path entry.",
defpath);
if (!makedir(nd))
adios(NULL, "unable to create %s", nd);
} else if ((st.st_mode & S_IFDIR) == 0)
- adios((char *)0, "`%s' is not a directory", nd);
+ adios(NULL, "`%s' is not a directory", nd);
/*
** Open and read user's context file. The name of the context
** environment variable.
*/
- if ((cp = getenv("MHCONTEXT")) == (char *)0 || *cp == '\0')
+ if ((cp = getenv("MHCONTEXT")) == NULL || *cp == '\0')
cp = context;
/*
static int did_message = 0; /* set if we've already output a message */
- if ((hook = context_find(hook_name)) == (char *)0)
+ if ((hook = context_find(hook_name)) == NULL)
return (OK);
switch (pid = vfork()) {
vec[0] = mhbasename(hook);
vec[1] = message_file_name_1;
vec[2] = message_file_name_2;
- vec[3] = (char *)0;
+ vec[3] = NULL;
execvp(hook, vec);
_exit(-1);
/* NOTREACHED */
if (status != OK) {
if (did_message == 0) {
- if ((hook = context_find("msg-hook")) != (char *)0)
+ if ((hook = context_find("msg-hook")) != NULL)
advise(NULL, hook);
else
advise(NULL, "external hook (%s) did not work properly.", hook);
from_dir, msgfile);
ext_hook("ref-hook", oldmsg, newmsg);
} else
- ext_hook("add-hook", newmsg, (char *)0);
+ ext_hook("add-hook", newmsg, NULL);
return msgnum;
} else {
msgfile);
ext_hook("ref-hook", oldmsg, newmsg);
} else
- ext_hook("add-hook", newmsg, (char *)0);
+ ext_hook("add-hook", newmsg, NULL);
return msgnum;
}
if (!nohook) {
snprintf(msgpath, sizeof (msgpath), "%s/%d",
mp->foldpath, msgnum);
- ext_hook("del-hook", msgpath, (char *)0);
+ ext_hook("del-hook", msgpath, NULL);
}
dp = m_name(msgnum);
if (number)
printf("%d\t", ++count);
- if (text == (char *)0 && (sp = strrchr(cp, '/')) != (char *)0)
+ if (text == NULL && (sp = strrchr(cp, '/')) != NULL)
cp = sp + 1;
printf("%s\n", cp);
if (strncasecmp(field, comp, length) == 0 && field[length] == ':') {
if (delete == 0) {
- if (text == (char *)0)
+ if (text == NULL)
break;
for (cp = field + length + 1; *cp == ' ' || *cp == '\t'; cp++)
break;
}
else {
- if ((sp = strrchr(cp, '/')) != (char *)0)
+ if ((sp = strrchr(cp, '/')) != NULL)
cp = sp + 1;
if (strcmp(cp, text) == 0)
admonish(f3, "unable to rename %s to", f1);
snprintf(f3, sizeof (f3), "%s/%d", maildir, i);
- ext_hook("del-hook", f3, (char *)0);
+ ext_hook("del-hook", f3, NULL);
}
if (rename(f2, f1) == NOTOK)
admonish(f1, "unable to rename %s to", f2);
snprintf(f3, sizeof (f3), "%s/%d", maildir, i);
- ext_hook("add-hook", f3, (char *)0);
+ ext_hook("add-hook", f3, NULL);
copy_msg_flags(mp, i, msgnum);
mp->msgflags |= SEQMOD;
if (stat(newmail, &s1) == NOTOK || s1.st_size == 0)
adios(NULL, "no mail to incorporate");
- if ((cp = strdup(newmail)) == (char *)0)
+ if ((cp = strdup(newmail)) == NULL)
adios(NULL, "error allocating memory to copy newmail");
newmail = cp;
folder = getdeffol();
maildir = toabsdir(folder);
- if ((maildir_copy = strdup(maildir)) == (char *)0)
+ if ((maildir_copy = strdup(maildir)) == NULL)
adios(maildir, "error allocating memory to copy maildir");
if (!folder_exists(maildir)) {
snprintf(b, sizeof (b), "%s/%d", maildir_copy,
msgnum + 1);
- ext_hook("add-hook", b, (char *)0);
+ ext_hook("add-hook", b, NULL);
if (aud)
fputs(scanl, aud);
** if that's not found.
*/
- if ((mypath = getenv("HOME")) == (char *)0) {
+ if ((mypath = getenv("HOME")) == NULL) {
if ((pw = getpwuid(getuid())) == (struct passwd *)0 ||
*pw->pw_dir == '\0')
adios(NULL, "cannot determine your home directory");
/* Read the folder. */
if ((mp = folder_read(folder))) {
/* Link file into folder */
- msgnum = folder_addmsg(&mp, filename, 0, 0, 0, 0, (char *)0);
+ msgnum = folder_addmsg(&mp, filename, 0, 0, 0, 0, NULL);
} else {
advise(NULL, "unable to read folder %s", folder);
return NOTOK;
** Link message into folder, and possibly add
** to the Unseen-Sequence's.
*/
- if ((msgnum = folder_addmsg(&mp, tmpfilenam, 0, unseensw, 0, 0,
- (char *)0)) == -1)
+ if ((msgnum = folder_addmsg(&mp, tmpfilenam, 0, unseensw, 0, 0, NULL))
+ == -1)
done(1);
/*
** Run the external delete hook program.
*/
- ext_hook("del-hook", maildir, (char *)0);
+ ext_hook("del-hook", maildir, NULL);
j = strlen(backup_prefix);
while ((dp = readdir(dd))) {
char *msgs[MAXARGS], *vec[MAXARGS];
struct msgs *mp;
struct stat st;
- char *attach = (char *)0; /* header field name for attachments */
+ char *attach = NULL; /* header field name for attachments */
int attachformat = 0; /* mhbuild format specifier for attachments */
#ifdef UCI
FILE *fp;
** and modified if desired.
*/
- if (attachment_header_field_name != (char *)0) {
+ if (attachment_header_field_name != NULL) {
switch (attach(attachment_header_field_name, drft,
attachformat)) {
case OK:
if (strlen(composition_file_name) >=
sizeof (composition_file_name) - 6)
- advise((char *)0, "unable to remove original composition file.");
+ advise(NULL, "unable to remove original composition file.");
else {
if ((p = strrchr(composition_file_name, '/')) == NULL)
*/
if ((draft_file = fopen(draft_file_name, "r")) == (FILE *)0)
- adios((char *)0, "can't open draft file `%s'.",
+ adios(NULL, "can't open draft file `%s'.",
draft_file_name);
/*
if ((has_body && body_file == (FILE *)0) ||
composition_file == (FILE *)0) {
clean_up_temporary_files();
- adios((char *)0, "unable to open all of the temporary files.");
+ adios(NULL, "unable to open all of the temporary files.");
}
/*
char *p; /* miscellaneous string pointer */
struct stat st; /* file status buffer */
- content_type = (char *)0;
+ content_type = NULL;
/*
** Check the file name for a suffix. Scan the context for that
** the field, including the dot.
*/
- if ((p = strrchr(file_name, '.')) != (char *)0) {
+ if ((p = strrchr(file_name, '.')) != NULL) {
for (np = m_defs; np; np = np->n_next) {
if (strncasecmp(np->n_name, "mhshow-suffix-", 14) == 0
&& mh_strcasecmp(p, np->n_field) == 0)
** content type based on this check.
*/
- if (content_type == (char *)0) {
+ if (content_type == NULL) {
if ((fp = fopen(file_name, "r")) == (FILE *)0) {
clean_up_temporary_files();
- adios((char *)0, "unable to access file \"%s\"",
+ adios(NULL, "unable to access file \"%s\"",
file_name);
}
if (stat(file_name, &st) == -1 || access(file_name, R_OK) != 0) {
clean_up_temporary_files();
- adios((char *)0, "unable to access file \"%s\"", file_name);
+ adios(NULL, "unable to access file \"%s\"", file_name);
}
switch (attachformat) {
fprintf(composition_file,
"#%s; name=\"%s\"; x-unix-mode=0%.3ho",
content_type, ((p = strrchr(file_name, '/'))
- == (char *)0) ? file_name : p + 1,
+ == NULL) ? file_name : p + 1,
(unsigned short)(st.st_mode & 0777));
if (strlen(file_name) > MAXPATHLEN) {
clean_up_temporary_files();
- adios((char *)0, "attachment file name `%s' too long.",
+ adios(NULL, "attachment file name `%s' too long.",
file_name);
}
sprintf(cmd, "file '%s'", file_name);
if ((fp = popen(cmd, "r")) != (FILE *)0 &&
- fgets(cmd, sizeof (cmd), fp) != (char *)0) {
+ fgets(cmd, sizeof (cmd), fp) != NULL) {
*strchr(cmd, '\n') = '\0';
/*
fprintf(composition_file,
"#%s; name=\"%s\" <>{attachment}",
content_type,
- ((p = strrchr(file_name, '/')) == (char *)0) ?
+ ((p = strrchr(file_name, '/')) == NULL) ?
file_name : p + 1);
}
fprintf(composition_file,
"#%s; name=\"%s\" <>{attachment; modification-date=\"%s\"}",
content_type,
- ((p = strrchr(file_name, '/')) == (char *)0) ?
+ ((p = strrchr(file_name, '/')) == NULL) ?
file_name : p + 1, dtime(&st.st_mtime, 0));
}
break;
default:
- adios((char *)0, "unsupported attachformat %d", attachformat);
+ adios(NULL, "unsupported attachformat %d", attachformat);
}
/*
static struct smsg *smsgs;
int nmsgs;
-char *subjsort = (char *) 0; /* sort on subject if != 0 */
+char *subjsort = NULL; /* sort on subject if != 0 */
unsigned long datelimit = 0;
int submajor = 0; /* if true, sort on subject-major */
int verbose;
subjsort = "subject";
continue;
case NSUBJSW:
- subjsort = (char *)0;
+ subjsort = NULL;
continue;
case LIMSW:
if (verbsw)
vec[vecp++] = "-verbose";
- switch (sendsbr(vec, vecp, tmpfil, &st, 0, (char *)0, 0)) {
+ switch (sendsbr(vec, vecp, tmpfil, &st, 0, NULL, 0)) {
case DONE:
case NOTOK:
status++;
char buf[BUFSIZ], prompt[BUFSIZ];
char **argp, **arguments;
struct stat st;
- char *attach = (char *)0; /* attachment header field name */
+ char *attach = NULL; /* attachment header field name */
char cwd[MAXPATHLEN + 1]; /* current working directory */
char file[MAXPATHLEN + 1]; /* file name buffer */
char shell[MAXPATHLEN + 1]; /* shell response buffer */
** Get the initial current working directory.
*/
- if (getcwd(cwd, sizeof (cwd)) == (char *)0) {
+ if (getcwd(cwd, sizeof (cwd)) == NULL) {
adios("getcwd", "could not get working directory");
}
continue;
case ATTACHSW:
- if (attach != (char *)0)
+ if (attach != NULL)
adios(NULL, "only one attachment header field name at a time!");
if (!(attach = *argp++) || *attach == '-')
adios(NULL, "missing argument to %s",
** the absolute path.
*/
- if (*(argp+1) == (char *)0) {
+ if (*(argp+1) == NULL) {
sprintf(buf, "$SHELL -c \"cd;pwd\"");
} else {
writesomecmd(buf, BUFSIZ, "cd", "pwd", argp);
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
fgets(cwd, sizeof (cwd), f);
- if (strchr(cwd, '\n') != (char *)0)
+ if (strchr(cwd, '\n') != NULL)
*strchr(cwd, '\n') = '\0';
pclose(f);
** -n numbers listing
*/
- if (attach == (char *)0) {
- advise((char *)0, "can't list because no header field name was given.");
+ if (attach == NULL) {
+ advise(NULL, "can't list because no header field name was given.");
break;
}
- l = (char *)0;
+ l = NULL;
n = 0;
- while (*++argp != (char *)0) {
+ while (*++argp != NULL) {
if (strcmp(*argp, "-l") == 0)
l = "/";
}
if (n == -1)
- advise((char *)0, "usage is alist [-ln].");
+ advise(NULL, "usage is alist [-ln].");
else
annolist(drft, attach, l, n);
** Attach files to current draft.
*/
- if (attach == (char *)0) {
- advise((char *)0, "can't attach because no header field name was given.");
+ if (attach == NULL) {
+ advise(NULL, "can't attach because no header field name was given.");
break;
}
- if (*(argp+1) == (char *)0) {
- advise((char *)0, "attach command requires file argument(s).");
+ if (*(argp+1) == NULL) {
+ advise(NULL, "attach command requires file argument(s).");
break;
}
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
while (fgets(shell, sizeof (shell), f)
- != (char *)0) {
+ != NULL) {
*(strchr(shell, '\n')) = '\0';
if (*shell == '/')
** Detach files from current draft.
*/
- if (attach == (char *)0) {
- advise((char *)0, "can't detach because no header field name was given.");
+ if (attach == NULL) {
+ advise(NULL, "can't detach because no header field name was given.");
break;
}
*/
for (n = 0, arguments = argp + 1;
- *arguments != (char *)0;
+ *arguments != NULL;
arguments++) {
if (strcmp(*arguments, "-n") == 0) {
n = 1;
if (n == 1) {
for (arguments = argp + 1;
- *arguments != (char *)0;
+ *arguments != NULL;
arguments++) {
if (strcmp(*arguments, "-n") == 0)
continue;
annotate(drft, attach, NULL,
1, 0, n, 1);
- for (argp = arguments + 1; *argp != (char *)0; argp++) {
+ for (argp = arguments + 1; *argp != NULL; argp++) {
if (atoi(*argp) > n) {
if (atoi(*argp) == 1)
*argp = "";
*/
int trailln = strlen(trailcmd) + 3;
if (ln < 0 || ln + trailln > bufsz)
- adios((char *)0, "arguments too long");
+ adios(NULL, "arguments too long");
cp = buf + ln;
- while (*++argp != (char *)0) {
+ while (*++argp != NULL) {
ln = strlen(*argp);
/* +1 for leading space */
if (ln + trailln + 1 > bufsz - (cp-buf))
- adios((char *)0, "arguments too long");
+ adios(NULL, "arguments too long");
*cp++ = ' ';
memcpy(cp, *argp, ln+1);
cp += ln;
char *cp, buf[BUFSIZ], **argp;
char **arguments, *vec[MAXARGS];
struct stat st;
- char *attach = (char *)0; /* attachment header field name */
+ char *attach = NULL; /* attachment header field name */
int attachformat = 0; /* mhbuild format specifier for attachments */
#ifndef lint