Commit a3f726e3 authored by Thomas Roessler's avatar Thomas Roessler

Introduce or rewrite mutt_{str*cmp,strlen} and use them all over the

place.  If there are still segmentation faults due to missing
NONULLs over, they are gone now.
parent 912c6b0d
......@@ -93,7 +93,7 @@ static int alias_SortAlias (const void *a, const void *b)
{
ALIAS *pa = *(ALIAS **) a;
ALIAS *pb = *(ALIAS **) b;
int r = strcasecmp (pa->name, pb->name);
int r = mutt_strcasecmp (pa->name, pb->name);
return (RSORT (r));
}
......@@ -107,14 +107,14 @@ static int alias_SortAddress (const void *a, const void *b)
if (pa->personal)
{
if (pb->personal)
r = strcasecmp (pa->personal, pb->personal);
r = mutt_strcasecmp (pa->personal, pb->personal);
else
r = 1;
}
else if (pb->personal)
r = -1;
else
r = strcasecmp (pa->mailbox, pb->mailbox);
r = mutt_strcasecmp (pa->mailbox, pb->mailbox);
return (RSORT (r));
}
......
......@@ -29,7 +29,7 @@ ADDRESS *mutt_lookup_alias (const char *s)
ALIAS *t = Aliases;
for (; t; t = t->next)
if (!strcasecmp (s, t->name))
if (!mutt_strcasecmp (s, t->name))
return (t->addr);
return (NULL); /* no such alias */
}
......@@ -52,7 +52,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS *a, LIST **expn)
i = 0;
for (u = *expn; u; u = u->next)
{
if (strcmp (a->mailbox, u->data) == 0) /* alias already found */
if (mutt_strcmp (a->mailbox, u->data) == 0) /* alias already found */
{
dprint (1, (debugfile, "mutt_expand_aliases_r(): loop in alias found for '%s'\n", a->mailbox));
i = 1;
......@@ -287,7 +287,7 @@ ADDRESS *alias_reverse_lookup (ADDRESS *a)
for (ap = t->addr; ap; ap = ap->next)
{
if (!ap->group && ap->mailbox &&
strcasecmp (ap->mailbox, a->mailbox) == 0)
mutt_strcasecmp (ap->mailbox, a->mailbox) == 0)
return ap;
}
}
......@@ -315,7 +315,7 @@ int mutt_alias_complete (char *s, size_t buflen)
if (a->name && strstr (a->name, s) == a->name)
{
if (!bestname[0]) /* init */
strfcpy (bestname, a->name, min (strlen (a->name) + 1, sizeof (bestname)));
strfcpy (bestname, a->name, min (mutt_strlen (a->name) + 1, sizeof (bestname)));
else
{
for (i = 0 ; a->name[i] && a->name[i] == bestname[i] ; i++)
......@@ -334,7 +334,7 @@ int mutt_alias_complete (char *s, size_t buflen)
}
else
{
if (strcmp (bestname, s) == 0) /* add anything to the completion? */
if (mutt_strcmp (bestname, s) == 0) /* add anything to the completion? */
{
/* build alias list and show it */
a = Aliases;
......@@ -369,7 +369,7 @@ int mutt_alias_complete (char *s, size_t buflen)
return 0;
}
else /* we are adding something to the completion */
strfcpy (s, bestname, strlen (bestname) + 1);
strfcpy (s, bestname, mutt_strlen (bestname) + 1);
}
return 1;
......@@ -380,7 +380,7 @@ static int string_is_address(const char *str, const char *u, const char *d)
char buf[LONG_STRING];
snprintf(buf, sizeof(buf), "%s@%s", NONULL(u), NONULL(d));
if (strcasecmp(str, buf) == 0)
if (mutt_strcasecmp(str, buf) == 0)
return 1;
return 0;
......@@ -395,7 +395,7 @@ int mutt_addr_is_user (ADDRESS *addr)
if (!addr->mailbox)
return 0;
if (strcasecmp (addr->mailbox, NONULL(Username)) == 0)
if (mutt_strcasecmp (addr->mailbox, Username) == 0)
return 1;
if(string_is_address(addr->mailbox, Username, Hostname))
return 1;
......
......@@ -256,7 +256,7 @@ int mutt_edit_attachment (BODY *a)
else if (a->type == TYPETEXT)
{
/* On text, default to editor */
mutt_edit_file ((!Editor || strcmp ("builtin", Editor) == 0) ?
mutt_edit_file ((!Editor || mutt_strcmp ("builtin", Editor) == 0) ?
NONULL(Visual) : NONULL(Editor), newfile);
}
else
......@@ -284,10 +284,10 @@ int mutt_is_autoview (char *type)
while (t)
{
i = strlen (t->data) - 1;
i = mutt_strlen (t->data) - 1;
if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' &&
strncasecmp (type, t->data, i) == 0) ||
strcasecmp (type, t->data) == 0)
mutt_strncasecmp (type, t->data, i) == 0) ||
mutt_strcasecmp (type, t->data) == 0)
return 1;
t = t->next;
}
......@@ -359,7 +359,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag)
if (rfc1524_expand_filename (entry->nametemplate, fname,
tempfile, sizeof (tempfile)))
{
if (fp == NULL && strcmp(tempfile, a->filename))
if (fp == NULL && mutt_strcmp(tempfile, a->filename))
{
/* send case: the file is already there */
if (safe_symlink (a->filename, tempfile) == -1)
......@@ -859,8 +859,8 @@ int mutt_print_attachment (FILE *fp, BODY *a)
return (1);
}
if (!strcasecmp ("text/plain", a->subtype) ||
!strcasecmp ("application/postscript", a->subtype))
if (!mutt_strcasecmp ("text/plain", a->subtype) ||
!mutt_strcasecmp ("application/postscript", a->subtype))
{
return (mutt_pipe_attachment (fp, a, NONULL(PrintCmd), NULL));
}
......
......@@ -85,7 +85,7 @@ static int browser_compare_subject (const void *a, const void *b)
struct folder_file *pa = (struct folder_file *) a;
struct folder_file *pb = (struct folder_file *) b;
int r = strcmp (pa->name, pb->name);
int r = mutt_strcmp (pa->name, pb->name);
return ((BrowserSort & SORT_REVERSE) ? -r : r);
}
......@@ -358,10 +358,10 @@ static int examine_directory (MUTTMENU *menu, struct browser_state *state,
while ((de = readdir (dp)) != NULL)
{
if (strcmp (de->d_name, ".") == 0)
if (mutt_strcmp (de->d_name, ".") == 0)
continue; /* we don't need . */
if (prefix && *prefix && strncmp (prefix, de->d_name, strlen (prefix)) != 0)
if (prefix && *prefix && mutt_strncmp (prefix, de->d_name, mutt_strlen (prefix)) != 0)
continue;
if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not))
continue;
......@@ -375,7 +375,7 @@ static int examine_directory (MUTTMENU *menu, struct browser_state *state,
continue;
tmp = Incoming;
while (tmp && strcmp (buffer, NONULL(tmp->path)))
while (tmp && mutt_strcmp (buffer, tmp->path))
tmp = tmp->next;
add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0);
}
......@@ -472,7 +472,7 @@ void mutt_select_file (char *f, size_t flen, int buffy)
if (*f)
{
mutt_expand_path (f, flen);
for (i = strlen (f) - 1; i > 0 && f[i] != '/' ; i--);
for (i = mutt_strlen (f) - 1; i > 0 && f[i] != '/' ; i--);
if (i > 0)
{
if (f[0] == '/')
......@@ -559,9 +559,9 @@ void mutt_select_file (char *f, size_t flen, int buffy)
/* save the old directory */
strfcpy (OldLastDir, LastDir, sizeof (OldLastDir));
if (strcmp (state.entry[menu->current].name, "..") == 0)
if (mutt_strcmp (state.entry[menu->current].name, "..") == 0)
{
if (strcmp ("..", LastDir + strlen (LastDir) - 2) == 0)
if (mutt_strcmp ("..", LastDir + mutt_strlen (LastDir) - 2) == 0)
strcat (LastDir, "/..");
else
{
......@@ -584,7 +584,7 @@ void mutt_select_file (char *f, size_t flen, int buffy)
mutt_expand_path (LastDir, sizeof (LastDir));
}
else
sprintf (LastDir + strlen (LastDir), "/%s",
sprintf (LastDir + mutt_strlen (LastDir), "/%s",
state.entry[menu->current].name);
destroy_state (&state);
......@@ -636,7 +636,7 @@ void mutt_select_file (char *f, size_t flen, int buffy)
strfcpy (buf, LastDir, sizeof (buf));
{/* add '/' at the end of the directory name */
int len=strlen(LastDir);
int len=mutt_strlen(LastDir);
if (sizeof (buf) > len)
buf[len]='/';
}
......
......@@ -64,13 +64,13 @@ int fseek_last_message (FILE * f)
while ((pos -= bytes_read) >= 0)
{
/* we save in the buffer at the end the first 7 chars from the last read */
strncpy (buffer + BUFSIZ, buffer, 5+2); /* 2 == 2 * strlen(CRLF) */
strncpy (buffer + BUFSIZ, buffer, 5+2); /* 2 == 2 * mutt_strlen(CRLF) */
fseek (f, pos, SEEK_SET);
bytes_read = fread (buffer, sizeof (char), bytes_read, f);
if (bytes_read == -1)
return -1;
for (i = bytes_read; --i >= 0;)
if (!strncmp (buffer + i, "\n\nFrom ", strlen ("\n\nFrom ")))
if (!mutt_strncmp (buffer + i, "\n\nFrom ", mutt_strlen ("\n\nFrom ")))
{ /* found it - go to the beginning of the From */
fseek (f, pos + i + 2, SEEK_SET);
return 0;
......@@ -79,7 +79,7 @@ int fseek_last_message (FILE * f)
}
/* here we are at the beginning of the file */
if (!strncmp ("From ", buffer, 5))
if (!mutt_strncmp ("From ", buffer, 5))
{
fseek (f, 0, 0);
return (0);
......@@ -177,7 +177,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
/* simple check to avoid duplicates */
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
{
if (strcmp (buf, (*tmp)->path) == 0)
if (mutt_strcmp (buf, (*tmp)->path) == 0)
break;
}
......@@ -413,7 +413,7 @@ void mutt_buffy (char *s)
count = 0;
while (count < 3)
{
if (strcmp (s, tmp->path) == 0)
if (mutt_strcmp (s, tmp->path) == 0)
count++;
else if (count && tmp->new)
break;
......
......@@ -54,7 +54,7 @@ static void canonical_charset(char *dest, size_t dlen, const char *name)
{
int i;
if(!strncasecmp(name, "x-", 2))
if(!mutt_strncasecmp(name, "x-", 2))
name = name + 2;
for(i = 0; name[i] && i < dlen - 1; i++)
......@@ -85,7 +85,7 @@ static CHARSET *load_charset(const char *name)
if(fgets(buffer, sizeof(buffer), fp) == NULL)
goto bail;
if(strcmp(buffer, CHARSET_MAGIC) != 0)
if(mutt_strcmp(buffer, CHARSET_MAGIC) != 0)
goto bail;
chs->map = safe_malloc(sizeof(CHARSET_MAP));
......@@ -212,7 +212,7 @@ CHARSET_MAP *mutt_get_translation(const char *_from, const char *_to)
to = to_canon;
/* quick check for the identity mapping */
if((from == to) || ((*from == *to) && !strcmp(from, to)))
if((from == to) || ((*from == *to) && !mutt_strcmp(from, to)))
return NULL;
snprintf(key, sizeof(key), "%s %s", from, to);
......@@ -260,7 +260,7 @@ int mutt_is_utf8(const char *s)
return 0;
canonical_charset(buffer, sizeof(buffer), s);
return !strcmp(buffer, "utf-8");
return !mutt_strcmp(buffer, "utf-8");
}
/* macros for the various bit maps we need */
......
......@@ -290,14 +290,14 @@ parse_color_name (const char *s, int *col, int *attr, int brite, BUFFER *err)
{
char *eptr;
if (strncasecmp (s, "bright", 6) == 0)
if (mutt_strncasecmp (s, "bright", 6) == 0)
{
*attr |= brite;
s += 6;
}
/* allow aliases for xterm color resources */
if (strncasecmp (s, "color", 5) == 0)
if (mutt_strncasecmp (s, "color", 5) == 0)
{
s += 5;
*col = strtol (s, &eptr, 10);
......@@ -360,7 +360,7 @@ _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err,
return (-1);
}
if (strncmp (buf->data, "index", 5) != 0)
if (mutt_strncmp (buf->data, "index", 5) != 0)
{
snprintf (err->data, err->dsize,
_("%s: command valid only for index object"),
......@@ -391,7 +391,7 @@ _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err,
do
{
mutt_extract_token (buf, s, 0);
if (!strcmp ("*", buf->data))
if (!mutt_strcmp ("*", buf->data))
{
for (tmp = ColorIndexList; tmp; )
{
......@@ -407,7 +407,7 @@ _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err,
{
for (last = NULL, tmp = ColorIndexList; tmp; last = tmp, tmp = tmp->next)
{
if (!strcmp (buf->data, tmp->pattern))
if (!mutt_strcmp (buf->data, tmp->pattern))
{
if (!do_cache)
do_cache = 1;
......@@ -454,12 +454,12 @@ add_pattern (COLOR_LINE **top, const char *s, int sensitive,
{
if (sensitive)
{
if (strcmp (s, tmp->pattern) == 0)
if (mutt_strcmp (s, tmp->pattern) == 0)
break;
}
else
{
if (strcasecmp (s, tmp->pattern) == 0)
if (mutt_strcasecmp (s, tmp->pattern) == 0)
break;
}
tmp = tmp->next;
......@@ -540,7 +540,7 @@ parse_object(BUFFER *buf, BUFFER *s, int *o, int *ql, BUFFER *err)
}
mutt_extract_token(buf, s, 0);
if(!strncmp(buf->data, "quoted", 6))
if(!mutt_strncmp(buf->data, "quoted", 6))
{
if(buf->data[6])
{
......@@ -614,17 +614,17 @@ parse_attr_spec(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *err
mutt_extract_token (buf, s, 0);
if (strcasecmp ("bold", buf->data) == 0)
if (mutt_strcasecmp ("bold", buf->data) == 0)
*attr |= A_BOLD;
else if (strcasecmp ("underline", buf->data) == 0)
else if (mutt_strcasecmp ("underline", buf->data) == 0)
*attr |= A_UNDERLINE;
else if (strcasecmp ("none", buf->data) == 0)
else if (mutt_strcasecmp ("none", buf->data) == 0)
*attr = A_NORMAL;
else if (strcasecmp ("reverse", buf->data) == 0)
else if (mutt_strcasecmp ("reverse", buf->data) == 0)
*attr |= A_REVERSE;
else if (strcasecmp ("standout", buf->data) == 0)
else if (mutt_strcasecmp ("standout", buf->data) == 0)
*attr |= A_STANDOUT;
else if (strcasecmp ("normal", buf->data) == 0)
else if (mutt_strcasecmp ("normal", buf->data) == 0)
*attr = A_NORMAL; /* needs use = instead of |= to clear other bits */
else
{
......
......@@ -69,7 +69,7 @@ static int is_mmnoask (const char *buf)
if ((p = getenv ("MM_NOASK")) != NULL && *p)
{
if (strcmp (p, "1") == 0)
if (mutt_strcmp (p, "1") == 0)
return (1);
strfcpy (tmp, p, sizeof (tmp));
......@@ -81,19 +81,19 @@ static int is_mmnoask (const char *buf)
{
if (*(q+1) == '*')
{
if (strncasecmp (buf, p, q-p) == 0)
if (mutt_strncasecmp (buf, p, q-p) == 0)
return (1);
}
else
{
if (strcasecmp (buf, p) == 0)
if (mutt_strcasecmp (buf, p) == 0)
return (1);
}
}
else
{
lng = strlen (p);
if (buf[lng] == '/' && strncasecmp (buf, p, lng) == 0)
lng = mutt_strlen (p);
if (buf[lng] == '/' && mutt_strncasecmp (buf, p, lng) == 0)
return (1);
}
......@@ -178,7 +178,7 @@ int mutt_display_message (HEADER *cur)
return (0);
}
if (!Pager || strcmp (Pager, "builtin") == 0)
if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
builtin = 1;
else
{
......@@ -622,7 +622,7 @@ int mutt_save_message (HEADER *h, int delete, int decode, int decrypt, int *redr
/* This is an undocumented feature of ELM pointed out to me by Felix von
* Leitner <leitner@prz.fu-berlin.de>
*/
if (strcmp (buf, ".") == 0)
if (mutt_strcmp (buf, ".") == 0)
strfcpy (buf, LastSaveFolder, sizeof (buf));
else
strfcpy (LastSaveFolder, buf, sizeof (LastSaveFolder));
......
......@@ -48,8 +48,8 @@ int mutt_complete (char *s)
if ((p = strrchr (s, '/')))
{
*p++ = 0;
sprintf (exp_dirpart + strlen (exp_dirpart), "/%s", s+1);
sprintf (dirpart + strlen (dirpart), "%s/", s+1);
sprintf (exp_dirpart + mutt_strlen (exp_dirpart), "/%s", s+1);
sprintf (dirpart + mutt_strlen (dirpart), "%s/", s+1);
strfcpy (filepart, p, sizeof (filepart));
}
else
......@@ -100,11 +100,11 @@ int mutt_complete (char *s)
* special case to handle when there is no filepart yet. find the first
* file/directory which is not ``.'' or ``..''
*/
if ((len = strlen (filepart)) == 0)
if ((len = mutt_strlen (filepart)) == 0)
{
while ((de = readdir (dirp)) != NULL)
{
if (strcmp (".", de->d_name) != 0 && strcmp ("..", de->d_name) != 0)
if (mutt_strcmp (".", de->d_name) != 0 && mutt_strcmp ("..", de->d_name) != 0)
{
strfcpy (filepart, de->d_name, sizeof (filepart));
init++;
......@@ -115,7 +115,7 @@ int mutt_complete (char *s)
while ((de = readdir (dirp)) != NULL)
{
if (strncmp (de->d_name, filepart, len) == 0)
if (mutt_strncmp (de->d_name, filepart, len) == 0)
{
if (init)
{
......@@ -156,7 +156,7 @@ int mutt_complete (char *s)
if (dirpart[0])
{
strcpy (s, dirpart);
if (strcmp ("/", dirpart) != 0 && dirpart[0] != '=' && dirpart[0] != '+')
if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '=' && dirpart[0] != '+')
strcat (s, "/");
strcat (s, filepart);
}
......
......@@ -191,8 +191,8 @@ static int pgp_send_menu (int bits, int *redraw)
if(mutt_get_field (_("MIC algorithm: "), input_micalg, sizeof(input_micalg), 0) == 0)
{
if(strcasecmp(input_micalg, "pgp-md5") && strcasecmp(input_micalg, "pgp-sha1")
&& strcasecmp(input_micalg, "pgp-rmd160"))
if(mutt_strcasecmp(input_micalg, "pgp-md5") && mutt_strcasecmp(input_micalg, "pgp-sha1")
&& mutt_strcasecmp(input_micalg, "pgp-rmd160"))
{
mutt_error _("Unknown MIC algorithm, valid ones are: pgp-md5, pgp-sha1, pgp-rmd160");
}
......@@ -446,7 +446,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
MAYBE_REDRAW (menu->redraw);
break;
case OP_COMPOSE_EDIT_MESSAGE:
if (Editor && (strcmp ("builtin", Editor) != 0) && !option (OPTEDITHDRS))
if (Editor && (mutt_strcmp ("builtin", Editor) != 0) && !option (OPTEDITHDRS))
{
mutt_edit_file (Editor, msg->content->filename);
mutt_update_encoding (msg->content);
......@@ -458,7 +458,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
if (op == OP_COMPOSE_EDIT_HEADERS ||
(op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))
{
mutt_edit_headers ((!Editor || strcmp ("builtin", Editor) == 0) ? NONULL(Visual) : NONULL(Editor),
mutt_edit_headers ((!Editor || mutt_strcmp ("builtin", Editor) == 0) ? NONULL(Visual) : NONULL(Editor),
msg->content->filename, msg, fcc, fcclen);
}
else
......@@ -789,7 +789,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
case OP_COMPOSE_EDIT_FILE:
CHECK_COUNT;
mutt_edit_file ((!Editor || strcmp ("builtin", Editor) == 0) ? NONULL(Visual) : NONULL(Editor),
mutt_edit_file ((!Editor || mutt_strcmp ("builtin", Editor) == 0) ? NONULL(Visual) : NONULL(Editor),
idx[menu->current]->content->filename);
mutt_update_encoding (idx[menu->current]->content);
menu->redraw = REDRAW_CURRENT;
......
......@@ -78,7 +78,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
if (nl && buf[0] != ' ' && buf[0] != '\t')
{
ignore = 1;
if (!from && strncmp ("From ", buf, 5) == 0)
if (!from && mutt_strncmp ("From ", buf, 5) == 0)
{
if ((flags & CH_FROM) == 0)
continue;
......@@ -88,12 +88,12 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
break; /* end of header */
if ((flags & (CH_UPDATE | CH_XMIT | CH_NOSTATUS)) &&
(strncasecmp ("Status:", buf, 7) == 0 ||
strncasecmp ("X-Status:", buf, 9) == 0))
(mutt_strncasecmp ("Status:", buf, 7) == 0 ||
mutt_strncasecmp ("X-Status:", buf, 9) == 0))
continue;
if ((flags & (CH_UPDATE_LEN | CH_XMIT)) &&
(strncasecmp ("Content-Length:", buf, 15) == 0 ||
strncasecmp ("Lines:", buf, 6) == 0))
(mutt_strncasecmp ("Content-Length:", buf, 15) == 0 ||
mutt_strncasecmp ("Lines:", buf, 6) == 0))
continue;
ignore = 0;
}
......@@ -138,7 +138,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
if (nl && buf[0] != ' ' && buf[0] != '\t')
{
ignore = 1;
if (!from && strncmp ("From ", buf, 5) == 0)
if (!from && mutt_strncmp ("From ", buf, 5) == 0)
{
if ((flags & CH_FROM) == 0)
continue;
......@@ -152,18 +152,18 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
!mutt_matches_ignore (buf, UnIgnore))
continue;
if ((flags & (CH_UPDATE | CH_XMIT | CH_NOSTATUS)) &&
(strncasecmp ("Status:", buf, 7) == 0 ||
strncasecmp ("X-Status:", buf, 9) == 0))
(mutt_strncasecmp ("Status:", buf, 7) == 0 ||
mutt_strncasecmp ("X-Status:", buf, 9) == 0))
continue;
if ((flags & (CH_UPDATE_LEN | CH_XMIT)) &&
(strncasecmp ("Content-Length:", buf, 15) == 0 ||
strncasecmp ("Lines:", buf, 6) == 0))
(mutt_strncasecmp ("Content-Length:", buf, 15) == 0 ||
mutt_strncasecmp ("Lines:", buf, 6) == 0))
continue;
if ((flags & CH_MIME) &&
((strncasecmp ("content-", buf, 8) == 0 &&
(strncasecmp ("transfer-encoding:", buf + 8, 18) == 0 ||
strncasecmp ("type:", buf + 8, 5) == 0)) ||
strncasecmp ("mime-version:", buf, 13) == 0))
((mutt_strncasecmp ("content-", buf, 8) == 0 &&
(mutt_strncasecmp ("transfer-encoding:", buf + 8, 18) == 0 ||
mutt_strncasecmp ("type:", buf + 8, 5) == 0)) ||
mutt_strncasecmp ("mime-version:", buf, 13) == 0))
continue;
/* Find x -- the array entry where this header is to be saved */
......@@ -171,7 +171,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
{
for (t = HeaderOrderList, x = 0 ; (t) ; t = t->next, x++)
{
if (!strncasecmp (buf, t->data, strlen (t->data)))
if (!mutt_strncasecmp (buf, t->data, mutt_strlen (t->data)))
{
dprint(2, (debugfile, "Reorder: %s matches %s", t->data, buf));
break;
......@@ -190,7 +190,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
else
{
safe_realloc ((void **) &headers[x],
strlen (headers[x]) + strlen (buf) + sizeof (char));
mutt_strlen (headers[x]) + mutt_strlen (buf) + sizeof (char));
strcat (headers[x], buf);
}
}
......@@ -202,7 +202,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
if (headers[x])
{
if (flags & CH_DECODE)
rfc2047_decode (headers[x], headers[x], strlen (headers[x]));
rfc2047_decode (headers[x], headers[x], mutt_strlen (headers[x]));
/* We couldn't do the prefixing when reading because RFC 2047
* decoding may have concatenated lines.
......@@ -546,7 +546,7 @@ static BODY *new_deleted_body ()
char date[SHORT_STRING];
mutt_make_date (date, sizeof (date));
date[strlen (date) - 1] = 0; /* cut off ending newline character */
date[mutt_strlen (date) - 1] = 0; /* cut off ending newline character */
p->attribute = safe_strdup ("access-type");
p->value = safe_strdup ("x-mutt-deleted");
......
......@@ -87,7 +87,7 @@ event_t mutt_getch (void)
int mutt_get_field (/* const */ char *field, char *buf, size_t buflen, int complete)
{
int ret;
int len = strlen (field); /* in case field==buffer */
int len = mutt_strlen (field); /* in case field==buffer */
do
{
......@@ -107,7 +107,7 @@ int mutt_get_password (char *msg, char *buf, size_t buflen)
CLEARLINE (LINES-1);
addstr (msg);
rc = mutt_enter_string ((unsigned char *) buf, buflen, LINES - 1, strlen (msg), M_PASS);
rc = mutt_enter_string ((unsigned char *) buf, buflen, LINES - 1, mutt_strlen (msg), M_PASS);
CLEARLINE (LINES-1);
return (rc);
}
......@@ -296,7 +296,7 @@ int mutt_do_pager (const char *banner,
{
int rc;
if (!Pager || strcmp (Pager, "builtin") == 0)
if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
rc = mutt_pager (banner, tempfile, do_color, info);
else
{
......@@ -338,7 +338,7 @@ int mutt_enter_fname (const char *prompt, char *buf, size_t blen, int *redraw, i
}
else
{
char *pc = safe_malloc (strlen (prompt) + 3);
char *pc = safe_malloc (mutt_strlen (prompt) + 3);
sprintf (pc, "%s: ", prompt);
mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
......@@ -419,7 +419,7 @@ int mutt_multi_choice (char *prompt, char *letters)
else if (ch.ch <= '9' && ch.ch > '0')
{
choice = ch.ch - '0';
if (choice <= strlen (letters))
if (choice <= mutt_strlen (letters))
break;
}
}
......
......@@ -434,7 +434,7 @@ dotlock_prepare(char *bn, size_t l, const char *f)
dirname = ".";
}
if(strlen(basename) + 1 > l)
if(mutt_strlen(basename) + 1 > l)
return -1;
strfcpy(bn, basename, l);
......
......@@ -66,7 +66,7 @@ be_snarf_data (FILE *f, char **buf, int *bufmax, int *buflen, int offset,
if (prefix)
{
strfcpy (tmp, NONULL(Prefix), sizeof (tmp));
tmplen = strlen (tmp);
tmplen = mutt_strlen (tmp);
p = tmp + tmplen;
tmplen = sizeof (tmp) - tmplen;
}
......@@ -75,7 +75,7 @@ be_snarf_data (FILE *f, char **buf, int *bufmax, int *buflen, int offset,
while (bytes > 0)
{
if (fgets (p, tmplen - 1, f) == NULL) break;
bytes -= strlen (p);
bytes -= mutt_strlen (p);
if (*bufmax == *buflen)
safe_realloc ((void **)&buf, sizeof (char *) * (*bufmax += 25));
buf[(*buflen)++] = safe_strdup (tmp);
......@@ -327,7 +327,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
if (EscChar && tmp[0] == EscChar[0] && tmp[1] != EscChar[0])
{
/* remove trailing whitespace from the line */
p = tmp + strlen (tmp) - 1;
p = tmp + mutt_strlen (tmp) - 1;
while (p >= tmp && ISSPACE (*p))
*p-- = 0;
......@@ -359,8 +359,8 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
if (!*p && cur)
{
/* include the current message */
p = tmp + strlen (tmp) + 1;
snprintf (tmp + strlen (tmp), sizeof (tmp) - strlen (tmp), " %d",
p = tmp + mutt_strlen (tmp) + 1;
snprintf (tmp + mutt_strlen (tmp), sizeof (tmp) - mutt_strlen (tmp), " %d",
cur->msgno + 1);
}
buf = be_include_messages (p, buf, &bufmax, &buflen,
......@@ -404,7 +404,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
{
buflen--;
strfcpy (tmp, buf[buflen], sizeof (tmp));
tmp[strlen (tmp)-1] = 0;
tmp[mutt_strlen (tmp)-1] = 0;
FREE (&buf[buflen]);
buf[buflen] = NULL;
continue;
......@@ -443,7 +443,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
break;
}
}
else if (strcmp (".", tmp) == 0)
else if (mutt_strcmp (".", tmp) == 0)
done = 1;
else
{
......
......@@ -88,7 +88,7 @@ int mutt_enter_string (unsigned char *buf, size_t buflen, int y, int x,
if (redraw == M_REDRAW_INIT)