X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=rfc822.c;h=30f137977c64379ef5ffc89141a6507689354626;hp=557f85413cc88aa7cc4564fafda2a20452f42217;hb=c660c8cbae7f647c637502779862e4a36ad6a074;hpb=617e7d83d14e14e6a520a48e75437211b16c8834 diff --git a/rfc822.c b/rfc822.c index 557f854..30f1379 100644 --- a/rfc822.c +++ b/rfc822.c @@ -16,13 +16,13 @@ #include #include +#include +#include +#include #include "mutt.h" -#include "ascii.h" #include "mutt_idna.h" -#include "lib/intl.h" -#include "lib/str.h" #define terminate_string(a, b, c) do { if ((b) < (c)) a[(b)] = 0; else \ a[(c)] = 0; } while (0) @@ -165,7 +165,7 @@ static const char *parse_mailboxdomain (const char *s, const char *nonspecial, const char *ps; while (*s) { - SKIPWS (s); + s = vskipspaces(s); if (strchr (nonspecial, *s) == NULL && is_special (*s)) return s; @@ -207,11 +207,11 @@ static const char *parse_address (const char *s, } terminate_string (token, *tokenlen, tokenmax); - addr->mailbox = str_dup (token); + addr->mailbox = m_strdup(token); if (*commentlen && !addr->personal) { terminate_string (comment, *commentlen, commentmax); - addr->personal = str_dup (comment); + addr->personal = m_strdup(comment); } return s; @@ -224,7 +224,7 @@ static const char *parse_route_addr (const char *s, char token[STRING]; size_t tokenlen = 0; - SKIPWS (s); + s = vskipspaces(s); /* find the end of the route */ if (*s == '@') { @@ -256,7 +256,7 @@ static const char *parse_route_addr (const char *s, } if (!addr->mailbox) - addr->mailbox = str_dup ("@"); + addr->mailbox = m_strdup("@"); s++; return s; @@ -313,8 +313,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) ws_pending = isspace ((unsigned char) *s); - SKIPWS (s); - begin = s; + begin = s = vskipspaces(s); while (*s) { if (*s == ',') { if (phraselen) { @@ -324,14 +323,13 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) } else if (commentlen && last && !last->personal) { terminate_buffer (comment, commentlen); - last->personal = str_dup (comment); + last->personal = m_strdup(comment); } commentlen = 0; phraselen = 0; s++; - begin = s; - SKIPWS (begin); + begin = vskipspaces(s); } else if (*s == '(') { if (commentlen && commentlen < sizeof (comment) - 1) @@ -347,7 +345,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) else if (*s == ':') { cur = rfc822_new_address (); terminate_buffer (phrase, phraselen); - cur->mailbox = str_dup (phrase); + cur->mailbox = m_strdup(phrase); cur->group = 1; if (last) @@ -359,8 +357,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) phraselen = 0; commentlen = 0; s++; - begin = s; - SKIPWS (begin); + begin = vskipspaces(s); } else if (*s == ';') { if (phraselen) { @@ -370,7 +367,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) } else if (commentlen && last && !last->personal) { terminate_buffer (comment, commentlen); - last->personal = str_dup (comment); + last->personal = m_strdup(comment); } /* add group terminator */ @@ -383,8 +380,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) phraselen = 0; commentlen = 0; s++; - begin = s; - SKIPWS (begin); + begin = vskipspaces(s); } else if (*s == '<') { terminate_buffer (phrase, phraselen); @@ -394,7 +390,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) p_delete(&cur->personal); /* if we get something like "Michael R. Elkins" remove the quotes */ rfc822_dequote_comment (phrase); - cur->personal = str_dup (phrase); + cur->personal = m_strdup(phrase); } if ((ps = parse_route_addr (s + 1, comment, &commentlen, @@ -425,7 +421,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) s = ps; } ws_pending = isspace ((unsigned char) *s); - SKIPWS (s); + s = vskipspaces(s); } if (phraselen) { @@ -436,7 +432,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) } else if (commentlen && last && !last->personal) { terminate_buffer (comment, commentlen); - last->personal = str_dup (comment); + last->personal = m_strdup(comment); } return top; @@ -448,7 +444,7 @@ void rfc822_qualify (ADDRESS * addr, const char *host) for (; addr; addr = addr->next) if (!addr->group && addr->mailbox && strchr (addr->mailbox, '@') == NULL) { - p = p_new(char, str_len(addr->mailbox) + str_len(host) + 2); + p = p_new(char, m_strlen(addr->mailbox) + m_strlen(host) + 2); sprintf (p, "%s@%s", addr->mailbox, host); /* __SPRINTF_CHECKED__ */ p_delete(&addr->mailbox); addr->mailbox = p; @@ -473,10 +469,10 @@ rfc822_cat (char *buf, size_t buflen, const char *value, const char *specials) } *pc++ = '"'; *pc = 0; - strfcpy (buf, tmp, buflen); + m_strcpy(buf, buflen, tmp); } else - strfcpy (buf, value, buflen); + m_strcpy(buf, buflen, value); } void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr, @@ -517,8 +513,8 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr, else { if (!buflen) goto done; - strfcpy (pbuf, addr->personal, buflen); - len = str_len (pbuf); + m_strcpy(pbuf, buflen, addr->personal); + len = m_strlen(pbuf); pbuf += len; buflen -= len; } @@ -540,12 +536,12 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr, if (!buflen) goto done; if (ascii_strcmp (addr->mailbox, "@") && !display) { - strfcpy (pbuf, addr->mailbox, buflen); - len = str_len (pbuf); + m_strcpy(pbuf, buflen, addr->mailbox); + len = m_strlen(pbuf); } else if (ascii_strcmp (addr->mailbox, "@") && display) { - strfcpy (pbuf, mutt_addr_for_display (addr), buflen); - len = str_len (pbuf); + m_strcpy(pbuf, buflen, mutt_addr_for_display(addr)); + len = m_strlen(pbuf); } else { *pbuf = '\0'; @@ -589,7 +585,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr, int display) { char *pbuf = buf; - size_t len = str_len (buf); + size_t len = m_strlen(buf); buflen--; /* save room for the terminal nul */ @@ -616,7 +612,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr, /* this should be safe since we always have at least 1 char passed into the above call, which means `pbuf' should always be nul terminated */ - len = str_len (pbuf); + len = m_strlen(pbuf); pbuf += len; buflen -= len; @@ -642,8 +638,8 @@ ADDRESS *rfc822_cpy_adr_real (ADDRESS * addr) { ADDRESS *p = rfc822_new_address (); - p->personal = str_dup (addr->personal); - p->mailbox = str_dup (addr->mailbox); + p->personal = m_strdup(addr->personal); + p->mailbox = m_strdup(addr->mailbox); p->group = addr->group; return p; }