From c73ebd9aa108d55a09c7eebbf9a81e3453fa0c3b Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 26 Apr 2001 13:36:33 +0000 Subject: [PATCH] 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'. --- Makefile.am | 8 +-- account.c | 2 +- addrbook.c | 2 +- alias.c | 8 +-- ascii.c | 97 +++++++++++++++++++++++++++++++++++ ascii.h | 42 +++++++++++++++ attach.c | 12 ++--- charset.c | 22 +++----- color.c | 12 ++--- commands.c | 4 +- copy.c | 28 +++++----- edit.c | 4 +- handler.c | 58 ++++++++++----------- headers.c | 8 +-- imap/browse.c | 2 +- imap/command.c | 14 ++--- imap/imap.c | 22 ++++---- imap/message.c | 38 +++++++------- imap/util.c | 2 +- init.c | 24 ++++----- keymap.c | 8 +-- mutt.h | 1 + mutt_ssl_nss.c | 6 +-- muttlib.c | 18 +++---- mx.c | 10 ++-- parse.c | 136 ++++++++++++++++++++++++------------------------- pattern.c | 22 ++++---- pgp.c | 36 ++++++------- pgpkey.c | 2 +- postpone.c | 8 +-- recvattach.c | 14 ++--- remailer.c | 4 +- rfc1524.c | 22 ++++---- rfc2047.c | 2 +- send.c | 24 ++++----- sendlib.c | 8 +-- url.c | 8 +-- 37 files changed, 438 insertions(+), 300 deletions(-) create mode 100644 ascii.c create mode 100644 ascii.h 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) diff --git a/account.c b/account.c index fc29e86f..5a7fe790 100644 --- a/account.c +++ b/account.c @@ -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; diff --git a/addrbook.c b/addrbook.c index d629b85c..99c973cd 100644 --- a/addrbook.c +++ b/addrbook.c @@ -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)); } diff --git a/alias.c b/alias.c index d2d6033b..e6124f9e 100644 --- a/alias.c +++ b/alias.c @@ -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 + * + * 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 +#include +#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 + * + * 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 diff --git a/attach.c b/attach.c index 19503d24..00ac8c02 100644 --- a/attach.c +++ b/attach.c @@ -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)); } diff --git a/charset.c b/charset.c index 92cdab40..2be74af3 100644 --- a/charset.c +++ b/charset.c @@ -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); } diff --git a/color.c b/color.c index 573b6dc0..38aebb76 100644 --- a/color.c +++ b/color.c @@ -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 { diff --git a/commands.c b/commands.c index 49bd4628..3c0679f9 100644 --- a/commands.c +++ b/commands.c @@ -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. */ diff --git a/copy.c b/copy.c index 57290410..87c7a609 100644 --- a/copy.c +++ b/copy.c @@ -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; diff --git a/edit.c b/edit.c index ff31bff1..07262fde 100644 --- a/edit.c +++ b/edit.c @@ -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")); diff --git a/handler.c b/handler.c index cc390d5e..ffd9d9fa 100644 --- a/handler.c +++ b/handler.c @@ -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 */ diff --git a/headers.c b/headers.c index f9dbef53..adcdb4b9 100644 --- a/headers.c +++ b/headers.c @@ -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_untagged (IMAP_DATA* idata) idata->newMailCount = count; } } - else if (mutt_strncasecmp ("EXPUNGE", s, 7) == 0) + else if (ascii_strncasecmp ("EXPUNGE", s, 7) == 0) /* pn vs. s: need initial seqno */ cmd_parse_expunge (idata, pn); } - else if (mutt_strncasecmp ("CAPABILITY", s, 10) == 0) + else if (ascii_strncasecmp ("CAPABILITY", s, 10) == 0) cmd_parse_capabilities (idata, s); - else if (mutt_strncasecmp ("MYRIGHTS", s, 8) == 0) + else if (ascii_strncasecmp ("MYRIGHTS", s, 8) == 0) cmd_parse_myrights (idata, s); - else if (mutt_strncasecmp ("BYE", s, 3) == 0) + else if (ascii_strncasecmp ("BYE", s, 3) == 0) { dprint (2, (debugfile, "Handling BYE\n")); @@ -362,7 +362,7 @@ static int cmd_handle_untagged (IMAP_DATA* idata) return -1; } - else if (option (OPTIMAPSERVERNOISE) && (mutt_strncasecmp ("NO", s, 2) == 0)) + else if (option (OPTIMAPSERVERNOISE) && (ascii_strncasecmp ("NO", s, 2) == 0)) { dprint (2, (debugfile, "Handling untagged NO\n")); diff --git a/imap/imap.c b/imap/imap.c index eb7cc01c..b073d51c 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -240,7 +240,7 @@ static int imap_get_delim (IMAP_DATA *idata) break; s = imap_next_word (idata->cmd.buf); - if (mutt_strncasecmp ("LIST", s, 4) == 0) + if (ascii_strncasecmp ("LIST", s, 4) == 0) { s = imap_next_word (s); s = imap_next_word (s); @@ -442,7 +442,7 @@ static char* imap_get_flags (LIST** hflags, char* s) char ctmp; /* sanity-check string */ - if (mutt_strncasecmp ("FLAGS", s, 5) != 0) + if (ascii_strncasecmp ("FLAGS", s, 5) != 0) { dprint (1, (debugfile, "imap_get_flags: not a FLAGS response: %s\n", s)); @@ -550,7 +550,7 @@ int imap_open_mailbox (CONTEXT* ctx) pc = idata->cmd.buf + 2; pc = imap_next_word (pc); - if (!mutt_strncasecmp ("EXISTS", pc, 6)) + if (!ascii_strncasecmp ("EXISTS", pc, 6)) { /* imap_handle_untagged will have picked up the EXISTS message and * set the NEW_MAIL flag. We clear it here. */ @@ -563,7 +563,7 @@ int imap_open_mailbox (CONTEXT* ctx) /* Obtain list of available flags here, may be overridden by a * PERMANENTFLAGS tag in the OK response */ - if (mutt_strncasecmp ("FLAGS", pc, 5) == 0) + if (ascii_strncasecmp ("FLAGS", pc, 5) == 0) { /* don't override PERMANENTFLAGS */ if (!idata->flags) @@ -574,7 +574,7 @@ int imap_open_mailbox (CONTEXT* ctx) } } /* PERMANENTFLAGS are massaged to look like FLAGS, then override FLAGS */ - else if (mutt_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) + else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) { dprint (2, (debugfile, "Getting mailbox PERMANENTFLAGS\n")); /* safe to call on NULL */ @@ -1143,7 +1143,7 @@ int imap_mailbox_check (char* path, int new) break; s = imap_next_word (idata->cmd.buf); - if (mutt_strncasecmp ("STATUS", s, 6) == 0) + if (ascii_strncasecmp ("STATUS", s, 6) == 0) { s = imap_next_word (s); /* The mailbox name may or may not be quoted here. We could try to @@ -1193,8 +1193,8 @@ int imap_parse_list_response(IMAP_DATA* idata, char **name, int *noselect, return -1; s = imap_next_word (idata->cmd.buf); - if ((mutt_strncasecmp ("LIST", s, 4) == 0) || - (mutt_strncasecmp ("LSUB", s, 4) == 0)) + if ((ascii_strncasecmp ("LIST", s, 4) == 0) || + (ascii_strncasecmp ("LSUB", s, 4) == 0)) { *noselect = 0; *noinferiors = 0; @@ -1209,12 +1209,12 @@ int imap_parse_list_response(IMAP_DATA* idata, char **name, int *noselect, while (*ep && *ep != ')') ep++; do { - if (!strncasecmp (s, "\\NoSelect", 9)) + if (!ascii_strncasecmp (s, "\\NoSelect", 9)) *noselect = 1; - if (!strncasecmp (s, "\\NoInferiors", 12)) + if (!ascii_strncasecmp (s, "\\NoInferiors", 12)) *noinferiors = 1; /* See draft-gahrns-imap-child-mailbox-?? */ - if (!strncasecmp (s, "\\HasNoChildren", 14)) + if (!ascii_strncasecmp (s, "\\HasNoChildren", 14)) *noinferiors = 1; if (*s != ')') s++; diff --git a/imap/message.c b/imap/message.c index d1955717..a76aa213 100644 --- a/imap/message.c +++ b/imap/message.c @@ -263,22 +263,22 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) pc = imap_next_word (pc); pc = imap_next_word (pc); - if (!mutt_strncasecmp ("FETCH", pc, 5)) + if (!ascii_strncasecmp ("FETCH", pc, 5)) { while (*pc) { pc = imap_next_word (pc); if (pc[0] == '(') pc++; - if (strncasecmp ("UID", pc, 3) == 0) + if (ascii_strncasecmp ("UID", pc, 3) == 0) { pc = imap_next_word (pc); uid = atoi (pc); if (uid != HEADER_DATA(ctx->hdrs[msgno])->uid) mutt_error (_("The message index is incorrect. Try reopening the mailbox.")); } - else if ((strncasecmp ("RFC822", pc, 6) == 0) || - (strncasecmp ("BODY[]", pc, 6) == 0)) + else if ((ascii_strncasecmp ("RFC822", pc, 6) == 0) || + (ascii_strncasecmp ("BODY[]", pc, 6) == 0)) { pc = imap_next_word (pc); if (imap_get_literal_count(pc, &bytes) < 0) @@ -299,7 +299,7 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) * change (eg from \Unseen to \Seen). * Uncommitted changes in mutt take precedence. If we decide to * incrementally update flags later, this won't stop us syncing */ - else if ((strncasecmp ("FLAGS", pc, 5) == 0) && + else if ((ascii_strncasecmp ("FLAGS", pc, 5) == 0) && !ctx->hdrs[msgno]->changed) { IMAP_HEADER newh; @@ -693,7 +693,7 @@ static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf, FILE* fp) /* find FETCH tag */ buf = imap_next_word (buf); - if (mutt_strncasecmp ("FETCH", buf, 5)) + if (ascii_strncasecmp ("FETCH", buf, 5)) return rc; rc = -2; /* we've got a FETCH response, for better or worse */ @@ -739,7 +739,7 @@ static int msg_has_flag (LIST* flag_list, const char* flag) flag_list = flag_list->next; while (flag_list) { - if (!mutt_strncasecmp (flag_list->data, flag, strlen (flag_list->data))) + if (!ascii_strncasecmp (flag_list->data, flag, strlen (flag_list->data))) return 1; flag_list = flag_list->next; @@ -761,12 +761,12 @@ static int msg_parse_fetch (IMAP_HEADER *h, char *s) { SKIPWS (s); - if (mutt_strncasecmp ("FLAGS", s, 5) == 0) + if (ascii_strncasecmp ("FLAGS", s, 5) == 0) { if ((s = msg_parse_flags (h, s)) == NULL) return -1; } - else if (mutt_strncasecmp ("UID", s, 3) == 0) + else if (ascii_strncasecmp ("UID", s, 3) == 0) { s += 3; SKIPWS (s); @@ -774,7 +774,7 @@ static int msg_parse_fetch (IMAP_HEADER *h, char *s) s = imap_next_word (s); } - else if (mutt_strncasecmp ("INTERNALDATE", s, 12) == 0) + else if (ascii_strncasecmp ("INTERNALDATE", s, 12) == 0) { s += 12; SKIPWS (s); @@ -793,7 +793,7 @@ static int msg_parse_fetch (IMAP_HEADER *h, char *s) *ptmp = 0; h->received = imap_parse_date (tmp); } - else if (mutt_strncasecmp ("RFC822.SIZE", s, 11) == 0) + else if (ascii_strncasecmp ("RFC822.SIZE", s, 11) == 0) { s += 11; SKIPWS (s); @@ -803,8 +803,8 @@ static int msg_parse_fetch (IMAP_HEADER *h, char *s) *ptmp = 0; h->content_length = atoi (tmp); } - else if (!mutt_strncasecmp ("BODY", s, 4) || - !mutt_strncasecmp ("RFC822.HEADER", s, 13)) + else if (!ascii_strncasecmp ("BODY", s, 4) || + !ascii_strncasecmp ("RFC822.HEADER", s, 13)) { /* handle above, in msg_fetch_header */ return -2; @@ -829,7 +829,7 @@ static char* msg_parse_flags (IMAP_HEADER* h, char* s) int recent = 0; /* sanity-check string */ - if (mutt_strncasecmp ("FLAGS", s, 5) != 0) + if (ascii_strncasecmp ("FLAGS", s, 5) != 0) { dprint (1, (debugfile, "msg_parse_flags: not a FLAGS response: %s\n", s)); @@ -848,27 +848,27 @@ static char* msg_parse_flags (IMAP_HEADER* h, char* s) /* start parsing */ while (*s && *s != ')') { - if (mutt_strncasecmp ("\\deleted", s, 8) == 0) + if (ascii_strncasecmp ("\\deleted", s, 8) == 0) { s += 8; h->deleted = 1; } - else if (mutt_strncasecmp ("\\flagged", s, 8) == 0) + else if (ascii_strncasecmp ("\\flagged", s, 8) == 0) { s += 8; h->flagged = 1; } - else if (mutt_strncasecmp ("\\answered", s, 9) == 0) + else if (ascii_strncasecmp ("\\answered", s, 9) == 0) { s += 9; h->replied = 1; } - else if (mutt_strncasecmp ("\\seen", s, 5) == 0) + else if (ascii_strncasecmp ("\\seen", s, 5) == 0) { s += 5; h->read = 1; } - else if (mutt_strncasecmp ("\\recent", s, 5) == 0) + else if (ascii_strncasecmp ("\\recent", s, 5) == 0) { s += 7; recent = 1; diff --git a/imap/util.c b/imap/util.c index e43dfee2..184dee89 100644 --- a/imap/util.c +++ b/imap/util.c @@ -481,7 +481,7 @@ int imap_wordcasecmp(const char *a, const char *b) } tmp[i+1] = 0; - return mutt_strcasecmp(a, tmp); + return ascii_strcasecmp(a, tmp); } /* diff --git a/init.c b/init.c index e2c7921e..80db87fa 100644 --- a/init.c +++ b/init.c @@ -311,7 +311,7 @@ static void add_to_list (LIST **list, const char *str) /* check to make sure the item is not already on this list */ for (last = *list; last; last = last->next) { - if (mutt_strcasecmp (str, last->data) == 0) + if (ascii_strcasecmp (str, last->data) == 0) { /* already on the list, so just ignore it */ last = NULL; @@ -347,7 +347,7 @@ static void remove_from_list (LIST **l, const char *str) last = NULL; while (p) { - if (mutt_strcasecmp (str, p->data) == 0) + if (ascii_strcasecmp (str, p->data) == 0) { safe_free ((void **) &p->data); if (last) @@ -545,7 +545,7 @@ parse_unmy_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) while (tmp) { - if (mutt_strncasecmp (buf->data, tmp->data, l) == 0 && tmp->data[l] == ':') + if (ascii_strncasecmp (buf->data, tmp->data, l) == 0 && tmp->data[l] == ':') { ptr = tmp; if (last) @@ -587,7 +587,7 @@ static int parse_my_hdr (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err for (tmp = UserHeader; ; tmp = tmp->next) { /* see if there is already a field by this name */ - if (mutt_strncasecmp (buf->data, tmp->data, keylen) == 0) + if (ascii_strncasecmp (buf->data, tmp->data, keylen) == 0) { /* replace the old value */ safe_free ((void **) &tmp->data); @@ -842,9 +842,9 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) s->dptr++; mutt_extract_token (tmp, s, 0); - if (mutt_strcasecmp ("yes", tmp->data) == 0) + if (ascii_strcasecmp ("yes", tmp->data) == 0) unset = inv = 0; - else if (mutt_strcasecmp ("no", tmp->data) == 0) + else if (ascii_strcasecmp ("no", tmp->data) == 0) unset = 1; else { @@ -1122,13 +1122,13 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) { s->dptr++; mutt_extract_token (tmp, s, 0); - if (mutt_strcasecmp ("yes", tmp->data) == 0) + if (ascii_strcasecmp ("yes", tmp->data) == 0) set_quadoption (MuttVars[idx].data, M_YES); - else if (mutt_strcasecmp ("no", tmp->data) == 0) + else if (ascii_strcasecmp ("no", tmp->data) == 0) set_quadoption (MuttVars[idx].data, M_NO); - else if (mutt_strcasecmp ("ask-yes", tmp->data) == 0) + else if (ascii_strcasecmp ("ask-yes", tmp->data) == 0) set_quadoption (MuttVars[idx].data, M_ASKYES); - else if (mutt_strcasecmp ("ask-no", tmp->data) == 0) + else if (ascii_strcasecmp ("ask-no", tmp->data) == 0) set_quadoption (MuttVars[idx].data, M_ASKNO); else { @@ -1631,7 +1631,7 @@ int mutt_getvaluebyname (const char *name, const struct mapping_t *map) int i; for (i = 0; map[i].name; i++) - if (mutt_strcasecmp (map[i].name, name) == 0) + if (ascii_strcasecmp (map[i].name, name) == 0) return (map[i].value); return (-1); } @@ -1934,7 +1934,7 @@ int mutt_get_hook_type (const char *name) struct command_t *c; for (c = Commands ; c->name ; c++) - if (c->func == mutt_parse_hook && mutt_strcasecmp (c->name, name) == 0) + if (c->func == mutt_parse_hook && ascii_strcasecmp (c->name, name) == 0) return c->data; return 0; } diff --git a/keymap.c b/keymap.c index eb41056d..38226ba9 100644 --- a/keymap.c +++ b/keymap.c @@ -98,7 +98,7 @@ static int parse_fkey(char *s) char *t; int n = 0; - if(s[0] != '<' || tolower(s[1]) != 'f') + if(s[0] != '<' || ascii_tolower(s[1]) != 'f') return -1; for(t = s + 2; *t && isdigit((unsigned char) *t); t++) @@ -232,7 +232,7 @@ static int get_op (struct binding_t *bindings, const char *start, size_t len) for (i = 0; bindings[i].name; i++) { - if (!mutt_strncasecmp (start, bindings[i].name, len) && + if (!ascii_strncasecmp (start, bindings[i].name, len) && mutt_strlen (bindings[i].name) == len) return bindings[i].op; } @@ -279,7 +279,7 @@ static void push_string (char *s) l = p - pp + 1; for (i = 0; KeyNames[i].name; i++) { - if (!mutt_strncasecmp (pp, KeyNames[i].name, l)) + if (!ascii_strncasecmp (pp, KeyNames[i].name, l)) break; } if (KeyNames[i].name) @@ -771,7 +771,7 @@ int mutt_parse_bind (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) strfcpy (err->data, _("bind: too many arguments"), err->dsize); r = -1; } - else if (mutt_strcasecmp ("noop", buf->data) == 0) + else if (ascii_strcasecmp ("noop", buf->data) == 0) km_bindkey (key, menu, OP_NULL); /* the `unbind' command */ else { diff --git a/mutt.h b/mutt.h index e7bb18a8..2ae91b54 100644 --- a/mutt.h +++ b/mutt.h @@ -775,6 +775,7 @@ typedef struct void state_prefix_putc(char, STATE *); int state_printf(STATE *, const char *, ...); +#include "ascii.h" #include "protos.h" #include "lib.h" #include "globals.h" diff --git a/mutt_ssl_nss.c b/mutt_ssl_nss.c index 3140d9e9..12d3cc45 100644 --- a/mutt_ssl_nss.c +++ b/mutt_ssl_nss.c @@ -203,17 +203,17 @@ mutt_nss_bad_cert (void *arg, PRFileDesc * fd) i = SECFailure; break; } - else if (tolower (ch.ch) == 'r') + else if (ascii_tolower (ch.ch) == 'r') { i = SECFailure; break; } - else if (tolower (ch.ch) == 'o') + else if (ascii_tolower (ch.ch) == 'o') { i = SECSuccess; break; } - else if (tolower (ch.ch) == 'a') + else if (ascii_tolower (ch.ch) == 'a') { /* push this certificate onto the user's certificate store so it * automatically becomes valid next time we see it diff --git a/muttlib.c b/muttlib.c index 0d6e6b95..d7459a3c 100644 --- a/muttlib.c +++ b/muttlib.c @@ -272,7 +272,7 @@ int mutt_matches_ignore (const char *s, LIST *t) { for (; t; t = t->next) { - if (!mutt_strncasecmp (s, t->data, mutt_strlen (t->data)) || *t->data == '*') + if (!ascii_strncasecmp (s, t->data, mutt_strlen (t->data)) || *t->data == '*') return 1; } return 0; @@ -509,7 +509,7 @@ char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw) char *mutt_get_parameter (const char *s, PARAMETER *p) { for (; p; p = p->next) - if (mutt_strcasecmp (s, p->attribute) == 0) + if (ascii_strcasecmp (s, p->attribute) == 0) return (p->value); return NULL; @@ -527,7 +527,7 @@ void mutt_set_parameter (const char *attribute, const char *value, PARAMETER **p for(q = *p; q; q = q->next) { - if (mutt_strcasecmp (attribute, q->attribute) == 0) + if (ascii_strcasecmp (attribute, q->attribute) == 0) { mutt_str_replace (&q->value, value); return; @@ -547,7 +547,7 @@ void mutt_delete_parameter (const char *attribute, PARAMETER **p) for (q = *p; q; p = &q->next, q = q->next) { - if (mutt_strcasecmp (attribute, q->attribute) == 0) + if (ascii_strcasecmp (attribute, q->attribute) == 0) { *p = q->next; q->next = NULL; @@ -564,9 +564,9 @@ int mutt_needs_mailcap (BODY *m) { case TYPETEXT: - if (!mutt_strcasecmp ("plain", m->subtype) || - !mutt_strcasecmp ("rfc822-headers", m->subtype) || - !mutt_strcasecmp ("enriched", m->subtype)) + if (!ascii_strcasecmp ("plain", m->subtype) || + !ascii_strcasecmp ("rfc822-headers", m->subtype) || + !ascii_strcasecmp ("enriched", m->subtype)) return 0; break; @@ -596,7 +596,7 @@ int mutt_is_text_type (int t, char *s) if (t == TYPEMESSAGE) { - if (!mutt_strcasecmp ("delivery-status", s)) + if (!ascii_strcasecmp ("delivery-status", s)) return 1; } @@ -605,7 +605,7 @@ int mutt_is_text_type (int t, char *s) #ifdef HAVE_PGP if (t == TYPEAPPLICATION) { - if (!mutt_strcasecmp ("pgp-keys", s)) + if (!ascii_strcasecmp ("pgp-keys", s)) return 1; } #endif /* HAVE_PGP */ diff --git a/mx.c b/mx.c index cea83385..e591e0e2 100644 --- a/mx.c +++ b/mx.c @@ -452,15 +452,15 @@ int mx_get_magic (const char *path) */ int mx_set_magic (const char *s) { - if (mutt_strcasecmp (s, "mbox") == 0) + if (ascii_strcasecmp (s, "mbox") == 0) DefaultMagic = M_MBOX; - else if (mutt_strcasecmp (s, "mmdf") == 0) + else if (ascii_strcasecmp (s, "mmdf") == 0) DefaultMagic = M_MMDF; - else if (mutt_strcasecmp (s, "mh") == 0) + else if (ascii_strcasecmp (s, "mh") == 0) DefaultMagic = M_MH; - else if (mutt_strcasecmp (s, "maildir") == 0) + else if (ascii_strcasecmp (s, "maildir") == 0) DefaultMagic = M_MAILDIR; - else if (mutt_strcasecmp (s, "kendra") == 0) + else if (ascii_strcasecmp (s, "kendra") == 0) DefaultMagic = M_KENDRA; else return (-1); diff --git a/parse.c b/parse.c index b3888fec..fd51f14f 100644 --- a/parse.c +++ b/parse.c @@ -115,20 +115,20 @@ static LIST *mutt_parse_references (char *s) int mutt_check_encoding (const char *c) { - if (mutt_strncasecmp ("7bit", c, sizeof ("7bit")-1) == 0) + if (ascii_strncasecmp ("7bit", c, sizeof ("7bit")-1) == 0) return (ENC7BIT); - else if (mutt_strncasecmp ("8bit", c, sizeof ("8bit")-1) == 0) + else if (ascii_strncasecmp ("8bit", c, sizeof ("8bit")-1) == 0) return (ENC8BIT); - else if (mutt_strncasecmp ("binary", c, sizeof ("binary")-1) == 0) + else if (ascii_strncasecmp ("binary", c, sizeof ("binary")-1) == 0) return (ENCBINARY); - else if (mutt_strncasecmp ("quoted-printable", c, sizeof ("quoted-printable")-1) == 0) + else if (ascii_strncasecmp ("quoted-printable", c, sizeof ("quoted-printable")-1) == 0) return (ENCQUOTEDPRINTABLE); - else if (mutt_strncasecmp ("base64", c, sizeof("base64")-1) == 0) + else if (ascii_strncasecmp ("base64", c, sizeof("base64")-1) == 0) return (ENCBASE64); - else if (mutt_strncasecmp ("x-uuencode", c, sizeof("x-uuencode")-1) == 0) + else if (ascii_strncasecmp ("x-uuencode", c, sizeof("x-uuencode")-1) == 0) return (ENCUUENCODED); #ifdef SUN_ATTACHMENT - else if (mutt_strncasecmp ("uuencode", c, sizeof("uuencode")-1) == 0) + else if (ascii_strncasecmp ("uuencode", c, sizeof("uuencode")-1) == 0) return (ENCUUENCODED); #endif else @@ -237,25 +237,25 @@ static PARAMETER *parse_parameters (const char *s) int mutt_check_mime_type (const char *s) { - if (mutt_strcasecmp ("text", s) == 0) + if (ascii_strcasecmp ("text", s) == 0) return TYPETEXT; - else if (mutt_strcasecmp ("multipart", s) == 0) + else if (ascii_strcasecmp ("multipart", s) == 0) return TYPEMULTIPART; #ifdef SUN_ATTACHMENT - else if (mutt_strcasecmp ("x-sun-attachment", s) == 0) + else if (ascii_strcasecmp ("x-sun-attachment", s) == 0) return TYPEMULTIPART; #endif - else if (mutt_strcasecmp ("application", s) == 0) + else if (ascii_strcasecmp ("application", s) == 0) return TYPEAPPLICATION; - else if (mutt_strcasecmp ("message", s) == 0) + else if (ascii_strcasecmp ("message", s) == 0) return TYPEMESSAGE; - else if (mutt_strcasecmp ("image", s) == 0) + else if (ascii_strcasecmp ("image", s) == 0) return TYPEIMAGE; - else if (mutt_strcasecmp ("audio", s) == 0) + else if (ascii_strcasecmp ("audio", s) == 0) return TYPEAUDIO; - else if (mutt_strcasecmp ("video", s) == 0) + else if (ascii_strcasecmp ("video", s) == 0) return TYPEVIDEO; - else if (mutt_strcasecmp ("model", s) == 0) + else if (ascii_strcasecmp ("model", s) == 0) return TYPEMODEL; else return TYPEOTHER; @@ -305,7 +305,7 @@ void mutt_parse_content_type (char *s, BODY *ct) ct->type = mutt_check_mime_type (s); #ifdef SUN_ATTACHMENT - if (mutt_strcasecmp ("x-sun-attachment", s) == 0) + if (ascii_strcasecmp ("x-sun-attachment", s) == 0) ct->subtype = safe_strdup ("x-sun-attachment"); #endif @@ -350,9 +350,9 @@ static void parse_content_disposition (char *s, BODY *ct) { PARAMETER *parms; - if (!mutt_strncasecmp ("inline", s, 6)) + if (!ascii_strncasecmp ("inline", s, 6)) ct->disposition = DISPINLINE; - else if (!mutt_strncasecmp ("form-data", s, 9)) + else if (!ascii_strncasecmp ("form-data", s, 9)) ct->disposition = DISPFORMDATA; else ct->disposition = DISPATTACH; @@ -410,30 +410,30 @@ BODY *mutt_read_mime_header (FILE *fp, int digest) break; } - if (!mutt_strncasecmp ("content-", line, 8)) + if (!ascii_strncasecmp ("content-", line, 8)) { - if (!mutt_strcasecmp ("type", line + 8)) + if (!ascii_strcasecmp ("type", line + 8)) mutt_parse_content_type (c, p); - else if (!mutt_strcasecmp ("transfer-encoding", line + 8)) + else if (!ascii_strcasecmp ("transfer-encoding", line + 8)) p->encoding = mutt_check_encoding (c); - else if (!mutt_strcasecmp ("disposition", line + 8)) + else if (!ascii_strcasecmp ("disposition", line + 8)) parse_content_disposition (c, p); - else if (!mutt_strcasecmp ("description", line + 8)) + else if (!ascii_strcasecmp ("description", line + 8)) { mutt_str_replace (&p->description, c); rfc2047_decode (&p->description); } } #ifdef SUN_ATTACHMENT - else if (!mutt_strncasecmp ("x-sun-", line, 6)) + else if (!ascii_strncasecmp ("x-sun-", line, 6)) { - if (!mutt_strcasecmp ("data-type", line + 6)) + if (!ascii_strcasecmp ("data-type", line + 6)) mutt_parse_content_type (c, p); - else if (!mutt_strcasecmp ("encoding-info", line + 6)) + else if (!ascii_strcasecmp ("encoding-info", line + 6)) p->encoding = mutt_check_encoding (c); - else if (!mutt_strcasecmp ("content-lines", line + 6)) + else if (!ascii_strcasecmp ("content-lines", line + 6)) mutt_set_parameter ("content-lines", safe_strdup (c), &(p->parameter)); - else if (!mutt_strcasecmp ("data-description", line + 6)) + else if (!ascii_strcasecmp ("data-description", line + 6)) { mutt_str_replace (&p->description, c); rfc2047_decode (&p->description); @@ -460,7 +460,7 @@ void mutt_parse_part (FILE *fp, BODY *b) { case TYPEMULTIPART: #ifdef SUN_ATTACHMENT - if ( !mutt_strcasecmp (b->subtype, "x-sun-attachment") ) + if ( !ascii_strcasecmp (b->subtype, "x-sun-attachment") ) bound = "--------"; else #endif @@ -469,7 +469,7 @@ void mutt_parse_part (FILE *fp, BODY *b) fseek (fp, b->offset, SEEK_SET); b->parts = mutt_parse_multipart (fp, bound, b->offset + b->length, - mutt_strcasecmp ("digest", b->subtype) == 0); + ascii_strcasecmp ("digest", b->subtype) == 0); break; case TYPEMESSAGE: @@ -478,7 +478,7 @@ void mutt_parse_part (FILE *fp, BODY *b) fseek (fp, b->offset, SEEK_SET); if (mutt_is_message_type(b->type, b->subtype)) b->parts = mutt_parse_messageRFC822 (fp, b); - else if (mutt_strcasecmp (b->subtype, "external-body") == 0) + else if (ascii_strcasecmp (b->subtype, "external-body") == 0) b->parts = mutt_read_mime_header (fp, 0); else return; @@ -816,7 +816,7 @@ time_t mutt_parse_date (const char *s, HEADER *h) tz = bsearch (ptz, TimeZones, sizeof TimeZones/sizeof (struct tz_t), sizeof (struct tz_t), - (int (*)(const void *, const void *)) strcasecmp + (int (*)(const void *, const void *)) ascii_strcasecmp /* This is safe to do: A pointer to a struct equals * a pointer to its first element*/); @@ -828,11 +828,11 @@ time_t mutt_parse_date (const char *s, HEADER *h) } /* ad hoc support for the European MET (now officially CET) TZ */ - if (mutt_strcasecmp (t, "MET") == 0) + if (ascii_strcasecmp (t, "MET") == 0) { if ((t = strtok (NULL, " \t")) != NULL) { - if (!mutt_strcasecmp (t, "DST")) + if (!ascii_strcasecmp (t, "DST")) zhours++; } } @@ -911,15 +911,15 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short if (lastp) last = *lastp; - switch (tolower (line[0])) + switch (ascii_tolower (line[0])) { case 'a': - if (mutt_strcasecmp (line+1, "pparently-to") == 0) + if (ascii_strcasecmp (line+1, "pparently-to") == 0) { e->to = rfc822_parse_adrlist (e->to, p); matched = 1; } - else if (mutt_strcasecmp (line+1, "pparently-from") == 0) + else if (ascii_strcasecmp (line+1, "pparently-from") == 0) { e->from = rfc822_parse_adrlist (e->from, p); matched = 1; @@ -927,7 +927,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'b': - if (mutt_strcasecmp (line+1, "cc") == 0) + if (ascii_strcasecmp (line+1, "cc") == 0) { e->bcc = rfc822_parse_adrlist (e->bcc, p); matched = 1; @@ -935,26 +935,26 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'c': - if (mutt_strcasecmp (line+1, "c") == 0) + if (ascii_strcasecmp (line+1, "c") == 0) { e->cc = rfc822_parse_adrlist (e->cc, p); matched = 1; } - else if (mutt_strncasecmp (line + 1, "ontent-", 7) == 0) + else if (ascii_strncasecmp (line + 1, "ontent-", 7) == 0) { - if (mutt_strcasecmp (line+8, "type") == 0) + if (ascii_strcasecmp (line+8, "type") == 0) { if (hdr) mutt_parse_content_type (p, hdr->content); matched = 1; } - else if (mutt_strcasecmp (line+8, "transfer-encoding") == 0) + else if (ascii_strcasecmp (line+8, "transfer-encoding") == 0) { if (hdr) hdr->content->encoding = mutt_check_encoding (p); matched = 1; } - else if (mutt_strcasecmp (line+8, "length") == 0) + else if (ascii_strcasecmp (line+8, "length") == 0) { if (hdr) { @@ -963,7 +963,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short } matched = 1; } - else if (mutt_strcasecmp (line+8, "description") == 0) + else if (ascii_strcasecmp (line+8, "description") == 0) { if (hdr) { @@ -972,7 +972,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short } matched = 1; } - else if (mutt_strcasecmp (line+8, "disposition") == 0) + else if (ascii_strcasecmp (line+8, "disposition") == 0) { if (hdr) parse_content_disposition (p, hdr->content); @@ -982,7 +982,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'd': - if (!mutt_strcasecmp ("ate", line + 1)) + if (!ascii_strcasecmp ("ate", line + 1)) { mutt_str_replace (&e->date, p); if (hdr) @@ -992,13 +992,13 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'e': - if (!mutt_strcasecmp ("xpires", line + 1) && + if (!ascii_strcasecmp ("xpires", line + 1) && hdr && mutt_parse_date (p, NULL) < time (NULL)) hdr->expired = 1; break; case 'f': - if (!mutt_strcasecmp ("rom", line + 1)) + if (!ascii_strcasecmp ("rom", line + 1)) { e->from = rfc822_parse_adrlist (e->from, p); matched = 1; @@ -1006,7 +1006,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'i': - if (!mutt_strcasecmp (line+1, "n-reply-to")) + if (!ascii_strcasecmp (line+1, "n-reply-to")) { mutt_free_list (&e->in_reply_to); e->in_reply_to = mutt_parse_references (p); @@ -1015,7 +1015,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'l': - if (!mutt_strcasecmp (line + 1, "ines")) + if (!ascii_strcasecmp (line + 1, "ines")) { if (hdr) hdr->lines = atoi (p); @@ -1024,29 +1024,29 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'm': - if (!mutt_strcasecmp (line + 1, "ime-version")) + if (!ascii_strcasecmp (line + 1, "ime-version")) { if (hdr) hdr->mime = 1; matched = 1; } - else if (!mutt_strcasecmp (line + 1, "essage-id")) + else if (!ascii_strcasecmp (line + 1, "essage-id")) { /* We add a new "Message-Id:" when building a message */ safe_free ((void **) &e->message_id); e->message_id = extract_message_id (p); matched = 1; } - else if (!mutt_strncasecmp (line + 1, "ail-", 4)) + else if (!ascii_strncasecmp (line + 1, "ail-", 4)) { - if (!mutt_strcasecmp (line + 5, "reply-to")) + if (!ascii_strcasecmp (line + 5, "reply-to")) { /* override the Reply-To: field */ rfc822_free_address (&e->reply_to); e->reply_to = rfc822_parse_adrlist (e->reply_to, p); matched = 1; } - else if (!mutt_strcasecmp (line + 5, "followup-to")) + else if (!ascii_strcasecmp (line + 5, "followup-to")) { e->mail_followup_to = rfc822_parse_adrlist (e->mail_followup_to, p); matched = 1; @@ -1055,23 +1055,23 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'r': - if (!mutt_strcasecmp (line + 1, "eferences")) + if (!ascii_strcasecmp (line + 1, "eferences")) { mutt_free_list (&e->references); e->references = mutt_parse_references (p); matched = 1; } - else if (!mutt_strcasecmp (line + 1, "eply-to")) + else if (!ascii_strcasecmp (line + 1, "eply-to")) { e->reply_to = rfc822_parse_adrlist (e->reply_to, p); matched = 1; } - else if (!mutt_strcasecmp (line + 1, "eturn-path")) + else if (!ascii_strcasecmp (line + 1, "eturn-path")) { e->return_path = rfc822_parse_adrlist (e->return_path, p); matched = 1; } - else if (!mutt_strcasecmp (line + 1, "eceived")) + else if (!ascii_strcasecmp (line + 1, "eceived")) { if (hdr && !hdr->received) { @@ -1084,18 +1084,18 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 's': - if (!mutt_strcasecmp (line + 1, "ubject")) + if (!ascii_strcasecmp (line + 1, "ubject")) { if (!e->subject) e->subject = safe_strdup (p); matched = 1; } - else if (!mutt_strcasecmp (line + 1, "ender")) + else if (!ascii_strcasecmp (line + 1, "ender")) { e->sender = rfc822_parse_adrlist (e->sender, p); matched = 1; } - else if (!mutt_strcasecmp (line + 1, "tatus")) + else if (!ascii_strcasecmp (line + 1, "tatus")) { if (hdr) { @@ -1119,13 +1119,13 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short } matched = 1; } - else if ((!mutt_strcasecmp ("upersedes", line + 1) || - !mutt_strcasecmp ("upercedes", line + 1)) && hdr) + else if ((!ascii_strcasecmp ("upersedes", line + 1) || + !ascii_strcasecmp ("upercedes", line + 1)) && hdr) e->supersedes = safe_strdup (p); break; case 't': - if (mutt_strcasecmp (line+1, "o") == 0) + if (ascii_strcasecmp (line+1, "o") == 0) { e->to = rfc822_parse_adrlist (e->to, p); matched = 1; @@ -1133,7 +1133,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short break; case 'x': - if (mutt_strcasecmp (line+1, "-status") == 0) + if (ascii_strcasecmp (line+1, "-status") == 0) { if (hdr) { @@ -1158,7 +1158,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short } matched = 1; } - else if (mutt_strcasecmp (line+1, "-label") == 0) + else if (ascii_strcasecmp (line+1, "-label") == 0) { e->x_label = safe_strdup(p); matched = 1; diff --git a/pattern.c b/pattern.c index acb03772..213ae57c 100644 --- a/pattern.c +++ b/pattern.c @@ -1075,27 +1075,31 @@ void mutt_check_simple (char *s, size_t len, const char *simple) { char tmp[LONG_STRING]; + /* XXX - is ascii_strcasecmp() right here, or should we use locale's + * equivalences? + */ + if (!strchr (s, '~')) /* yup, so spoof a real request */ { /* convert old tokens into the new format */ - if (mutt_strcasecmp ("all", s) == 0 || + if (ascii_strcasecmp ("all", s) == 0 || !mutt_strcmp ("^", s) || !mutt_strcmp (".", s)) /* ~A is more efficient */ strfcpy (s, "~A", len); - else if (mutt_strcasecmp ("del", s) == 0) + else if (ascii_strcasecmp ("del", s) == 0) strfcpy (s, "~D", len); - else if (mutt_strcasecmp ("flag", s) == 0) + else if (ascii_strcasecmp ("flag", s) == 0) strfcpy (s, "~F", len); - else if (mutt_strcasecmp ("new", s) == 0) + else if (ascii_strcasecmp ("new", s) == 0) strfcpy (s, "~N", len); - else if (mutt_strcasecmp ("old", s) == 0) + else if (ascii_strcasecmp ("old", s) == 0) strfcpy (s, "~O", len); - else if (mutt_strcasecmp ("repl", s) == 0) + else if (ascii_strcasecmp ("repl", s) == 0) strfcpy (s, "~Q", len); - else if (mutt_strcasecmp ("read", s) == 0) + else if (ascii_strcasecmp ("read", s) == 0) strfcpy (s, "~R", len); - else if (mutt_strcasecmp ("tag", s) == 0) + else if (ascii_strcasecmp ("tag", s) == 0) strfcpy (s, "~T", len); - else if (mutt_strcasecmp ("unread", s) == 0) + else if (ascii_strcasecmp ("unread", s) == 0) strfcpy (s, "~U", len); else { diff --git a/pgp.c b/pgp.c index b78f214b..658d455e 100644 --- a/pgp.c +++ b/pgp.c @@ -519,10 +519,10 @@ int mutt_is_multipart_signed (BODY *b) char *p; if (!b || b->type != TYPEMULTIPART || - !b->subtype || mutt_strcasecmp (b->subtype, "signed") || + !b->subtype || ascii_strcasecmp (b->subtype, "signed") || !(p = mutt_get_parameter ("protocol", b->parameter)) || - (mutt_strcasecmp (p, "application/pgp-signature") - && mutt_strcasecmp (p, "multipart/mixed"))) + (ascii_strcasecmp (p, "application/pgp-signature") + && ascii_strcasecmp (p, "multipart/mixed"))) return 0; return PGPSIGN; @@ -534,9 +534,9 @@ int mutt_is_multipart_encrypted (BODY *b) char *p; if (!b || b->type != TYPEMULTIPART || - !b->subtype || mutt_strcasecmp (b->subtype, "encrypted") || + !b->subtype || ascii_strcasecmp (b->subtype, "encrypted") || !(p = mutt_get_parameter ("protocol", b->parameter)) || - mutt_strcasecmp (p, "application/pgp-encrypted")) + ascii_strcasecmp (p, "application/pgp-encrypted")) return 0; return PGPENCRYPT; @@ -549,23 +549,23 @@ int mutt_is_application_pgp (BODY *m) if (m->type == TYPEAPPLICATION) { - if (!mutt_strcasecmp (m->subtype, "pgp") || !mutt_strcasecmp (m->subtype, "x-pgp-message")) + if (!ascii_strcasecmp (m->subtype, "pgp") || !ascii_strcasecmp (m->subtype, "x-pgp-message")) { if ((p = mutt_get_parameter ("x-action", m->parameter)) - && (!mutt_strcasecmp (p, "sign") || !mutt_strcasecmp (p, "signclear"))) + && (!ascii_strcasecmp (p, "sign") || !ascii_strcasecmp (p, "signclear"))) t |= PGPSIGN; if ((p = mutt_get_parameter ("format", m->parameter)) && - !mutt_strcasecmp (p, "keys-only")) + !ascii_strcasecmp (p, "keys-only")) t |= PGPKEY; if(!t) t |= PGPENCRYPT; /* not necessarily correct, but... */ } - if (!mutt_strcasecmp (m->subtype, "pgp-signed")) + if (!ascii_strcasecmp (m->subtype, "pgp-signed")) t |= PGPSIGN; - if (!mutt_strcasecmp (m->subtype, "pgp-keys")) + if (!ascii_strcasecmp (m->subtype, "pgp-keys")) t |= PGPKEY; } return t; @@ -756,15 +756,15 @@ void pgp_signed_handler (BODY *a, STATE *s) /* consistency check */ if (!(a && a->next && a->next->type == protocol_major && - !mutt_strcasecmp(a->next->subtype, protocol_minor))) + !ascii_strcasecmp(a->next->subtype, protocol_minor))) { state_puts(_("[-- Error: Inconsistent multipart/signed structure! --]\n\n"), s); mutt_body_handler (a, s); return; } - if(!(protocol_major == TYPEAPPLICATION && !mutt_strcasecmp(protocol_minor, "pgp-signature")) - && !(protocol_major == TYPEMULTIPART && !mutt_strcasecmp(protocol_minor, "mixed"))) + if(!(protocol_major == TYPEAPPLICATION && !ascii_strcasecmp(protocol_minor, "pgp-signature")) + && !(protocol_major == TYPEMULTIPART && !ascii_strcasecmp(protocol_minor, "mixed"))) { state_printf(s, _("[-- Error: Unknown multipart/signed protocol %s! --]\n\n"), protocol); mutt_body_handler (a, s); @@ -784,7 +784,7 @@ void pgp_signed_handler (BODY *a, STATE *s) for (i = 0; i < sigcnt; i++) { if (signatures[i]->type == TYPEAPPLICATION - && !mutt_strcasecmp(signatures[i]->subtype, "pgp-signature")) + && !ascii_strcasecmp(signatures[i]->subtype, "pgp-signature")) { if (pgp_verify_one (signatures[i], s, tempfile) != 0) goodsig = 0; @@ -1063,9 +1063,9 @@ void pgp_encrypted_handler (BODY *a, STATE *s) a = a->parts; if (!a || a->type != TYPEAPPLICATION || !a->subtype || - mutt_strcasecmp ("pgp-encrypted", a->subtype) != 0 || + ascii_strcasecmp ("pgp-encrypted", a->subtype) != 0 || !a->next || a->next->type != TYPEAPPLICATION || !a->next->subtype || - mutt_strcasecmp ("octet-stream", a->next->subtype) != 0) + ascii_strcasecmp ("octet-stream", a->next->subtype) != 0) { if (s->flags & M_DISPLAY) state_puts (_("[-- Error: malformed PGP/MIME message! --]\n\n"), s); @@ -1136,7 +1136,7 @@ static void convert_to_7bit (BODY *a) convert_to_7bit (a->parts); } else if (a->type == TYPEMESSAGE - && mutt_strcasecmp(a->subtype, "delivery-status")) + && ascii_strcasecmp(a->subtype, "delivery-status")) { if(a->encoding != ENC7BIT) mutt_message_to_7bit(a, NULL); @@ -1651,7 +1651,7 @@ int pgp_protect (HEADER *msg, char *pgpkeylist) return (-1); if ((msg->content->type == TYPETEXT) && - !mutt_strcasecmp (msg->content->subtype, "plain") && + !ascii_strcasecmp (msg->content->subtype, "plain") && ((flags & PGPENCRYPT) || (msg->content->content && msg->content->content->hibin == 0))) { if ((i = query_quadoption (OPT_PGPTRADITIONAL, _("Create an application/pgp message?"))) == -1) diff --git a/pgpkey.c b/pgpkey.c index b5d2781e..bfc6ff82 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -143,7 +143,7 @@ static const char *pgp_entry_fmt (char *dest, kflags = key->flags | (pkey->flags & KEYFLAG_RESTRICTIONS) | uid->flags; - switch (tolower (op)) + switch (ascii_tolower (op)) { case '[': diff --git a/postpone.c b/postpone.c index 030c83d4..b78e4c08 100644 --- a/postpone.c +++ b/postpone.c @@ -283,7 +283,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size for (tmp = hdr->env->userhdrs; tmp; ) { - if (mutt_strncasecmp ("X-Mutt-References:", tmp->data, 18) == 0) + if (ascii_strncasecmp ("X-Mutt-References:", tmp->data, 18) == 0) { if (ctx) { @@ -306,7 +306,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size if (*cur) code |= SENDREPLY; } - else if (mutt_strncasecmp ("X-Mutt-Fcc:", tmp->data, 11) == 0) + else if (ascii_strncasecmp ("X-Mutt-Fcc:", tmp->data, 11) == 0) { p = tmp->data + 11; SKIPWS (p); @@ -490,7 +490,7 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, while (p) { - if (!strncasecmp (p->data, "x-mailer:", 9) || !strncasecmp (p->data, "user-agent:", 11)) + if (!ascii_strncasecmp (p->data, "x-mailer:", 9) || !ascii_strncasecmp (p->data, "user-agent:", 11)) { *q = p->next; p->next = NULL; @@ -586,7 +586,7 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, if (b->type == TYPETEXT) { - if (!mutt_strcasecmp ("yes", mutt_get_parameter ("x-mutt-noconv", b->parameter))) + if (!ascii_strcasecmp ("yes", mutt_get_parameter ("x-mutt-noconv", b->parameter))) b->noconv = 1; else { diff --git a/recvattach.c b/recvattach.c index f75115cc..c41fa2ce 100644 --- a/recvattach.c +++ b/recvattach.c @@ -123,7 +123,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY *m, } if (m->type == TYPEMULTIPART && m->parts - && (compose || (parent_type == -1 && mutt_strcasecmp ("alternative", m->subtype))) + && (compose || (parent_type == -1 && ascii_strcasecmp ("alternative", m->subtype))) #ifdef HAVE_PGP && !mutt_is_multipart_encrypted(m) #endif @@ -365,7 +365,7 @@ int mutt_is_message_type (int type, const char *subtype) return 0; subtype = NONULL(subtype); - return (mutt_strcasecmp (subtype, "rfc822") == 0 || mutt_strcasecmp (subtype, "news") == 0); + return (ascii_strcasecmp (subtype, "rfc822") == 0 || ascii_strcasecmp (subtype, "news") == 0); } static int mutt_query_save_attachment (FILE *fp, BODY *body, HEADER *hdr) @@ -599,8 +599,8 @@ static int can_print (BODY *top, int tag) { if (!rfc1524_mailcap_lookup (top, type, NULL, M_PRINT)) { - if (mutt_strcasecmp ("text/plain", top->subtype) && - mutt_strcasecmp ("application/postscript", top->subtype)) + if (ascii_strcasecmp ("text/plain", top->subtype) && + ascii_strcasecmp ("application/postscript", top->subtype)) { if (!mutt_can_decode (top)) { @@ -630,8 +630,8 @@ static void print_attachment_list (FILE *fp, int tag, BODY *top, STATE *state) snprintf (type, sizeof (type), "%s/%s", TYPE (top), top->subtype); if (!option (OPTATTACHSPLIT) && !rfc1524_mailcap_lookup (top, type, NULL, M_PRINT)) { - if (!mutt_strcasecmp ("text/plain", top->subtype) || - !mutt_strcasecmp ("application/postscript", top->subtype)) + if (!ascii_strcasecmp ("text/plain", top->subtype) || + !ascii_strcasecmp ("application/postscript", top->subtype)) pipe_attachment (fp, top, state); else if (mutt_can_decode (top)) { @@ -793,7 +793,7 @@ static void attach_collapse (BODY *b, short collapse, short init, short just_one { i = init || b->collapsed; if (i && option (OPTDIGESTCOLLAPSE) && b->type == TYPEMULTIPART - && !mutt_strcasecmp (b->subtype, "digest")) + && !ascii_strcasecmp (b->subtype, "digest")) attach_collapse (b->parts, 1, 1, 0); else if (b->type == TYPEMULTIPART || mutt_is_message_type (b->type, b->subtype)) attach_collapse (b->parts, collapse, i, 0); diff --git a/remailer.c b/remailer.c index 3077ea22..e89f482f 100644 --- a/remailer.c +++ b/remailer.c @@ -452,7 +452,7 @@ static int mix_chain_add (MIXCHAIN *chain, const char *s, if (chain->cl >= MAXMIXES) return -1; - if (!mutt_strcmp (s, "0") || !mutt_strcasecmp (s, "")) + if (!mutt_strcmp (s, "0") || !ascii_strcasecmp (s, "")) { chain->ch[chain->cl++] = 0; return 0; @@ -460,7 +460,7 @@ static int mix_chain_add (MIXCHAIN *chain, const char *s, for (i = 0; type2_list[i]; i++) { - if (!mutt_strcasecmp (s, type2_list[i]->shortname)) + if (!ascii_strcasecmp (s, type2_list[i]->shortname)) { chain->ch[chain->cl++] = i; return 0; diff --git a/rfc1524.c b/rfc1524.c index a9e82d74..6e7da35f 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -208,8 +208,8 @@ static int rfc1524_mailcap_parse (BODY *a, /* check type */ ch = get_field (buf); - if (mutt_strcasecmp (buf, type) && - (mutt_strncasecmp (buf, type, btlen) || + if (ascii_strcasecmp (buf, type) && + (ascii_strncasecmp (buf, type, btlen) || (buf[btlen] != 0 && /* implicit wild */ mutt_strcmp (buf + btlen, "/*")))) /* wildsubtype */ continue; @@ -233,53 +233,53 @@ static int rfc1524_mailcap_parse (BODY *a, ch = get_field (ch); dprint (2, (debugfile, "field: %s\n", field)); - if (!mutt_strcasecmp (field, "needsterminal")) + if (!ascii_strcasecmp (field, "needsterminal")) { if (entry) entry->needsterminal = TRUE; } - else if (!mutt_strcasecmp (field, "copiousoutput")) + else if (!ascii_strcasecmp (field, "copiousoutput")) { copiousoutput = TRUE; if (entry) entry->copiousoutput = TRUE; } - else if (!mutt_strncasecmp (field, "composetyped", 12)) + else if (!ascii_strncasecmp (field, "composetyped", 12)) { /* this compare most occur before compose to match correctly */ if (get_field_text (field + 12, entry ? &entry->composetypecommand : NULL, type, filename, line)) composecommand = TRUE; } - else if (!mutt_strncasecmp (field, "compose", 7)) + else if (!ascii_strncasecmp (field, "compose", 7)) { if (get_field_text (field + 7, entry ? &entry->composecommand : NULL, type, filename, line)) composecommand = TRUE; } - else if (!mutt_strncasecmp (field, "print", 5)) + else if (!ascii_strncasecmp (field, "print", 5)) { if (get_field_text (field + 5, entry ? &entry->printcommand : NULL, type, filename, line)) printcommand = TRUE; } - else if (!mutt_strncasecmp (field, "edit", 4)) + else if (!ascii_strncasecmp (field, "edit", 4)) { if (get_field_text (field + 4, entry ? &entry->editcommand : NULL, type, filename, line)) editcommand = TRUE; } - else if (!mutt_strncasecmp (field, "nametemplate", 12)) + else if (!ascii_strncasecmp (field, "nametemplate", 12)) { get_field_text (field + 12, entry ? &entry->nametemplate : NULL, type, filename, line); } - else if (!mutt_strncasecmp (field, "x-convert", 9)) + else if (!ascii_strncasecmp (field, "x-convert", 9)) { get_field_text (field + 9, entry ? &entry->convert : NULL, type, filename, line); } - else if (!mutt_strncasecmp (field, "test", 4)) + else if (!ascii_strncasecmp (field, "test", 4)) { /* * This routine executes the given test command to determine diff --git a/rfc2047.c b/rfc2047.c index f8565f6c..1e2f3070 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -276,7 +276,7 @@ static size_t try_block (const char *d, size_t dlen, len_q = len + (ob - buf1) + 2 * count; /* Apparently RFC 1468 says to use B encoding for iso-2022-jp. */ - if (!strcasecmp (tocode, "ISO-2022-JP")) + if (!ascii_strcasecmp (tocode, "ISO-2022-JP")) len_q = ENCWORD_LEN_MAX + 1; if (len_b < len_q && len_b <= ENCWORD_LEN_MAX) diff --git a/send.c b/send.c index 56082ca0..ba96997f 100644 --- a/send.c +++ b/send.c @@ -67,7 +67,7 @@ static int mutt_addrcmp (ADDRESS *a, ADDRESS *b) { if (!a->mailbox || !b->mailbox) return 0; - if (mutt_strcasecmp (a->mailbox, b->mailbox)) + if (ascii_strcasecmp (a->mailbox, b->mailbox)) return 0; return 1; } @@ -222,7 +222,7 @@ static int edit_envelope (ENVELOPE *en) buf[0] = 0; for (; uh; uh = uh->next) { - if (mutt_strncasecmp ("subject:", uh->data, 8) == 0) + if (ascii_strncasecmp ("subject:", uh->data, 8) == 0) { p = uh->data + 8; SKIPWS (p); @@ -248,11 +248,11 @@ static void process_user_recips (ENVELOPE *env) for (; uh; uh = uh->next) { - if (mutt_strncasecmp ("to:", uh->data, 3) == 0) + if (ascii_strncasecmp ("to:", uh->data, 3) == 0) env->to = rfc822_parse_adrlist (env->to, uh->data + 3); - else if (mutt_strncasecmp ("cc:", uh->data, 3) == 0) + else if (ascii_strncasecmp ("cc:", uh->data, 3) == 0) env->cc = rfc822_parse_adrlist (env->cc, uh->data + 3); - else if (mutt_strncasecmp ("bcc:", uh->data, 4) == 0) + else if (ascii_strncasecmp ("bcc:", uh->data, 4) == 0) env->bcc = rfc822_parse_adrlist (env->bcc, uh->data + 4); } } @@ -268,23 +268,23 @@ static void process_user_header (ENVELOPE *env) for (; uh; uh = uh->next) { - if (mutt_strncasecmp ("from:", uh->data, 5) == 0) + if (ascii_strncasecmp ("from:", uh->data, 5) == 0) { /* User has specified a default From: address. Remove default address */ rfc822_free_address (&env->from); env->from = rfc822_parse_adrlist (env->from, uh->data + 5); } - else if (mutt_strncasecmp ("reply-to:", uh->data, 9) == 0) + else if (ascii_strncasecmp ("reply-to:", uh->data, 9) == 0) { rfc822_free_address (&env->reply_to); env->reply_to = rfc822_parse_adrlist (env->reply_to, uh->data + 9); } - else if (mutt_strncasecmp ("message-id:", uh->data, 11) == 0) + else if (ascii_strncasecmp ("message-id:", uh->data, 11) == 0) mutt_str_replace (&env->message_id, uh->data + 11); - else if (mutt_strncasecmp ("to:", uh->data, 3) != 0 && - mutt_strncasecmp ("cc:", uh->data, 3) != 0 && - mutt_strncasecmp ("bcc:", uh->data, 4) != 0 && - mutt_strncasecmp ("subject:", uh->data, 8) != 0) + else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 && + ascii_strncasecmp ("cc:", uh->data, 3) != 0 && + ascii_strncasecmp ("bcc:", uh->data, 4) != 0 && + ascii_strncasecmp ("subject:", uh->data, 8) != 0) { if (last) { diff --git a/sendlib.c b/sendlib.c index ee19d3a8..9e690155 100644 --- a/sendlib.c +++ b/sendlib.c @@ -377,7 +377,7 @@ int mutt_write_mime_header (BODY *a, FILE *f) * even when they aren't needed. */ - if (!strcasecmp (p->attribute, "boundary") && !strcmp (buffer, tmp)) + if (!ascii_strcasecmp (p->attribute, "boundary") && !strcmp (buffer, tmp)) snprintf (buffer, sizeof (buffer), "\"%s\"", tmp); safe_free ((void **)&tmp); @@ -686,7 +686,7 @@ static size_t convert_file_to (FILE *file, const char *fromcode, infos = safe_calloc (1, ncodes * sizeof (CONTENT)); for (i = 0; i < ncodes; i++) - if (strcasecmp (tocodes[i], "UTF-8")) + if (ascii_strcasecmp (tocodes[i], "UTF-8")) cd[i] = mutt_iconv_open (tocodes[i], "UTF-8", 0); else /* Special case for conversion to UTF-8 */ @@ -1001,7 +1001,7 @@ static int lookup_mime_type (BODY *att, const char *path) { sze = mutt_strlen (p); if ((sze > cur_sze) && (szf >= sze) && - mutt_strcasecmp (path + szf - sze, p) == 0 && + (mutt_strcasecmp (path + szf - sze, p) == 0 || ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze || path[szf - sze - 1] == '.')) { /* get the content-type */ @@ -2216,7 +2216,7 @@ ADDRESS *mutt_remove_duplicates (ADDRESS *addr) tmp = top; do { if (addr->mailbox && tmp->mailbox && - !mutt_strcasecmp (addr->mailbox, tmp->mailbox)) + !ascii_strcasecmp (addr->mailbox, tmp->mailbox)) { /* duplicate address, just ignore it */ tmp = addr; diff --git a/url.c b/url.c index d28a25b3..450f588a 100644 --- a/url.c +++ b/url.c @@ -74,7 +74,7 @@ url_scheme_t url_check_scheme (const char *s) strfcpy (sbuf, s, t - s + 1); for (t = sbuf; *t; t++) - *t = tolower (*t); + *t = ascii_tolower (*t); if ((i = mutt_getvaluebyname (sbuf, UrlMap)) == -1) return U_UNKNOWN; @@ -84,9 +84,9 @@ url_scheme_t url_check_scheme (const char *s) int url_parse_file (char *d, const char *src, size_t dl) { - if (strncasecmp (src, "file:", 5)) + if (ascii_strncasecmp (src, "file:", 5)) return -1; - else if (!strncasecmp (src, "file://", 7)) /* we don't support remote files */ + else if (!ascii_strncasecmp (src, "file://", 7)) /* we don't support remote files */ return -1; else strfcpy (d, src + 5, dl); @@ -226,7 +226,7 @@ int url_parse_mailto (ENVELOPE *e, char **body, const char *src) url_pct_decode (tag); url_pct_decode (value); - if (!strcasecmp (tag, "body")) + if (!ascii_strcasecmp (tag, "body")) mutt_str_replace (body, value); else { -- 2.50.1