X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/fe86b6d55ac470e6e832c53ea2c71e680efe5274..a3724ed3:/sbr/addrsbr.c?ds=sidebyside diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index f63848b3..6d883ea1 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -1,6 +1,4 @@ - -/* - * addrsbr.c -- parse addresses 822-style +/* addrsbr.c -- parse addresses 822-style * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -23,10 +21,10 @@ REALLYDUMB are now the default in the code. If #ifdef DUMB is in effect, a full 822-style parser is called - for syntax recongition. This breaks each address into its components. + for syntax recognition. This breaks each address into its components. Note however that no semantics are assumed about the parts or their totality. This means that implicit hostnames aren't made explicit, - and explicit hostnames aren't expanded to their "official" represenations. + and explicit hostnames aren't expanded to their "official" representations. If DUMB is not in effect, then this module does some high-level thinking about what the addresses are. @@ -79,7 +77,7 @@ static char adr[BUFSIZ]; static int eai = 0; void -enable_eai() { +enable_eai(void) { eai = 1; } @@ -91,7 +89,7 @@ getname (const char *addrs) pers = mbox = host = route = grp = note = NULL; err[0] = '\0'; - if ((ap = getadrx (addrs ? addrs : "", eai)) == NULL) { + if ((ap = getadrx (FENDNULL(addrs), eai)) == NULL) { return NULL; } @@ -218,8 +216,6 @@ mnfree (struct mailname *mp) } -#define empty(s) ((s) ? (s) : "") - char * auxformat (struct mailname *mp, int extras) { @@ -227,15 +223,15 @@ auxformat (struct mailname *mp, int extras) 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) { if (mp->m_host) - snprintf (addr, sizeof(addr), "%s%s@%s", empty(mp->m_path), - empty(mp->m_mbox), mp->m_host); - else snprintf (addr, sizeof(addr), "%s%s", empty(mp->m_path), - empty(mp->m_mbox)); + snprintf (addr, sizeof(addr), "%s%s@%s", FENDNULL(mp->m_path), + FENDNULL(mp->m_mbox), mp->m_host); + else snprintf (addr, sizeof(addr), "%s%s", FENDNULL(mp->m_path), + FENDNULL(mp->m_mbox)); } else snprintf (addr, sizeof(addr), "%s!%s", mp->m_host, mp->m_mbox); @@ -357,8 +353,8 @@ ismymbox (struct mailname *np) 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)); }