xref: /original-bsd/lib/libc/locale/isctype.c (revision c3e32dec)
1 /*
2  * Copyright (c) 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Paul Borman at Krystal Technologies.
7  *
8  * %sccs.include.redist.c%
9  */
10 
11 #if defined(LIBC_SCCS) && !defined(lint)
12 static char sccsid[] = "@(#)isctype.c	8.1 (Berkeley) 06/04/93";
13 #endif /* LIBC_SCCS and not lint */
14 
15 #define _ANSI_LIBRARY
16 #include <ctype.h>
17 
18 #undef isalnum
19 int
20 isalnum(c)
21 	int c;
22 {
23 	return(__istype((c), (_A|_D)));
24 }
25 
26 #undef isalpha
27 int
28 isalpha(c)
29 	int c;
30 {
31 	return (__istype((c), _A));
32 }
33 
34 #undef isascii
35 int
36 isascii(c)
37 	int c;
38 {
39 	return((c & ~0x7F) == 0);
40 }
41 
42 #undef isblank
43 int
44 isblank(c)
45 	int c;
46 {
47 	return (__istype((c), _B));
48 }
49 
50 #undef iscntrl
51 int
52 iscntrl(c)
53 	int c;
54 {
55 	return (__istype((c), _C));
56 }
57 
58 #undef isdigit
59 int
60 isdigit(c)
61 	int c;
62 {
63 	return (__isctype((c), _D));
64 }
65 
66 #undef isgraph
67 int
68 isgraph(c)
69 	int c;
70 {
71 	return (__istype((c), _G));
72 }
73 
74 #undef islower
75 int
76 islower(c)
77 	int c;
78 {
79 	return (__istype((c), _L));
80 }
81 
82 #undef isprint
83 int
84 isprint(c)
85 	int c;
86 {
87 	return (__istype((c), _R));
88 }
89 
90 #undef ispunct
91 int
92 ispunct(c)
93 	int c;
94 {
95 	return (__istype((c), _P));
96 }
97 
98 #undef isspace
99 int
100 isspace(c)
101 	int c;
102 {
103 	return (__istype((c), _S));
104 }
105 
106 #undef isupper
107 int
108 isupper(c)
109 	int c;
110 {
111 	return (__istype((c), _U));
112 }
113 
114 #undef isxdigit
115 int
116 isxdigit(c)
117 	int c;
118 {
119 	return (__isctype((c), _X));
120 }
121 
122 #undef toascii
123 int
124 toascii(c)
125 	int c;
126 {
127 	return (c & 0177);
128 }
129 
130 #undef tolower
131 int
132 tolower(c)
133 	int c;
134 {
135         return((c & _CRMASK) ? ___toupper(c) : _CurrentRuneLocale->mapupper[c]);
136 }
137 
138 #undef toupper
139 int
140 toupper(c)
141 	int c;
142 {
143         return((c & _CRMASK) ? ___tolower(c) : _CurrentRuneLocale->maplower[c]);
144 }
145