diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2001-04-26 13:36:33 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2001-04-26 13:36:33 +0000 |
commit | c73ebd9aa108d55a09c7eebbf9a81e3453fa0c3b (patch) | |
tree | a35487e7f469b6510dab2172a21c8c7d36265033 | |
parent | 3f16589816ab217ec425ecbf026a9a5ade18333f (diff) |
Add ascii_strcasecmp() and ascii_strncasecmp() functions which do
locale-independent and case-insensitive string comparisons. Needed
for mutt to work in iso-8859-9 environments, where tolower('I') !=
'i'.
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | account.c | 2 | ||||
-rw-r--r-- | addrbook.c | 2 | ||||
-rw-r--r-- | alias.c | 8 | ||||
-rw-r--r-- | ascii.c | 97 | ||||
-rw-r--r-- | ascii.h | 42 | ||||
-rw-r--r-- | attach.c | 12 | ||||
-rw-r--r-- | charset.c | 22 | ||||
-rw-r--r-- | color.c | 12 | ||||
-rw-r--r-- | commands.c | 4 | ||||
-rw-r--r-- | copy.c | 28 | ||||
-rw-r--r-- | edit.c | 4 | ||||
-rw-r--r-- | handler.c | 58 | ||||
-rw-r--r-- | headers.c | 8 | ||||
-rw-r--r-- | imap/browse.c | 2 | ||||
-rw-r--r-- | imap/command.c | 14 | ||||
-rw-r--r-- | imap/imap.c | 22 | ||||
-rw-r--r-- | imap/message.c | 38 | ||||
-rw-r--r-- | imap/util.c | 2 | ||||
-rw-r--r-- | init.c | 24 | ||||
-rw-r--r-- | keymap.c | 8 | ||||
-rw-r--r-- | mutt.h | 1 | ||||
-rw-r--r-- | mutt_ssl_nss.c | 6 | ||||
-rw-r--r-- | muttlib.c | 18 | ||||
-rw-r--r-- | mx.c | 10 | ||||
-rw-r--r-- | parse.c | 136 | ||||
-rw-r--r-- | pattern.c | 22 | ||||
-rw-r--r-- | pgp.c | 36 | ||||
-rw-r--r-- | pgpkey.c | 2 | ||||
-rw-r--r-- | postpone.c | 8 | ||||
-rw-r--r-- | recvattach.c | 14 | ||||
-rw-r--r-- | remailer.c | 4 | ||||
-rw-r--r-- | rfc1524.c | 22 | ||||
-rw-r--r-- | rfc2047.c | 2 | ||||
-rw-r--r-- | send.c | 24 | ||||
-rw-r--r-- | sendlib.c | 8 | ||||
-rw-r--r-- | url.c | 8 |
37 files changed, 438 insertions, 300 deletions
diff --git a/Makefile.am b/Makefile.am index 7affd416..7b1cbb85 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,7 +31,7 @@ mutt_SOURCES = $(BUILT_SOURCES) \ score.c send.c sendlib.c signal.c sort.c \ status.c system.c thread.c charset.c history.c lib.c \ muttlib.c editmsg.c utf8.c mbyte.c wcwidth.c gettext.c \ - url.c + url.c ascii.c mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \ $(INTLLIBS) $(LIBICONV) @@ -75,7 +75,7 @@ non_us_sources = pgp.c pgpinvoke.c pgpkey.c pgplib.c sha1.c \ EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \ pop.c pop_auth.c pop_lib.c pgp.c pgpinvoke.c pgpkey.c pgplib.c \ sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c browser.h mbyte.h \ - remailer.h url.h mutt_ssl_nss.c pgppacket.c + remailer.h url.h mutt_ssl_nss.c pgppacket.c ascii.c EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \ attach.h buffy.h charset.h copy.h dotlock.h functions.h gen_defs \ @@ -87,13 +87,13 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \ _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \ mbyte.h lib.h extlib.c pgpewrap pgplib.h Muttrc.head Muttrc \ makedoc.c stamp-doc-rc README.SSL README.UPGRADE checktypes.c \ - muttbug pgppacket.h depcomp + muttbug pgppacket.h depcomp ascii.h mutt_dotlock_SOURCES = mutt_dotlock.c mutt_dotlock_LDADD = @LIBOBJS@ mutt_dotlock_DEPENDENCIES = @LIBOBJS@ -pgpring_SOURCES = pgppubring.c pgplib.c lib.c extlib.c sha1.c pgppacket.c +pgpring_SOURCES = pgppubring.c pgplib.c lib.c extlib.c sha1.c pgppacket.c ascii.c pgpring_LDADD = @LIBOBJS@ $(INTLLIBS) pgpring_DEPENDENCIES = @LIBOBJS@ $(INTLDEPS) @@ -29,7 +29,7 @@ int mutt_account_match (const ACCOUNT* a1, const ACCOUNT* a2) if (a1->type != a2->type) return 0; - if (mutt_strcasecmp (a1->host, a2->host)) + if (ascii_strcasecmp (a1->host, a2->host)) return 0; if (a1->port != a2->port) return 0; @@ -102,7 +102,7 @@ static int alias_SortAddress (const void *a, const void *b) else if (pb->personal) r = -1; else - r = mutt_strcasecmp (pa->mailbox, pb->mailbox); + r = ascii_strcasecmp (pa->mailbox, pb->mailbox); return (RSORT (r)); } @@ -328,7 +328,7 @@ ADDRESS *alias_reverse_lookup (ADDRESS *a) for (ap = t->addr; ap; ap = ap->next) { if (!ap->group && ap->mailbox && - mutt_strcasecmp (ap->mailbox, a->mailbox) == 0) + ascii_strcasecmp (ap->mailbox, a->mailbox) == 0) return ap; } } @@ -422,7 +422,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 (mutt_strcasecmp(str, buf) == 0) + if (ascii_strcasecmp(str, buf) == 0) return 1; return 0; @@ -437,7 +437,7 @@ int mutt_addr_is_user (ADDRESS *addr) if (!addr->mailbox) return 0; - if (mutt_strcasecmp (addr->mailbox, Username) == 0) + if (ascii_strcasecmp (addr->mailbox, Username) == 0) return 1; if (string_is_address(addr->mailbox, Username, Hostname)) return 1; @@ -446,7 +446,7 @@ int mutt_addr_is_user (ADDRESS *addr) if (string_is_address(addr->mailbox, Username, mutt_fqdn(1))) return 1; - if (From && !mutt_strcasecmp (From->mailbox, addr->mailbox)) + if (From && !ascii_strcasecmp (From->mailbox, addr->mailbox)) return 1; if (Alternates.pattern && diff --git a/ascii.c b/ascii.c new file mode 100644 index 00000000..d4553f68 --- /dev/null +++ b/ascii.c @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org> + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111, USA. + * + */ + + +/* + * Versions of the string comparison functions which are + * locale-insensitive. + */ + +#include <stdio.h> +#include <stdlib.h> +#include "ascii.h" + +int ascii_isupper (int c) +{ + return (c >= 'A') && (c <= 'Z'); +} + +int ascii_islower (int c) +{ + return (c >= 'a') && (c <= 'z'); +} + +int ascii_toupper (int c) +{ + if (ascii_islower (c)) + return c & ~32; + + return c; +} + +int ascii_tolower (int c) +{ + if (ascii_isupper (c)) + return c | 32; + + return c; +} + +int ascii_strcasecmp (const char *a, const char *b) +{ + int i; + + if (a == b) + return 0; + if (a == NULL && b) + return -1; + if (b == NULL && a) + return 1; + + for (; *a || *b; a++, b++) + { + if ((i = ascii_tolower (*a) - ascii_tolower (*b))) + return i; + } + + return 0; +} + +int ascii_strncasecmp (const char *a, const char *b, int n) +{ + int i, j; + + if (a == b) + return 0; + if (a == NULL && b) + return -1; + if (b == NULL && a) + return 1; + + for (j = 0; (*a || *b) && j < n; a++, b++, j++) + { + if ((i = ascii_tolower (*a) - ascii_tolower (*b))) + return i; + } + + return 0; +} diff --git a/ascii.h b/ascii.h new file mode 100644 index 00000000..2041c6b3 --- /dev/null +++ b/ascii.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org> + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111, USA. + * + */ + + +/* + * Versions of the string comparison functions which are + * locale-insensitive. + */ + +#ifndef _ASCII_H +# define _ASCII_H + +int ascii_isupper (int c); +int ascii_islower (int c); +int ascii_toupper (int c); +int ascii_tolower (int c); +int ascii_strcasecmp (const char *a, const char *b); +int ascii_strncasecmp (const char *a, const char *b, int n); + +#define ascii_strcmp(a,b) mutt_strcmp(a,b) +#define ascii_strncmp(a,b) mutt_strncmp(a,b) + +#endif @@ -302,12 +302,12 @@ static int is_mmnoask (const char *buf) { if (*(q+1) == '*') { - if (mutt_strncasecmp (buf, p, q-p) == 0) + if (ascii_strncasecmp (buf, p, q-p) == 0) return (1); } else { - if (mutt_strcasecmp (buf, p) == 0) + if (ascii_strcasecmp (buf, p) == 0) return (1); } } @@ -350,8 +350,8 @@ int mutt_is_autoview (BODY *b, const char *type) { i = mutt_strlen (t->data) - 1; if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' && - mutt_strncasecmp (type, t->data, i) == 0) || - mutt_strcasecmp (type, t->data) == 0) + ascii_strncasecmp (type, t->data, i) == 0) || + ascii_strcasecmp (type, t->data) == 0) return 1; } @@ -940,8 +940,8 @@ int mutt_print_attachment (FILE *fp, BODY *a) return (1); } - if (!mutt_strcasecmp ("text/plain", a->subtype) || - !mutt_strcasecmp ("application/postscript", a->subtype)) + if (!ascii_strcasecmp ("text/plain", a->subtype) || + !ascii_strcasecmp ("application/postscript", a->subtype)) { return (mutt_pipe_attachment (fp, a, NONULL(PrintCmd), NULL)); } @@ -173,12 +173,6 @@ PreferredMIMENames[] = { "iso_8859-15", "iso-8859-15" }, { "latin9", "iso-8859-15" }, /* this is not a bug */ - { "ýso-8859-9", "iso-8859-9" }, /* work around a problem: - * In iso-8859-9, the lower- - * case version of I is ý, - * not i. - */ - /* * If you happen to encounter system-specific brain-damage with @@ -247,19 +241,20 @@ void mutt_canonical_charset (char *dest, size_t dlen, const char *name) char scratch[LONG_STRING]; /* catch some common iso-8859-something misspellings */ - if (!mutt_strncasecmp (name, "8859", 4) && name[4] != '-') + if (!ascii_strncasecmp (name, "8859", 4) && name[4] != '-') snprintf (scratch, sizeof (scratch), "iso-8859-%s", name +4); - else if (!mutt_strncasecmp (name, "8859-", 5)) + else if (!ascii_strncasecmp (name, "8859-", 5)) snprintf (scratch, sizeof (scratch), "iso-8859-%s", name + 5); - else if (!mutt_strncasecmp (name, "iso8859", 7) && name[7] != '-') + else if (!ascii_strncasecmp (name, "iso8859", 7) && name[7] != '-') snprintf (scratch, sizeof (scratch), "iso_8859-%s", name + 7); - else if (!mutt_strncasecmp (name, "iso8859-", 8)) + else if (!ascii_strncasecmp (name, "iso8859-", 8)) snprintf (scratch, sizeof (scratch), "iso_8859-%s", name + 8); else strfcpy (scratch, NONULL(name), sizeof (scratch)); for (i = 0; PreferredMIMENames[i].key; i++) - if (!mutt_strcasecmp (scratch, PreferredMIMENames[i].key)) + if (!ascii_strcasecmp (scratch, PreferredMIMENames[i].key) || + !mutt_strcasecmp (scratch, PreferredMIMENames[i].key)) { strfcpy (dest, PreferredMIMENames[i].pref, dlen); return; @@ -269,8 +264,7 @@ void mutt_canonical_charset (char *dest, size_t dlen, const char *name) /* for cosmetics' sake, transform to lowercase. */ for (p = dest; *p; p++) - if (isupper (*p)) - *p = tolower (*p); + *p = ascii_tolower (*p); } int mutt_chscmp (const char *s, const char *chs) @@ -280,7 +274,7 @@ int mutt_chscmp (const char *s, const char *chs) if (!s) return 0; mutt_canonical_charset (buffer, sizeof (buffer), s); - return !mutt_strcasecmp (buffer, chs); + return !ascii_strcasecmp (buffer, chs); } @@ -633,17 +633,17 @@ parse_attr_spec(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *err mutt_extract_token (buf, s, 0); - if (mutt_strcasecmp ("bold", buf->data) == 0) + if (ascii_strcasecmp ("bold", buf->data) == 0) *attr |= A_BOLD; - else if (mutt_strcasecmp ("underline", buf->data) == 0) + else if (ascii_strcasecmp ("underline", buf->data) == 0) *attr |= A_UNDERLINE; - else if (mutt_strcasecmp ("none", buf->data) == 0) + else if (ascii_strcasecmp ("none", buf->data) == 0) *attr = A_NORMAL; - else if (mutt_strcasecmp ("reverse", buf->data) == 0) + else if (ascii_strcasecmp ("reverse", buf->data) == 0) *attr |= A_REVERSE; - else if (mutt_strcasecmp ("standout", buf->data) == 0) + else if (ascii_strcasecmp ("standout", buf->data) == 0) *attr |= A_STANDOUT; - else if (mutt_strcasecmp ("normal", buf->data) == 0) + else if (ascii_strcasecmp ("normal", buf->data) == 0) *attr = A_NORMAL; /* needs use = instead of |= to clear other bits */ else { @@ -813,8 +813,8 @@ void mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp) snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype)); - type_changed = mutt_strcasecmp (tmp, obuf); - charset_changed = mutt_strcasecmp (charset, mutt_get_parameter ("charset", b->parameter)); + type_changed = ascii_strcasecmp (tmp, obuf); + charset_changed = ascii_strcasecmp (charset, mutt_get_parameter ("charset", b->parameter)); /* if in send mode, check for conversion - current setting is default. */ @@ -84,12 +84,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)) && - (mutt_strncasecmp ("Status:", buf, 7) == 0 || - mutt_strncasecmp ("X-Status:", buf, 9) == 0)) + (ascii_strncasecmp ("Status:", buf, 7) == 0 || + ascii_strncasecmp ("X-Status:", buf, 9) == 0)) continue; if ((flags & (CH_UPDATE_LEN | CH_XMIT | CH_NOLEN)) && - (mutt_strncasecmp ("Content-Length:", buf, 15) == 0 || - mutt_strncasecmp ("Lines:", buf, 6) == 0)) + (ascii_strncasecmp ("Content-Length:", buf, 15) == 0 || + ascii_strncasecmp ("Lines:", buf, 6) == 0)) continue; ignore = 0; } @@ -151,21 +151,21 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags, !mutt_matches_ignore (buf, UnIgnore)) continue; if ((flags & CH_WEED_DELIVERED) && - mutt_strncasecmp ("Delivered-To:", buf, 13) == 0) + ascii_strncasecmp ("Delivered-To:", buf, 13) == 0) continue; if ((flags & (CH_UPDATE | CH_XMIT | CH_NOSTATUS)) && - (mutt_strncasecmp ("Status:", buf, 7) == 0 || - mutt_strncasecmp ("X-Status:", buf, 9) == 0)) + (ascii_strncasecmp ("Status:", buf, 7) == 0 || + ascii_strncasecmp ("X-Status:", buf, 9) == 0)) continue; if ((flags & (CH_UPDATE_LEN | CH_XMIT | CH_NOLEN)) && - (mutt_strncasecmp ("Content-Length:", buf, 15) == 0 || - mutt_strncasecmp ("Lines:", buf, 6) == 0)) + (ascii_strncasecmp ("Content-Length:", buf, 15) == 0 || + ascii_strncasecmp ("Lines:", buf, 6) == 0)) continue; if ((flags & CH_MIME) && - ((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)) + ((ascii_strncasecmp ("content-", buf, 8) == 0 && + (ascii_strncasecmp ("transfer-encoding:", buf + 8, 18) == 0 || + ascii_strncasecmp ("type:", buf + 8, 5) == 0)) || + ascii_strncasecmp ("mime-version:", buf, 13) == 0)) continue; /* Find x -- the array entry where this header is to be saved */ @@ -173,7 +173,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 (!mutt_strncasecmp (buf, t->data, mutt_strlen (t->data))) + if (!ascii_strncasecmp (buf, t->data, mutt_strlen (t->data))) { dprint(2, (debugfile, "Reorder: %s matches %s\n", t->data, buf)); break; @@ -360,8 +360,8 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur) cur->msgno + 1); } buf = be_include_messages (p, buf, &bufmax, &buflen, - (tolower (tmp[1]) == 'm'), - (isupper ((unsigned char) tmp[1]))); + (ascii_tolower (tmp[1]) == 'm'), + (ascii_isupper ((unsigned char) tmp[1]))); } else addstr (_("No mailbox.\n")); @@ -687,7 +687,7 @@ static void enriched_set_flags (const char *tag, struct enriched_state *stte) tagptr++; for (i = 0, j = -1; EnrichedTags[i].tag_name; i++) - if (mutt_strcasecmp (EnrichedTags[i].tag_name,tagptr) == 0) + if (ascii_strcasecmp (EnrichedTags[i].tag_name,tagptr) == 0) { j = EnrichedTags[i].index; break; @@ -705,35 +705,35 @@ static void enriched_set_flags (const char *tag, struct enriched_state *stte) if ((stte->s->flags & M_DISPLAY) && j == RICH_PARAM && stte->tag_level[RICH_COLOR]) { stte->param[stte->param_used] = '\0'; - if (!mutt_strcasecmp(stte->param, "black")) + if (!ascii_strcasecmp(stte->param, "black")) { enriched_puts("\033[30m", stte); } - else if (!mutt_strcasecmp(stte->param, "red")) + else if (!ascii_strcasecmp(stte->param, "red")) { enriched_puts("\033[31m", stte); } - else if (!mutt_strcasecmp(stte->param, "green")) + else if (!ascii_strcasecmp(stte->param, "green")) { enriched_puts("\033[32m", stte); } - else if (!mutt_strcasecmp(stte->param, "yellow")) + else if (!ascii_strcasecmp(stte->param, "yellow")) { enriched_puts("\033[33m", stte); } - else if (!mutt_strcasecmp(stte->param, "blue")) + else if (!ascii_strcasecmp(stte->param, "blue")) { enriched_puts("\033[34m", stte); } - else if (!mutt_strcasecmp(stte->param, "magenta")) + else if (!ascii_strcasecmp(stte->param, "magenta")) { enriched_puts("\033[35m", stte); } - else if (!mutt_strcasecmp(stte->param, "cyan")) + else if (!ascii_strcasecmp(stte->param, "cyan")) { enriched_puts("\033[36m", stte); } - else if (!mutt_strcasecmp(stte->param, "white")) + else if (!ascii_strcasecmp(stte->param, "white")) { enriched_puts("\033[37m", stte); } @@ -921,10 +921,10 @@ static void alternative_handler (BODY *a, STATE *s) while (b) { const char *bt = TYPE(b); - if (!mutt_strncasecmp (bt, t->data, btlen) && bt[btlen] == 0) + if (!ascii_strncasecmp (bt, t->data, btlen) && bt[btlen] == 0) { /* the basetype matches */ - if (wild || !mutt_strcasecmp (t->data + btlen + 1, b->subtype)) + if (wild || !ascii_strcasecmp (t->data + btlen + 1, b->subtype)) { choice = b; } @@ -969,17 +969,17 @@ static void alternative_handler (BODY *a, STATE *s) { if (b->type == TYPETEXT) { - if (! mutt_strcasecmp ("plain", b->subtype) && type <= TXTPLAIN) + if (! ascii_strcasecmp ("plain", b->subtype) && type <= TXTPLAIN) { choice = b; type = TXTPLAIN; } - else if (! mutt_strcasecmp ("enriched", b->subtype) && type <= TXTENRICHED) + else if (! ascii_strcasecmp ("enriched", b->subtype) && type <= TXTENRICHED) { choice = b; type = TXTENRICHED; } - else if (! mutt_strcasecmp ("html", b->subtype) && type <= TXTHTML) + else if (! ascii_strcasecmp ("html", b->subtype) && type <= TXTHTML) { choice = b; type = TXTHTML; @@ -1075,8 +1075,8 @@ int mutt_can_decode (BODY *a) #ifdef HAVE_PGP - if (mutt_strcasecmp (a->subtype, "signed") == 0 || - mutt_strcasecmp (a->subtype, "encrypted") == 0) + if (ascii_strcasecmp (a->subtype, "signed") == 0 || + ascii_strcasecmp (a->subtype, "encrypted") == 0) return (1); else #endif @@ -1124,7 +1124,7 @@ void multipart_handler (BODY *a, STATE *s) b->length = (long) st.st_size; b->parts = mutt_parse_multipart (s->fpin, mutt_get_parameter ("boundary", a->parameter), - (long) st.st_size, mutt_strcasecmp ("digest", a->subtype) == 0); + (long) st.st_size, ascii_strcasecmp ("digest", a->subtype) == 0); } else b = a; @@ -1301,7 +1301,7 @@ static void external_body_handler (BODY *b, STATE *s) else expire = -1; - if (!mutt_strcasecmp (access_type, "x-mutt-deleted")) + if (!ascii_strcasecmp (access_type, "x-mutt-deleted")) { if (s->flags & M_DISPLAY) { @@ -1414,25 +1414,25 @@ void mutt_body_handler (BODY *b, STATE *s) } else if (b->type == TYPETEXT) { - if (mutt_strcasecmp ("plain", b->subtype) == 0) + if (ascii_strcasecmp ("plain", b->subtype) == 0) { /* avoid copying this part twice since removing the transfer-encoding is * the only operation needed. */ plaintext = 1; } - else if (mutt_strcasecmp ("enriched", b->subtype) == 0) + else if (ascii_strcasecmp ("enriched", b->subtype) == 0) handler = text_enriched_handler; - else if (mutt_strcasecmp ("rfc822-headers", b->subtype) == 0) + else if (ascii_strcasecmp ("rfc822-headers", b->subtype) == 0) plaintext = 1; } else if (b->type == TYPEMESSAGE) { if(mutt_is_message_type(b->type, b->subtype)) handler = message_handler; - else if (!mutt_strcasecmp ("delivery-status", b->subtype)) + else if (!ascii_strcasecmp ("delivery-status", b->subtype)) plaintext = 1; - else if (!mutt_strcasecmp ("external-body", b->subtype)) + else if (!ascii_strcasecmp ("external-body", b->subtype)) handler = external_body_handler; } else if (b->type == TYPEMULTIPART) @@ -1446,32 +1446,32 @@ void mutt_body_handler (BODY *b, STATE *s) - if (mutt_strcasecmp ("alternative", b->subtype) == 0) + if (ascii_strcasecmp ("alternative", b->subtype) == 0) handler = alternative_handler; #ifdef HAVE_PGP - else if (mutt_strcasecmp ("signed", b->subtype) == 0) + else if (ascii_strcasecmp ("signed", b->subtype) == 0) { p = mutt_get_parameter ("protocol", b->parameter); if (!p) mutt_error _("Error: multipart/signed has no protocol."); - else if (mutt_strcasecmp ("application/pgp-signature", p) == 0 || - mutt_strcasecmp ("multipart/mixed", p) == 0) + else if (ascii_strcasecmp ("application/pgp-signature", p) == 0 || + ascii_strcasecmp ("multipart/mixed", p) == 0) { if (s->flags & M_VERIFY) handler = pgp_signed_handler; } } - else if (mutt_strcasecmp ("encrypted", b->subtype) == 0) + else if (ascii_strcasecmp ("encrypted", b->subtype) == 0) { p = mutt_get_parameter ("protocol", b->parameter); if (!p) mutt_error _("Error: multipart/encrypted has no protocol parameter!"); - else if (mutt_strcasecmp ("application/pgp-encrypted", p) == 0) + else if (ascii_strcasecmp ("application/pgp-encrypted", p) == 0) handler = pgp_encrypted_handler; } #endif /* HAVE_PGP */ @@ -128,9 +128,9 @@ void mutt_edit_headers (const char *editor, * not, remove the references: field later so that we can generate a new * message based upon this one. */ - if (mutt_strncasecmp ("in-reply-to:", cur->data, 12) == 0) + if (ascii_strncasecmp ("in-reply-to:", cur->data, 12) == 0) in_reply_to = 1; - else if (fcc && mutt_strncasecmp ("fcc:", cur->data, 4) == 0) + else if (fcc && ascii_strncasecmp ("fcc:", cur->data, 4) == 0) { p = cur->data + 4; SKIPWS (p); @@ -141,7 +141,7 @@ void mutt_edit_headers (const char *editor, } keep = 0; } - else if (mutt_strncasecmp ("attach:", cur->data, 7) == 0) + else if (ascii_strncasecmp ("attach:", cur->data, 7) == 0) { BODY *body; BODY *parts; @@ -177,7 +177,7 @@ void mutt_edit_headers (const char *editor, #ifdef HAVE_PGP - else if (mutt_strncasecmp ("pgp:", cur->data, 4) == 0) + else if (ascii_strncasecmp ("pgp:", cur->data, 4) == 0) { msg->pgp = mutt_parse_pgp_hdr (cur->data + 4, 0); keep = 0; diff --git a/imap/browse.c b/imap/browse.c index 1326bd92..2ed91a06 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -414,7 +414,7 @@ static int browse_get_namespace (IMAP_DATA* idata, char* nsbuf, int nsblen, break; s = imap_next_word (idata->cmd.buf); - if (mutt_strncasecmp ("NAMESPACE", s, 9) == 0) + if (ascii_strncasecmp ("NAMESPACE", s, 9) == 0) { /* There are three sections to the response, User, Other, Shared, * and maybe more by extension */ diff --git a/imap/command.c b/imap/command.c index 73a54ff4..32a6405a 100644 --- a/imap/command.c +++ b/imap/command.c @@ -161,7 +161,7 @@ int imap_code (const char *s) { s += SEQLEN; SKIPWS (s); - return (mutt_strncasecmp ("OK", s, 2) == 0); + return (ascii_strncasecmp ("OK", s, 2) == 0); } /* imap_exec: execute a command, and wait for the response from the server. @@ -300,7 +300,7 @@ static int cmd_handle_untagged (IMAP_DATA* idata) /* EXISTS and EXPUNGE are always related to the SELECTED mailbox for the * connection, so update that one. */ - if (mutt_strncasecmp ("EXISTS", s, 6) == 0) + if (ascii_strncasecmp ("EXISTS", s, 6) == 0) { dprint (2, (debugfile, "Handling EXISTS\n")); @@ -334,15 +334,15 @@ static int cmd_handle_untag |