projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lot of restructurations. work in progress, *but* it does not seems to
[apps/madmutt.git]
/
rfc822.c
diff --git
a/rfc822.c
b/rfc822.c
index
618e37b
..
30f1379
100644
(file)
--- a/
rfc822.c
+++ b/
rfc822.c
@@
-15,12
+15,14
@@
#include <ctype.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdlib.h>
+#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
+#include <lib-lib/ascii.h>
+#include <lib-lib/macros.h>
+
#include "mutt.h"
#include "mutt_idna.h"
#include "mutt.h"
#include "mutt_idna.h"
-#include "lib/mem.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)
#define terminate_string(a, b, c) do { if ((b) < (c)) a[(b)] = 0; else \
a[(c)] = 0; } while (0)
@@
-70,9
+72,9
@@
void rfc822_free_address (ADDRESS ** p)
while (*p) {
t = *p;
*p = (*p)->next;
while (*p) {
t = *p;
*p = (*p)->next;
-
FREE
(&t->personal);
-
FREE
(&t->mailbox);
-
FREE
(&t);
+
p_delete
(&t->personal);
+
p_delete
(&t->mailbox);
+
p_delete
(&t);
}
}
}
}
@@
-163,7
+165,7
@@
static const char *parse_mailboxdomain (const char *s, const char *nonspecial,
const char *ps;
while (*s) {
const char *ps;
while (*s) {
-
SKIPWS
(s);
+
s = vskipspaces
(s);
if (strchr (nonspecial, *s) == NULL && is_special (*s))
return s;
if (strchr (nonspecial, *s) == NULL && is_special (*s))
return s;
@@
-205,11
+207,11
@@
static const char *parse_address (const char *s,
}
terminate_string (token, *tokenlen, tokenmax);
}
terminate_string (token, *tokenlen, tokenmax);
- addr->mailbox =
str_dup
(token);
+ addr->mailbox =
m_strdup
(token);
if (*commentlen && !addr->personal) {
terminate_string (comment, *commentlen, commentmax);
if (*commentlen && !addr->personal) {
terminate_string (comment, *commentlen, commentmax);
- addr->personal =
str_dup
(comment);
+ addr->personal =
m_strdup
(comment);
}
return s;
}
return s;
@@
-222,7
+224,7
@@
static const char *parse_route_addr (const char *s,
char token[STRING];
size_t tokenlen = 0;
char token[STRING];
size_t tokenlen = 0;
-
SKIPWS
(s);
+
s = vskipspaces
(s);
/* find the end of the route */
if (*s == '@') {
/* find the end of the route */
if (*s == '@') {
@@
-254,7
+256,7
@@
static const char *parse_route_addr (const char *s,
}
if (!addr->mailbox)
}
if (!addr->mailbox)
- addr->mailbox =
str_dup
("@");
+ addr->mailbox =
m_strdup
("@");
s++;
return s;
s++;
return s;
@@
-311,8
+313,7
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
ws_pending = isspace ((unsigned char) *s);
ws_pending = isspace ((unsigned char) *s);
- SKIPWS (s);
- begin = s;
+ begin = s = vskipspaces(s);
while (*s) {
if (*s == ',') {
if (phraselen) {
while (*s) {
if (*s == ',') {
if (phraselen) {
@@
-322,14
+323,13
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
}
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++;
}
commentlen = 0;
phraselen = 0;
s++;
- begin = s;
- SKIPWS (begin);
+ begin = vskipspaces(s);
}
else if (*s == '(') {
if (commentlen && commentlen < sizeof (comment) - 1)
}
else if (*s == '(') {
if (commentlen && commentlen < sizeof (comment) - 1)
@@
-345,7
+345,7
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
else if (*s == ':') {
cur = rfc822_new_address ();
terminate_buffer (phrase, phraselen);
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)
cur->group = 1;
if (last)
@@
-357,8
+357,7
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
phraselen = 0;
commentlen = 0;
s++;
phraselen = 0;
commentlen = 0;
s++;
- begin = s;
- SKIPWS (begin);
+ begin = vskipspaces(s);
}
else if (*s == ';') {
if (phraselen) {
}
else if (*s == ';') {
if (phraselen) {
@@
-368,7
+367,7
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
- last->personal =
str_dup
(comment);
+ last->personal =
m_strdup
(comment);
}
/* add group terminator */
}
/* add group terminator */
@@
-381,18
+380,17
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
phraselen = 0;
commentlen = 0;
s++;
phraselen = 0;
commentlen = 0;
s++;
- begin = s;
- SKIPWS (begin);
+ begin = vskipspaces(s);
}
else if (*s == '<') {
terminate_buffer (phrase, phraselen);
cur = rfc822_new_address ();
if (phraselen) {
if (cur->personal)
}
else if (*s == '<') {
terminate_buffer (phrase, phraselen);
cur = rfc822_new_address ();
if (phraselen) {
if (cur->personal)
-
FREE
(&cur->personal);
+
p_delete
(&cur->personal);
/* if we get something like "Michael R. Elkins" remove the quotes */
rfc822_dequote_comment (phrase);
/* 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,
}
if ((ps =
parse_route_addr (s + 1, comment, &commentlen,
@@
-423,7
+421,7
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
s = ps;
}
ws_pending = isspace ((unsigned char) *s);
s = ps;
}
ws_pending = isspace ((unsigned char) *s);
-
SKIPWS
(s);
+
s = vskipspaces
(s);
}
if (phraselen) {
}
if (phraselen) {
@@
-434,7
+432,7
@@
ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s)
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
}
else if (commentlen && last && !last->personal) {
terminate_buffer (comment, commentlen);
- last->personal =
str_dup
(comment);
+ last->personal =
m_strdup
(comment);
}
return top;
}
return top;
@@
-446,9
+444,9
@@
void rfc822_qualify (ADDRESS * addr, const char *host)
for (; addr; addr = addr->next)
if (!addr->group && addr->mailbox && strchr (addr->mailbox, '@') == NULL) {
for (; addr; addr = addr->next)
if (!addr->group && addr->mailbox && strchr (addr->mailbox, '@') == NULL) {
- p =
safe_malloc (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__ */
sprintf (p, "%s@%s", addr->mailbox, host); /* __SPRINTF_CHECKED__ */
-
FREE
(&addr->mailbox);
+
p_delete
(&addr->mailbox);
addr->mailbox = p;
}
}
addr->mailbox = p;
}
}
@@
-471,10
+469,10
@@
rfc822_cat (char *buf, size_t buflen, const char *value, const char *specials)
}
*pc++ = '"';
*pc = 0;
}
*pc++ = '"';
*pc = 0;
-
strfcpy (buf, tmp, buflen
);
+
m_strcpy(buf, buflen, tmp
);
}
else
}
else
-
strfcpy (buf, value, buflen
);
+
m_strcpy(buf, buflen, value
);
}
void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr,
}
void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr,
@@
-515,8
+513,8
@@
void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr,
else {
if (!buflen)
goto done;
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;
}
pbuf += len;
buflen -= len;
}
@@
-538,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) {
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) {
}
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';
}
else {
*pbuf = '\0';
@@
-587,7
+585,7
@@
void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr,
int display)
{
char *pbuf = buf;
int display)
{
char *pbuf = buf;
- size_t len =
str_len
(buf);
+ size_t len =
m_strlen
(buf);
buflen--; /* save room for the terminal nul */
buflen--; /* save room for the terminal nul */
@@
-614,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 */
/* 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;
pbuf += len;
buflen -= len;
@@
-640,8
+638,8
@@
ADDRESS *rfc822_cpy_adr_real (ADDRESS * addr)
{
ADDRESS *p = rfc822_new_address ();
{
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;
}
p->group = addr->group;
return p;
}