X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Faddrsbr.c;h=09ea1311e1ea97d5877bc4602dec8c159805341c;hb=0595979e1f0514b3da28762f336b3b9ac9eec5c5;hp=d7894c5458a9df97b6a92148778a43e1cc264900;hpb=cf1205b5cbea2f0cd6ea710ec16c637df85b647c;p=mmh diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index d7894c5..09ea131 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -103,7 +104,7 @@ getm(char *str, char *dfhost, int dftype, int wanthost, char *eresult) dftype = LOCALHOST; } - mp = (struct mailname *) calloc((size_t) 1, sizeof(*mp)); + mp = (struct mailname *) mh_xcalloc((size_t) 1, sizeof(*mp)); if (mp == NULL) { if (eresult) strcpy(eresult, "insufficient memory to represent address"); @@ -236,9 +237,9 @@ int ismymbox(struct mailname *np) { int oops; - register int len, i; - register char *cp; - register char *pp; + int len, i; + char *cp; + char *pp; char buffer[BUFSIZ]; struct mailname *mp; static char *am = NULL; @@ -373,3 +374,28 @@ local_test: ; return 0; } + +/* + * Insert mailname after element and returns the + * number of parsed addresses. element is set to + * the last parsed addresse. + */ +size_t +getmboxes(char *line, struct mailname **element) +{ + struct mailname *mp, *next; + char *cp; + size_t i = 0; + + next = (*element)->m_next; + + while ((cp = getname(line))) { + mp = getm(cp, NULL, 0, AD_HOST, NULL); + (*element)->m_next = mp; + *element = mp; + i++; + } + + (*element)->m_next = next; + return i; +}