1 /* $OpenBSD: ctype.h,v 1.1 2019/04/14 10:14:53 jsg Exp $ */
2 /*
3 * Copyright (c) 2015 Mark Kettenis
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 #ifndef _LINUX_CTYPE_H
19 #define _LINUX_CTYPE_H
20
21 #define _U 0x01
22 #define _L 0x02
23 #define _N 0x04
24 #define _S 0x08
25 #define _P 0x10
26 #define _C 0x20
27 #define _X 0x40
28 #define _B 0x80
29
30 static inline int
isascii(int c)31 isascii(int c)
32 {
33 return ((unsigned int)c <= 0177);
34 }
35
36 static inline int
isprint(int c)37 isprint(int c)
38 {
39 if (c == -1)
40 return (0);
41 if ((unsigned char)c >= 040 && (unsigned char)c <= 0176)
42 return (1);
43 return (0);
44 }
45
46 #endif
47