Commit | Line | Data |
---|---|---|
c2714ef5 | 1 | /* |
2 | * Copyright (c) UNIX System Laboratories, Inc. All or some portions | |
3 | * of this file are derived from material licensed to the | |
4 | * University of California by American Telephone and Telegraph Co. | |
5 | * or UNIX System Laboratories, Inc. and are reproduced herein with | |
6 | * the permission of UNIX System Laboratories, Inc. | |
7 | * | |
8 | * $Id$ | |
9 | */ | |
15637ed4 RG |
10 | /* |
11 | * Copyright (c) 1989 The Regents of the University of California. | |
12 | * All rights reserved. | |
13 | * | |
14 | * Redistribution and use in source and binary forms, with or without | |
15 | * modification, are permitted provided that the following conditions | |
16 | * are met: | |
17 | * 1. Redistributions of source code must retain the above copyright | |
18 | * notice, this list of conditions and the following disclaimer. | |
19 | * 2. Redistributions in binary form must reproduce the above copyright | |
20 | * notice, this list of conditions and the following disclaimer in the | |
21 | * documentation and/or other materials provided with the distribution. | |
22 | * 3. All advertising materials mentioning features or use of this software | |
23 | * must display the following acknowledgement: | |
24 | * This product includes software developed by the University of | |
25 | * California, Berkeley and its contributors. | |
26 | * 4. Neither the name of the University nor the names of its contributors | |
27 | * may be used to endorse or promote products derived from this software | |
28 | * without specific prior written permission. | |
29 | * | |
30 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
32 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
33 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
34 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
35 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
36 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
37 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
39 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
40 | * SUCH DAMAGE. | |
41 | * | |
15637ed4 RG |
42 | */ |
43 | ||
44 | #if defined(LIBC_SCCS) && !defined(lint) | |
45 | static char sccsid[] = "@(#)isctype.c 5.2 (Berkeley) 6/1/90"; | |
46 | #endif /* LIBC_SCCS and not lint */ | |
47 | ||
48 | #define _ANSI_LIBRARY | |
49 | #include <ctype.h> | |
50 | ||
51 | #undef isalnum | |
52 | isalnum(c) | |
53 | int c; | |
54 | { | |
55 | return((_ctype_ + 1)[c] & (_U|_L|_N)); | |
56 | } | |
57 | ||
58 | #undef isalpha | |
59 | isalpha(c) | |
60 | int c; | |
61 | { | |
62 | return((_ctype_ + 1)[c] & (_U|_L)); | |
63 | } | |
64 | ||
65 | #undef iscntrl | |
66 | iscntrl(c) | |
67 | int c; | |
68 | { | |
69 | return((_ctype_ + 1)[c] & _C); | |
70 | } | |
71 | ||
72 | #undef isdigit | |
73 | isdigit(c) | |
74 | int c; | |
75 | { | |
76 | return((_ctype_ + 1)[c] & _N); | |
77 | } | |
78 | ||
79 | #undef isgraph | |
80 | isgraph(c) | |
81 | int c; | |
82 | { | |
83 | return((_ctype_ + 1)[c] & (_P|_U|_L|_N)); | |
84 | } | |
85 | ||
86 | #undef islower | |
87 | islower(c) | |
88 | int c; | |
89 | { | |
90 | return((_ctype_ + 1)[c] & _L); | |
91 | } | |
92 | ||
93 | #undef isprint | |
94 | isprint(c) | |
95 | int c; | |
96 | { | |
97 | return((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B)); | |
98 | } | |
99 | ||
100 | #undef ispunct | |
101 | ispunct(c) | |
102 | int c; | |
103 | { | |
104 | return((_ctype_ + 1)[c] & _P); | |
105 | } | |
106 | ||
107 | #undef isspace | |
108 | isspace(c) | |
109 | int c; | |
110 | { | |
111 | return((_ctype_ + 1)[c] & _S); | |
112 | } | |
113 | ||
114 | #undef isupper | |
115 | isupper(c) | |
116 | int c; | |
117 | { | |
118 | return((_ctype_ + 1)[c] & _U); | |
119 | } | |
120 | ||
121 | #undef isxdigit | |
122 | isxdigit(c) | |
123 | int c; | |
124 | { | |
125 | return((_ctype_ + 1)[c] & (_N|_X)); | |
126 | } | |
127 | ||
128 | #undef tolower | |
129 | tolower(c) | |
130 | int c; | |
131 | { | |
132 | /* was: return((c) - 'A' + 'a');*/ | |
133 | return ( isupper(c) ? c - 'A' + 'a' : c); | |
134 | } | |
135 | ||
136 | #undef toupper | |
137 | toupper(c) | |
138 | int c; | |
139 | { | |
140 | /* was: return((c) - 'a' + 'A');*/ | |
141 | return ( islower(c) ? c - 'a' + 'A' : c); | |
142 | } |