Use it in place of all the `foo->bar_xyzzy ? foo->bar_xyzzy : ""'.
Avoids the reader having to check first two of the ternary operands are
the same.
22 files changed:
- snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
+ snprintf (epath, sizeof(epath), "%s/%s", pp, FENDNULL(cp));
* terminating NUL. */
#define LEN(s) (sizeof (s) - 1)
* terminating NUL. */
#define LEN(s) (sizeof (s) - 1)
+/* FENDNULL fends off NULL by giving an empty string instead. */
+#define FENDNULL(s) ((s) ? (s) : "")
+
/*
* char array that keeps track of size in both bytes and characters
* Usage note:
/*
* char array that keeps track of size in both bytes and characters
* Usage note:
{
switch (smtalk (SM_RCPT, host && *host ? "RCPT TO:<%s%s@%s>"
: "RCPT TO:<%s%s>",
{
switch (smtalk (SM_RCPT, host && *host ? "RCPT TO:<%s%s@%s>"
: "RCPT TO:<%s%s>",
- path ? path : "", mbox, host)) {
+ FENDNULL(path), mbox, host)) {
case 250:
case 251:
sm_addrs++;
case 250:
case 251:
sm_addrs++;
pers = mbox = host = route = grp = note = NULL;
err[0] = '\0';
pers = mbox = host = route = grp = note = NULL;
err[0] = '\0';
- if ((ap = getadrx (addrs ? addrs : "", eai)) == NULL) {
+ if ((ap = getadrx (FENDNULL(addrs), eai)) == NULL) {
-#define empty(s) ((s) ? (s) : "")
+#define empty(s) FENDNULL(s)
char *
auxformat (struct mailname *mp, int extras)
char *
auxformat (struct mailname *mp, int extras)
static char buffer[BUFSIZ];
if (mp->m_nohost)
static char buffer[BUFSIZ];
if (mp->m_nohost)
- strncpy (addr, mp->m_mbox ? mp->m_mbox : "", sizeof(addr));
+ strncpy (addr, FENDNULL(mp->m_mbox), sizeof(addr));
else
if (mp->m_type != UUCPHOST) {
else
if (mp->m_type != UUCPHOST) {
for (mp = &mq; mp; mp = mp->m_next) {
fprintf (stderr, "Local- or Alternate-Mailbox: text=\"%s\" "
"mbox=\"%s\" host=\"%s\" %s\n",
for (mp = &mq; mp; mp = mp->m_next) {
fprintf (stderr, "Local- or Alternate-Mailbox: text=\"%s\" "
"mbox=\"%s\" host=\"%s\" %s\n",
- mp->m_text ? mp->m_text : "", mp->m_mbox,
- mp->m_host ? mp->m_host : "",
+ FENDNULL(mp->m_text), mp->m_mbox,
+ FENDNULL(mp->m_host),
snprintb (buffer, sizeof(buffer), (unsigned) mp->m_type,
WBITS));
}
snprintb (buffer, sizeof(buffer), (unsigned) mp->m_type,
WBITS));
}
struct node *np, *pp;
for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
struct node *np, *pp;
for (np = m_defs, pp = NULL; np; pp = np, np = np->n_next) {
- if (!strcasecmp (np->n_name ? np->n_name : "", key ? key : "")) {
+ if (!strcasecmp (FENDNULL(np->n_name), FENDNULL(key))) {
if (!np->n_context)
inform("bug: context_del(key=\"%s\"), continuing...", np->n_name);
if (pp)
if (!np->n_context)
inform("bug: context_del(key=\"%s\"), continuing...", np->n_name);
if (pp)
struct node *np;
for (np = m_defs; np; np = np->n_next)
struct node *np;
for (np = m_defs; np; np = np->n_next)
- if (!strcasecmp (np->n_name ? np->n_name : "", str ? str : ""))
+ if (!strcasecmp (FENDNULL(np->n_name), FENDNULL(str)))
return (np->n_field);
return NULL;
return (np->n_field);
return NULL;
* this key, and replace its value if found.
*/
for (np = m_defs;; np = np->n_next) {
* this key, and replace its value if found.
*/
for (np = m_defs;; np = np->n_next) {
- if (!strcasecmp (np->n_name ? np->n_name : "", key ? key : "")) {
+ if (!strcasecmp (FENDNULL(np->n_name), FENDNULL(key))) {
if (strcmp (value, np->n_field)) {
if (!np->n_context)
inform("bug: context_replace(key=\"%s\",value=\"%s\"), continuing...", key, value);
if (strcmp (value, np->n_field)) {
if (!np->n_context)
inform("bug: context_replace(key=\"%s\",value=\"%s\"), continuing...", key, value);
struct comp *cm;
for (cm = wantcomp[CHASH(component)]; cm; cm = cm->c_next)
struct comp *cm;
for (cm = wantcomp[CHASH(component)]; cm; cm = cm->c_next)
- if (strcasecmp(component, cm->c_name ? cm->c_name : "") == 0)
+ if (strcasecmp(component, FENDNULL(cm->c_name)) == 0)
- if (strcasecmp(component, cptr->c_name ? cptr->c_name : "") == 0) {
+ if (strcasecmp(component, FENDNULL(cptr->c_name)) == 0) {
found++;
if (! cptr->c_text) {
cptr->c_text = getcpy(text);
found++;
if (! cptr->c_text) {
cptr->c_text = getcpy(text);
if (bucket != -1) {
for (cptr = wantcomp[bucket]; cptr; cptr = cptr->c_next)
if (bucket != -1) {
for (cptr = wantcomp[bucket]; cptr; cptr = cptr->c_next)
- if (strcasecmp(component, cptr->c_name ? cptr->c_name : "") == 0)
+ if (strcasecmp(component, FENDNULL(cptr->c_name)) == 0)
cptr->c_text = add(text, cptr->c_text);
}
}
cptr->c_text = add(text, cptr->c_text);
}
}
err[0] = 0;
if (dp == NULL) {
err[0] = 0;
if (dp == NULL) {
- dp = cp = strdup (addrs ? addrs : "");
+ dp = cp = strdup (FENDNULL(addrs));
if ((p = strrchr(file_name, '.')) != NULL) {
for (np = m_defs; np; np = np->n_next) {
if (strncasecmp(np->n_name, "mhshow-suffix-", 14) == 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 &&
- strcasecmp(p, np->n_field ? np->n_field : "") == 0) {
+ strcasecmp(p, FENDNULL(np->n_field)) == 0) {
content_type = strdup(np->n_name + 14);
break;
}
content_type = strdup(np->n_name + 14);
break;
}
-#define empty(s) ((s) ? (s) : "")
+#define empty(s) FENDNULL(s)
/*
* Print all the sequences in a folder
/*
* Print all the sequences in a folder
while ((cp = getname (pp))) {
if ((np = getm (cp, NULL, 0, NULL, 0)) == NULL)
continue;
while ((cp = getname (pp))) {
if ((np = getm (cp, NULL, 0, NULL, 0)) == NULL)
continue;
- if (!strcasecmp (mp->m_host ? mp->m_host : "",
- np->m_host ? np->m_host : "") &&
- !strcasecmp (mp->m_mbox ? mp->m_mbox : "",
- np->m_mbox ? np->m_mbox : "")) {
+ if (!strcasecmp (FENDNULL(mp->m_host),
+ FENDNULL(np->m_host)) &&
+ !strcasecmp (FENDNULL(mp->m_mbox),
+ FENDNULL(np->m_mbox))) {
vp = vp ? add (ak->ak_name, add (",", vp))
: getcpy (ak->ak_name);
mnfree (np);
vp = vp ? add (ak->ak_name, add (",", vp))
: getcpy (ak->ak_name);
mnfree (np);
return 0;
for (mp = &mq; mp->m_next; mp = mp->m_next) {
return 0;
for (mp = &mq; mp->m_next; mp = mp->m_next) {
- if (!strcasecmp (np->m_host ? np->m_host : "",
- mp->m_next->m_host ? mp->m_next->m_host : "") &&
- !strcasecmp (np->m_mbox ? np->m_mbox : "",
- mp->m_next->m_mbox ? mp->m_next->m_mbox : ""))
+ if (!strcasecmp (FENDNULL(np->m_host),
+ FENDNULL(mp->m_next->m_host)) &&
+ !strcasecmp (FENDNULL(np->m_mbox),
+ FENDNULL(mp->m_next->m_mbox)))
return 0;
}
if (!ccme && ismymbox (np))
return 0;
}
if (!ccme && ismymbox (np))
if (msg)
inform("no folder given for message %s, continuing...", msg);
readonly_folders (); /* do any readonly folders */
if (msg)
inform("no folder given for message %s, continuing...", msg);
readonly_folders (); /* do any readonly folders */
- strncpy (folder, (cp = context_find (pfolder)) ? cp : "", sizeof(folder));
+ cp = context_find(pfolder);
+ strncpy (folder, FENDNULL(cp), sizeof(folder));
crawl_folders (".", get_folder_info_callback, NULL);
} else {
strncpy (folder, argfolder, sizeof(folder));
crawl_folders (".", get_folder_info_callback, NULL);
} else {
strncpy (folder, argfolder, sizeof(folder));
"continuing...", invo_name,
ct->c_ctinfo.ci_type,
ct->c_ctinfo.ci_subtype ? "/" : "",
"continuing...", invo_name,
ct->c_ctinfo.ci_type,
ct->c_ctinfo.ci_subtype ? "/" : "",
- ct->c_ctinfo.ci_subtype ? ct->c_ctinfo.ci_subtype : "",
+ FENDNULL(ct->c_ctinfo.ci_subtype),
/* reply_file is used to pass the output of the convert. */
reply_file = getcpy (m_mktemp2 (NULL, invo_name, NULL, NULL));
convert_command =
/* reply_file is used to pass the output of the convert. */
reply_file = getcpy (m_mktemp2 (NULL, invo_name, NULL, NULL));
convert_command =
- concat (convert, " ", argstring ? argstring : "", " >", reply_file,
+ concat (convert, " ", FENDNULL(argstring), " >", reply_file,
NULL);
/* Convert here . . . */
NULL);
/* Convert here . . . */
strlen(new_ctline) + 1,
ct->c_ctinfo.ci_first_pm, NULL, 0);
fprintf (fpout, "%s:%s%s\n", np, new_ctline,
strlen(new_ctline) + 1,
ct->c_ctinfo.ci_first_pm, NULL, 0);
fprintf (fpout, "%s:%s%s\n", np, new_ctline,
- new_params ? new_params : "");
free(new_ctline);
mh_xfree(new_params);
}
free(new_ctline);
mh_xfree(new_params);
}
if (strchr (cf, '>')) {
inform("'>' prohibited in \"%s\",\nplease fix your "
"%s-format-%s/%s profile entry", cf, invo_name, type,
if (strchr (cf, '>')) {
inform("'>' prohibited in \"%s\",\nplease fix your "
"%s-format-%s/%s profile entry", cf, invo_name, type,
- subtype ? subtype : "");
snprintf (buffer2, sizeof buffer2, "%d", serial);
boundary =
concat (boundary_prefix,
snprintf (buffer2, sizeof buffer2, "%d", serial);
boundary =
concat (boundary_prefix,
- first_alt->c_partno ? first_alt->c_partno : "",
+ FENDNULL(first_alt->c_partno),
report (NULL, ct->c_partno, ct->c_file,
"will not decode%s because it is binary (%s)",
ct->c_partno ? ""
report (NULL, ct->c_partno, ct->c_file,
"will not decode%s because it is binary (%s)",
ct->c_partno ? ""
- : ct->c_ctline ? ct->c_ctline
- : "",
+ : (FENDNULL(ct->c_ctline)),
reason);
}
(void) m_unlink (ct->c_cefile.ce_file);
reason);
}
(void) m_unlink (ct->c_cefile.ce_file);
report (NULL, ct->c_partno, ct->c_file,
"will not decode%s because it is 8bit",
ct->c_partno ? ""
report (NULL, ct->c_partno, ct->c_file,
"will not decode%s because it is 8bit",
ct->c_partno ? ""
- : ct->c_ctline ? ct->c_ctline
- : "");
+ : (FENDNULL(ct->c_ctline)));
}
(void) m_unlink (ct->c_cefile.ce_file);
free (ct->c_cefile.ce_file);
}
(void) m_unlink (ct->c_cefile.ce_file);
free (ct->c_cefile.ce_file);
++*message_mods;
if (verbosw) {
report (NULL, ct->c_partno, ct->c_file, "decode%s",
++*message_mods;
if (verbosw) {
report (NULL, ct->c_partno, ct->c_file, "decode%s",
- ct->c_ctline ? ct->c_ctline : "");
+ FENDNULL(ct->c_ctline));
}
if (lf_line_endings) {
strip_crs (ct, message_mods);
}
if (lf_line_endings) {
strip_crs (ct, message_mods);
if (verbosw) {
va_start (args, message);
fmt = concat (filename, partno ? " part " : ", ",
if (verbosw) {
va_start (args, message);
fmt = concat (filename, partno ? " part " : ", ",
- partno ? partno : "", partno ? ", " : "", message, NULL);
+ FENDNULL(partno), partno ? ", " : "", message, NULL);
advertise (what, NULL, fmt, args);
advertise (what, NULL, fmt, args);
-#define empty(s) ((s) ? (s) : "")
+#define empty(s) FENDNULL(s)
/*
* Method for listing information about a simple/generic content
/*
* Method for listing information about a simple/generic content
fprintf (stderr, " decoded fp 0x%x file \"%s\"\n",
(unsigned int)(unsigned long) ce->ce_fp,
fprintf (stderr, " decoded fp 0x%x file \"%s\"\n",
(unsigned int)(unsigned long) ce->ce_fp,
- ce->ce_file ? ce->ce_file : "");
+ FENDNULL(ce->ce_file));
continue;
for (c2 = fmthd; c2; c2 = c2->c_next)
continue;
for (c2 = fmthd; c2; c2 = c2->c_next)
- if (!strcasecmp (c2->c_name ? c2->c_name : "", name))
+ if (!strcasecmp (FENDNULL(c2->c_name), name))
break;
c1 = NULL;
if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
for (c1 = msghd; c1; c1 = c1->c_next)
break;
c1 = NULL;
if (!((c3 = c2 ? c2 : &global)->c_flags & SPLIT))
for (c1 = msghd; c1; c1 = c1->c_next)
- if (!strcasecmp (c1->c_name ? c1->c_name : "",
- c3->c_name ? c3->c_name : "")) {
+ if (!strcasecmp (FENDNULL(c1->c_name),
+ FENDNULL(c3->c_name))) {
c1->c_text =
mcomp_add (c1->c_flags, buf, c1->c_text);
break;
c1->c_text =
mcomp_add (c1->c_flags, buf, c1->c_text);
break;
continue;
}
for (c2 = msghd; c2; c2 = c2->c_next)
continue;
}
for (c2 = msghd; c2; c2 = c2->c_next)
- if (!strcasecmp (c2->c_name ? c2->c_name : "",
- c1->c_name ? c1->c_name : "")) {
+ if (!strcasecmp (FENDNULL(c2->c_name),
+ FENDNULL(c1->c_name))) {
putcomp (c1, c2, ONECOMP);
if (!(c1->c_flags & SPLIT))
break;
putcomp (c1, c2, ONECOMP);
if (!(c1->c_flags & SPLIT))
break;
putch ('\n', flags);
if (ovoff > 0)
lm = ovoff;
putch ('\n', flags);
if (ovoff > 0)
lm = ovoff;
- putstr (ovtxt ? ovtxt : "", flags);
+ putstr (FENDNULL(ovtxt), flags);
putch (ch, flags);
return;
}
putch (ch, flags);
return;
}
* value (as determined after context is read).
*/
for (ps = procs; ps->p_name; ps++)
* value (as determined after context is read).
*/
for (ps = procs; ps->p_name; ps++)
- printf ("%s: %s\n", ps->p_name, *ps->p_field ? *ps->p_field : "");
+ printf ("%s: %s\n", ps->p_name, FENDNULL(*ps->p_field));
char *charset = content_charset (ct);
inform("unable to convert character set%s%s from %s, continuing...",
ct->c_partno ? " of part " : "",
char *charset = content_charset (ct);
inform("unable to convert character set%s%s from %s, continuing...",
ct->c_partno ? " of part " : "",
- ct->c_partno ? ct->c_partno : "",
+ FENDNULL(ct->c_partno),
charset);
free (charset);
}
charset);
free (charset);
}
struct headers *h;
for (h = table; h->value; h++)
struct headers *h;
for (h = table; h->value; h++)
- if (!strcasecmp (header ? header : "", h->value ? h->value : ""))
+ if (!strcasecmp (FENDNULL(header), FENDNULL(h->value)))
return (h - table);
return NOTOK;
return (h - table);
return NOTOK;
: &netaddrs;
mp->m_next;
mp = mp->m_next)
: &netaddrs;
mp->m_next;
mp = mp->m_next)
- if (!strcasecmp (np->m_host ? np->m_host : "",
- mp->m_next->m_host ? mp->m_next->m_host : "") &&
- !strcasecmp (np->m_mbox ? np->m_mbox : "",
- mp->m_next->m_mbox ? mp->m_next->m_mbox : "") &&
+ if (!strcasecmp (FENDNULL(np->m_host),
+ FENDNULL(mp->m_next->m_host)) &&
+ !strcasecmp (FENDNULL(np->m_mbox),
+ FENDNULL(mp->m_next->m_mbox)) &&
np->m_bcc == mp->m_next->m_bcc)
return 0;
np->m_bcc == mp->m_next->m_bcc)
return 0;
printf ("\nnet:\t");
for (mp = netaddrs.m_next; mp; mp = mp->m_next)
printf ("\nnet:\t");
for (mp = netaddrs.m_next; mp; mp = mp->m_next)
- printf ("%s%s@%s%s%s", mp->m_path ? mp->m_path : "",
+ printf ("%s%s@%s%s%s", FENDNULL(mp->m_path),
mp->m_mbox, mp->m_host,
mp->m_bcc ? "[BCC]" : "",
mp->m_next ? ",\n\t" : "");
mp->m_mbox, mp->m_host,
mp->m_bcc ? "[BCC]" : "",
mp->m_next ? ",\n\t" : "");
return 0;
for (mp = &mq; mp->m_next; mp = mp->m_next) {
return 0;
for (mp = &mq; mp->m_next; mp = mp->m_next) {
- if (!strcasecmp (np->m_host ? np->m_host : "",
- mp->m_next->m_host ? mp->m_next->m_host : "") &&
- !strcasecmp (np->m_mbox ? np->m_mbox : "",
- mp->m_next->m_mbox ? mp->m_next->m_mbox : ""))
+ if (!strcasecmp (FENDNULL(np->m_host),
+ FENDNULL(mp->m_next->m_host)) &&
+ !strcasecmp (FENDNULL(np->m_mbox),
+ FENDNULL(mp->m_next->m_mbox)))
return 0;
}
if (!ccme && ismymbox (np))
return 0;
}
if (!ccme && ismymbox (np))