X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=parse.c;h=ee8d70f84efe34e43d1c37670f0bf89634b872c0;hp=5abfb0629f330bc5fabba98724c167d688dbee22;hb=e39e529e5df06cd4148de4614073b66a23be0b26;hpb=0f44dc85fc1280372ffab911d701e703d803fb4b diff --git a/parse.c b/parse.c index 5abfb06..ee8d70f 100644 --- a/parse.c +++ b/parse.c @@ -12,7 +12,7 @@ #endif #include "mutt.h" -#include "mailbox.h" +#include "mx.h" #include "mime.h" #include "rfc2047.h" #include "rfc2231.h" @@ -23,6 +23,7 @@ #include "lib/intl.h" #include "lib/str.h" #include "lib/rx.h" +#include "lib/debug.h" #include #include @@ -46,7 +47,7 @@ static char *read_rfc822_line (FILE * f, char *line, size_t * linelen) return (line); } - buf += safe_strlen (buf) - 1; + buf += mutt_strlen (buf) - 1; if (*buf == '\n') { /* we did get a full line. remove trailing space */ while (ISSPACE (*buf)) @@ -95,7 +96,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to) new = NULL; if (*s == '<') { - n = safe_strlen (s); + n = mutt_strlen (s); if (s[n - 1] != '>') { o = s; s = NULL; @@ -105,7 +106,7 @@ LIST *mutt_parse_references (char *s, int in_reply_to) new = safe_strdup (s); } else if (o) { - m = safe_strlen (s); + m = mutt_strlen (s); if (s[m - 1] == '>') { new = safe_malloc (sizeof (char) * (n + m + 1)); strcpy (new, o); /* __STRCPY_CHECKED__ */ @@ -168,12 +169,11 @@ static PARAMETER *parse_parameters (const char *s) const char *p; size_t i; - dprint (2, (debugfile, "parse_parameters: `%s'\n", s)); + debug_print (2, ("`%s'\n", s)); while (*s) { if ((p = strpbrk (s, "=;")) == NULL) { - dprint (1, - (debugfile, "parse_parameters: malformed parameter: %s\n", s)); + debug_print (1, ("malformed parameter: %s\n", s)); goto bail; } @@ -233,8 +233,7 @@ static PARAMETER *parse_parameters (const char *s) new->value = safe_strdup (buffer); - dprint (2, (debugfile, "parse_parameter: `%s' = `%s'\n", - new->attribute ? new->attribute : "", + debug_print (2, ("`%s' = `%s'\n", new->attribute ? new->attribute : "", new->value ? new->value : "")); /* Add this parameter to the list */ @@ -246,9 +245,7 @@ static PARAMETER *parse_parameters (const char *s) head = cur = new; } else { - dprint (1, - (debugfile, "parse_parameters(): parameter with no value: %s\n", - s)); + debug_print (1, ("parameter with no value: %s\n", s)); s = p; } @@ -431,16 +428,12 @@ BODY *mutt_read_mime_header (FILE * fp, int digest) c++; SKIPWS (c); if (!*c) { - dprint (1, - (debugfile, - "mutt_read_mime_header(): skipping empty header field: %s\n", - line)); + debug_print (1, ("skipping empty header field: %s\n", line)); continue; } } else { - dprint (1, - (debugfile, "read_mime_header: bogus MIME header: %s\n", line)); + debug_print (1, ("bogus MIME header: %s\n", line)); break; } @@ -589,9 +582,9 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, long end_off, return (NULL); } - blen = safe_strlen (boundary); + blen = mutt_strlen (boundary); while (ftell (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL) { - len = safe_strlen (buffer); + len = mutt_strlen (buffer); crlf = (len > 1 && buffer[len - 2] == '\r') ? 1 : 0; @@ -612,7 +605,7 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, long end_off, buffer[i] = 0; /* Check for the end boundary */ - if (safe_strcmp (buffer + blen + 2, "--") == 0) { + if (mutt_strcmp (buffer + blen + 2, "--") == 0) { final = 1; break; /* done parsing */ } @@ -836,9 +829,7 @@ time_t mutt_parse_date (const char *s, HEADER * h) else if (sscanf (t, "%d:%d", &hour, &min) == 2) sec = 0; else { - dprint (1, - (debugfile, "parse_date: could not process time format: %s\n", - t)); + debug_print (1, ("could not process time format: %s\n", t)); return (-1); } tm.tm_hour = hour; @@ -898,9 +889,7 @@ time_t mutt_parse_date (const char *s, HEADER * h) } if (count < 4) { /* don't check for missing timezone */ - dprint (1, - (debugfile, - "parse_date(): error parsing date format, using received time\n")); + debug_print (1, ("error parsing date format, using received time\n")); return (-1); } @@ -1048,8 +1037,8 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, #ifdef USE_NNTP else if (!safe_strcasecmp (line + 1, "ollowup-to")) { if (!e->followup_to) { - mutt_remove_trailing_ws (p); - e->followup_to = safe_strdup (mutt_skip_whitespace (p)); + str_skip_trailws (p); + e->followup_to = safe_strdup (str_skip_initws (p)); } matched = 1; } @@ -1131,8 +1120,8 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, case 'n': if (!safe_strcasecmp (line + 1, "ewsgroups")) { FREE (&e->newsgroups); - mutt_remove_trailing_ws (p); - e->newsgroups = safe_strdup (mutt_skip_whitespace (p)); + str_skip_trailws (p); + e->newsgroups = safe_strdup (str_skip_initws (p)); matched = 1; } break; @@ -1257,7 +1246,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, /* Keep track of the user-defined headers */ if (!matched && user_hdrs) { /* restore the original line */ - line[safe_strlen (line)] = ':'; + line[mutt_strlen (line)] = ':'; if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore) && !mutt_matches_ignore (line, UnIgnore)) @@ -1380,7 +1369,7 @@ ENVELOPE *mutt_read_rfc822_header (FILE * f, HEADER * hdr, short user_hdrs, } if (e->spam && e->spam->data) - dprint (5, (debugfile, "p822: spam = %s\n", e->spam->data)); + debug_print (5, ("spam = %s\n", e->spam->data)); } } @@ -1424,9 +1413,7 @@ ENVELOPE *mutt_read_rfc822_header (FILE * f, HEADER * hdr, short user_hdrs, /* check for missing or invalid date */ if (hdr->date_sent <= 0) { - dprint (1, - (debugfile, - "read_rfc822_header(): no date found, using received time from msg separator\n")); + debug_print (1, ("no date found, using received time from msg separator\n")); hdr->date_sent = hdr->received; } }