xref: /original-bsd/lib/libc/locale/isctype.c (revision 18e85294)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  */
17 
18 #if defined(LIBC_SCCS) && !defined(lint)
19 static char sccsid[] = "@(#)isctype.c	5.1 (Berkeley) 05/27/89";
20 #endif /* LIBC_SCCS and not lint */
21 
22 #define _ANSI_LIBRARY
23 #include <ctype.h>
24 
25 #undef isalnum
26 isalnum(c)
27 	int c;
28 {
29 	return((_ctype_ + 1)[c] & (_U|_L|_N));
30 }
31 
32 #undef isalpha
33 isalpha(c)
34 	int c;
35 {
36 	return((_ctype_ + 1)[c] & (_U|_L));
37 }
38 
39 #undef iscntrl
40 iscntrl(c)
41 	int c;
42 {
43 	return((_ctype_ + 1)[c] & _C);
44 }
45 
46 #undef isdigit
47 isdigit(c)
48 	int c;
49 {
50 	return((_ctype_ + 1)[c] & _N);
51 }
52 
53 #undef isgraph
54 isgraph(c)
55 	int c;
56 {
57 	return((_ctype_ + 1)[c] & (_P|_U|_L|_N));
58 }
59 
60 #undef islower
61 islower(c)
62 	int c;
63 {
64 	return((_ctype_ + 1)[c] & _L);
65 }
66 
67 #undef isprint
68 isprint(c)
69 	int c;
70 {
71 	return((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B));
72 }
73 
74 #undef ispunct
75 ispunct(c)
76 	int c;
77 {
78 	return((_ctype_ + 1)[c] & _P);
79 }
80 
81 #undef isspace
82 isspace(c)
83 	int c;
84 {
85 	return((_ctype_ + 1)[c] & _S);
86 }
87 
88 #undef isupper
89 isupper(c)
90 	int c;
91 {
92 	return((_ctype_ + 1)[c] & _U);
93 }
94 
95 #undef isxdigit
96 isxdigit(c)
97 	int c;
98 {
99 	return((_ctype_ + 1)[c] & (_N|_X));
100 }
101 
102 #undef tolower
103 tolower(c)
104 	int c;
105 {
106 	return((c) - 'A' + 'a');
107 }
108 
109 #undef toupper
110 toupper(c)
111 	int c;
112 {
113 	return((c) - 'a' + 'A');
114 }
115