xref: /original-bsd/lib/libc/locale/isctype.c (revision 7513c514)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)isctype.c	5.3 (Berkeley) 10/23/91";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #define _ANSI_LIBRARY
13 #include <ctype.h>
14 
15 #undef isalnum
16 isalnum(c)
17 	int c;
18 {
19 	return ((_ctype_ + 1)[c] & (_U|_L|_N));
20 }
21 
22 #undef isalpha
23 isalpha(c)
24 	int c;
25 {
26 	return ((_ctype_ + 1)[c] & (_U|_L));
27 }
28 
29 #undef isblank
30 isblank(c)
31 	int c;
32 {
33 	return (c == '\t' || c == ' ');
34 }
35 
36 #undef iscntrl
37 iscntrl(c)
38 	int c;
39 {
40 	return ((_ctype_ + 1)[c] & _C);
41 }
42 
43 #undef isdigit
44 isdigit(c)
45 	int c;
46 {
47 	return ((_ctype_ + 1)[c] & _N);
48 }
49 
50 #undef isgraph
51 isgraph(c)
52 	int c;
53 {
54 	return ((_ctype_ + 1)[c] & (_P|_U|_L|_N));
55 }
56 
57 #undef islower
58 islower(c)
59 	int c;
60 {
61 	return ((_ctype_ + 1)[c] & _L);
62 }
63 
64 #undef isprint
65 isprint(c)
66 	int c;
67 {
68 	return ((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B));
69 }
70 
71 #undef ispunct
72 ispunct(c)
73 	int c;
74 {
75 	return ((_ctype_ + 1)[c] & _P);
76 }
77 
78 #undef isspace
79 isspace(c)
80 	int c;
81 {
82 	return ((_ctype_ + 1)[c] & _S);
83 }
84 
85 #undef isupper
86 isupper(c)
87 	int c;
88 {
89 	return ((_ctype_ + 1)[c] & _U);
90 }
91 
92 #undef isxdigit
93 isxdigit(c)
94 	int c;
95 {
96 	return ((_ctype_ + 1)[c] & (_N|_X));
97 }
98 
99 #undef tolower
100 tolower(c)
101 	int c;
102 {
103 	return ((c) - 'A' + 'a');
104 }
105 
106 #undef toupper
107 toupper(c)
108 	int c;
109 {
110 	return ((c) - 'a' + 'A');
111 }
112