move ascii.* into the lib-lib.
[apps/madmutt.git] / lib-lib / ascii.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 2001 Thomas Roessler <roessler@does-not-exist.org>
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 /* 
11  * Versions of the string comparison functions which are
12  * locale-insensitive.
13  */
14
15 #ifndef MUTT_LIB_LIB_ASCII_H
16 #define MUTT_LIB_LIB_ASCII_H
17
18 static inline int ascii_isupper(int c) {
19     return c >= 'A' && c <= 'Z';
20 }
21
22 static inline int ascii_islower(int c) {
23     return c >= 'a' && c <= 'z';
24 }
25
26 static inline int ascii_toupper(int c) {
27     if (ascii_islower(c))
28         return c & ~32;
29
30     return c;
31 }
32
33 static inline int ascii_tolower(int c) {
34     if (ascii_isupper(c))
35         return c | 32;
36
37     return c;
38 }
39
40 int ascii_strcasecmp(const char *a, const char *b);
41 int ascii_strncasecmp(const char *a, const char *b, int n);
42
43 #define ascii_strcmp(a,b)     str_cmp(a,b)
44 #define ascii_strncmp(a,b,c)  str_ncmp(a,b,c)
45
46 #endif /* MUTT_LIB_LIB_ASCII_H */