From: Ken Hornstein Date: Fri, 3 Feb 2012 20:38:49 +0000 (-0500) Subject: Convert from the poorly-named and confusing adrsprintf() to getlocaladdr(). X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=196f9810eda97012980606456d5a8b429501bd9d;p=mmh Convert from the poorly-named and confusing adrsprintf() to getlocaladdr(). --- diff --git a/h/addrsbr.h b/h/addrsbr.h index a6c7a41..2611e5a 100644 --- a/h/addrsbr.h +++ b/h/addrsbr.h @@ -35,6 +35,6 @@ struct mailname { void mnfree(struct mailname *); int ismymbox(struct mailname *); char *getname(char *); -char *adrsprintf(char *, char *); +char *getlocaladdr(void); char *auxformat(struct mailname *, int); struct mailname *getm(char *, char *, int, int, char *); diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index 7d1350e..07bc810 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -287,17 +287,20 @@ auxformat (struct mailname *mp, int extras) /* - * address specific "sprintf" + * This used to be adrsprintf() (where it would format an address for you + * given a username and a domain). But somewhere we got to the point where + * the only caller was post, and it only called it with both arguments NULL. + * So the function was renamed with a more sensible name. */ char * -adrsprintf (char *username, char *domain) +getlocaladdr(void) { int snprintf_return; + char *username, *domain; static char addr[BUFSIZ]; - if (username == NULL) - username = getusername(); + username = getusername(); if (username_extension_masquerading) { /* mts.conf contains "masquerade:[...]username_extension[...]", so tack @@ -324,8 +327,7 @@ adrsprintf (char *username, char *domain) return username; - if (domain == NULL) - domain = LocalName(); + domain = LocalName(); snprintf_return = snprintf (addr, sizeof(addr), "%s@%s", username, domain); diff --git a/uip/post.c b/uip/post.c index 2449d5f..dcd563b 100644 --- a/uip/post.c +++ b/uip/post.c @@ -868,7 +868,7 @@ start_headers (void) mygid = getgid (); time (&tclock); - strncpy (from, adrsprintf (NULL, NULL), sizeof(from)); + strncpy (from, getlocaladdr(), sizeof(from)); strncpy (myhost, LocalName (), sizeof(myhost)); for (cp = myhost; *cp; cp++) @@ -877,7 +877,7 @@ start_headers (void) if ((cp = getfullname ()) && *cp) { strncpy (sigbuf, cp, sizeof(sigbuf)); snprintf (signature, sizeof(signature), "%s <%s>", - sigbuf, adrsprintf (NULL, NULL)); + sigbuf, getlocaladdr()); if ((cp = getname (signature)) == NULL) adios (NULL, "getname () failed -- you lose extraordinarily big"); if ((mp = getm (cp, NULL, 0, AD_HOST, NULL)) == NULL) @@ -886,7 +886,7 @@ start_headers (void) while (getname ("")) continue; } else { - strncpy (signature, adrsprintf (NULL, NULL), sizeof(signature)); + strncpy (signature, getlocaladdr(), sizeof(signature)); } }