#include <stdlib.h>
#include "ascii.h"
-inline int ascii_isupper (int c)
-{
- return (c >= 'A') && (c <= 'Z');
-}
-
-inline int ascii_islower (int c)
-{
- return (c >= 'a') && (c <= 'z');
-}
-
-inline int ascii_toupper (int c)
-{
- if (ascii_islower (c))
- return c & ~32;
-
- return c;
-}
-
-inline 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;
for (;; a++, b++)
{
- if ((i = ascii_tolower (*a) - ascii_tolower (*b)))
+ if ((i = tolower (*a) - tolower (*b)))
return i;
/* test for NUL here rather that in the for loop in order to detect unqual
* length strings (see http://dev.mutt.org/trac/ticket/3601)
for (j = 0; (*a || *b) && j < n; a++, b++, j++)
{
- if ((i = ascii_tolower (*a) - ascii_tolower (*b)))
+ if ((i = tolower (*a) - tolower (*b)))
return i;
}
#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);
+#include <ctype.h>
+
int ascii_strcasecmp (const char *a, const char *b);
int ascii_strncasecmp (const char *a, const char *b, int n);
{
char *p = s;
- while (*p)
+ for (; *p; ++p)
{
- *p = ascii_tolower ((unsigned int) *p);
- p++;
+ *p = tolower (*p);
}
return s;
/* for cosmetics' sake, transform to lowercase. */
for (p = dest; *p; p++)
- *p = ascii_tolower (*p);
+ *p = tolower (*p);
out:
if (ext && *ext)
kflags = (key->flags /*| (pkey->flags & KEYFLAG_RESTRICTIONS)
| uid->flags*/);
- switch (ascii_tolower (op))
+ switch (tolower (op))
{
case '[':
{
cur->msgno + 1);
}
buf = be_include_messages (p, buf, &bufmax, &buflen,
- (ascii_tolower (tmp[1]) == 'm'),
- (ascii_isupper ((unsigned char) tmp[1])));
+ (tolower (tmp[1]) == 'm'),
+ (isupper ((unsigned char) tmp[1])));
}
else
addstr (_("No mailbox.\n"));
char *t;
int n = 0;
- if(s[0] != '<' || ascii_tolower(s[1]) != 'f')
+ if(s[0] != '<' || tolower(s[1]) != 'f')
return -1;
for(t = s + 2; *t && isdigit((unsigned char) *t); t++)
p = authenticators;
while (*p)
{
- *p = ascii_toupper (*p);
+ *p = toupper (*p);
p++;
}
if (lastp)
last = *lastp;
- switch (ascii_tolower (line[0]))
+ switch (tolower (line[0]))
{
case 'a':
if (ascii_strcasecmp (line+1, "pparently-to") == 0)
kflags = key->flags | (pkey->flags & KEYFLAG_RESTRICTIONS)
| uid->flags;
- switch (ascii_tolower (op))
+ switch (tolower (op))
{
case '[':
strfcpy (sbuf, s, t - s + 1);
for (t = sbuf; *t; t++)
- *t = ascii_tolower (*t);
+ *t = tolower (*t);
if ((i = mutt_getvaluebyname (sbuf, UrlMap)) == -1)
return U_UNKNOWN;