* complete copyright information.
*/
-#include <h/mh.h>
-#include <h/addrsbr.h>
-#include <h/mf.h>
-#include <h/mts.h>
-#include <h/utils.h>
+#include "h/mh.h"
+#include "snprintb.h"
+#include "strindex.h"
+#include "uprf.h"
+#include "getcpy.h"
+#include "context_find.h"
+#include "error.h"
+#include "h/addrsbr.h"
+#include "h/mf.h"
+#include "h/mts.h"
+#include "h/utils.h"
/* High level parsing of addresses:
static int eai = 0;
void
-enable_eai(void) {
+enable_eai(void)
+{
eai = 1;
}
if (!mp)
return;
- mh_xfree(mp->m_text);
- mh_xfree(mp->m_pers);
- mh_xfree(mp->m_mbox);
- mh_xfree(mp->m_host);
- mh_xfree(mp->m_path);
- mh_xfree(mp->m_gname);
- mh_xfree(mp->m_note);
+ free(mp->m_text);
+ free(mp->m_pers);
+ free(mp->m_mbox);
+ free(mp->m_host);
+ free(mp->m_path);
+ free(mp->m_gname);
+ free(mp->m_note);
free(mp);
}
char *
auxformat (struct mailname *mp, int extras)
{
- static char addr[BUFSIZ];
+ static char addr[BUFSIZ-4];
static char buffer[BUFSIZ];
if (mp->m_nohost)
strncpy (addr, FENDNULL(mp->m_mbox), sizeof(addr));
- else
-
- if (mp->m_type != UUCPHOST) {
+ else if (mp->m_type != UUCPHOST) {
if (mp->m_host)
snprintf (addr, sizeof(addr), "%s%s@%s", FENDNULL(mp->m_path),
FENDNULL(mp->m_mbox), mp->m_host);
* Check if this is my address
*/
-int
+bool
ismymbox (struct mailname *np)
{
- int oops;
+ bool oops;
int len, i;
char *cp;
char *pp;
struct mailname *mp;
static char *am = NULL;
static struct mailname mq;
- static int localmailbox = 0;
+ static bool localmailbox;
/*
* If this is the first call, initialize
if ((am = context_find ("local-mailbox"))) {
- localmailbox++;
+ localmailbox = true;
if ((cp = getname(am)) == NULL) {
inform("Unable to find address in local-mailbox, continuing...");
- return 0;
+ return false;
}
if ((mq.m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
inform("invalid entry in local-mailbox: %s, continuing...", cp);
- return 0;
+ return false;
}
/* Sigh, it turns out that the address parser gets messed up
am = getusername();
else {
mp = mq.m_next ? mq.m_next : &mq;
- oops = 0;
+ oops = false;
while ((cp = getname (am))) {
if ((mp->m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
inform("illegal address: %s, continuing...", cp);
- oops++;
+ oops = true;
} else {
mp = mp->m_next;
mp->m_type = W_NIL;
}
if (np == NULL) /* XXX */
- return 0;
+ return false;
/*
* Don't perform this "local" test if we have a Local-Mailbox set
case LOCALHOST:
local_test: ;
if (!strcasecmp (np->m_mbox, mq.m_mbox))
- return 1;
+ return true;
break;
default:
}
if (mp->m_nohost)
- return 1;
+ return true;
if (np->m_host == NULL || mp->m_host == NULL)
continue;
if ((len = strlen (cp = np->m_host))
continue;
break;
}
- return 1;
+ return true;
}
- return 0;
+ return false;
}