Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: TBD
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/ctype.3c
+++ new/usr/src/man/man3c/ctype.3c
1 1 '\" te
2 +.\" Copyright 2013 Garrett D'Amore <garrett@damore.org>
2 3 .\" Copyright 1989 AT&T. Copyright (c) 1992, X/Open Company Limited All Rights Reserved. Portions Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
3 4 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 5 .\" http://www.opengroup.org/bookstore/.
5 6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 7 .\" This notice shall appear on any product containing this material.
7 8 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 10 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 -.TH CTYPE 3C "Jan 28, 2005"
11 +.TH CTYPE 3C "Sep 18, 2013"
11 12 .SH NAME
12 13 ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower, isprint,
13 14 isspace, isupper, ispunct, isgraph, isxdigit \- character handling
14 15 .SH SYNOPSIS
15 16 .LP
16 17 .nf
17 18 #include <ctype.h>
18 19
19 20 \fBint\fR \fBisalpha\fR(\fBint\fR \fIc\fR);
20 21 .fi
21 22
22 23 .LP
23 24 .nf
24 25 \fBint\fR \fBisalnum\fR(\fBint\fR \fIc\fR);
25 26 .fi
26 27
27 28 .LP
28 29 .nf
29 30 \fBint\fR \fBisascii\fR(\fBint\fR \fIc\fR);
30 31 .fi
31 32
32 33 .LP
33 34 .nf
34 35 \fBint\fR \fBisblank\fR(\fBint\fR \fIc\fR);
35 36 .fi
36 37
37 38 .LP
38 39 .nf
39 40 \fBint\fR \fBiscntrl\fR(\fBint\fR \fIc\fR);
40 41 .fi
41 42
42 43 .LP
43 44 .nf
44 45 \fBint\fR \fBisdigit\fR(\fBint\fR \fIc\fR);
45 46 .fi
46 47
47 48 .LP
48 49 .nf
49 50 \fBint\fR \fBisgraph\fR(\fBint\fR \fIc\fR);
50 51 .fi
51 52
52 53 .LP
53 54 .nf
54 55 \fBint\fR \fBislower\fR(\fBint\fR \fIc\fR);
55 56 .fi
56 57
57 58 .LP
58 59 .nf
59 60 \fBint\fR \fBisprint\fR(\fBint\fR \fIc\fR);
60 61 .fi
61 62
62 63 .LP
63 64 .nf
64 65 \fBint\fR \fBispunct\fR(\fBint\fR \fIc\fR);
65 66 .fi
66 67
67 68 .LP
68 69 .nf
69 70 \fBint\fR \fBisspace\fR(\fBint\fR \fIc\fR);
70 71 .fi
71 72
72 73 .LP
73 74 .nf
74 75 \fBint\fR \fBisupper\fR(\fBint\fR \fIc\fR);
75 76 .fi
76 77
77 78 .LP
78 79 .nf
79 80 \fBint\fR \fBisxdigit\fR(\fBint\fR \fIc\fR);
80 81 .fi
81 82
82 83 .SH DESCRIPTION
83 84 .sp
84 85 .LP
85 86 These macros classify character-coded integer values. Each is a predicate
86 87 returning non-zero for true, \fB0\fR for false. The behavior of these macros,
87 88 except \fBisascii()\fR, is affected by the current locale (see
88 89 \fBsetlocale\fR(3C)). To modify the behavior, change the \fBLC_TYPE\fR category
89 90 in \fBsetlocale()\fR, that is, \fBsetlocale(\fR\fBLC_CTYPE\fR,
90 91 \fInewlocale\fR). In the "C" locale, or in a locale where character type
91 92 information is not defined, characters are classified according to the rules of
92 93 the \fBUS-ASCII\fR 7-bit coded character set.
↓ open down ↓ |
72 lines elided |
↑ open up ↑ |
93 94 .sp
94 95 .LP
95 96 The \fBisascii()\fR macro is defined on all integer values. The rest are
96 97 defined only where the argument is an \fBint\fR, the value of which is
97 98 representable as an \fBunsigned char\fR, or \fBEOF\fR, which is defined by the
98 99 <\fBstdio.h\fR> header and represents end-of-file.
99 100 .sp
100 101 .LP
101 102 Functions exist for all the macros defined below. To get the function form, the
102 103 macro name must be undefined (for example, \fB#undef isdigit\fR).
103 -.sp
104 -.LP
105 -For macros described with \fBDefault\fR and \fBStandard conforming\fR versions,
106 -standard-conforming behavior is provided for standard-conforming applications
107 -(see \fBstandards\fR(5)) and for applications that define
108 -\fB__XPG4_CHAR_CLASS__\fR before including <\fBctype.h\fR>.
109 -.SS "Default"
110 -.sp
111 -.ne 2
112 -.na
113 -\fB\fBisalpha()\fR\fR
114 -.ad
115 -.RS 13n
116 -Tests for any character for which \fBisupper()\fR or \fBislower()\fR is true.
117 -.RE
118 104
119 -.SS "Standard conforming"
120 105 .sp
121 106 .ne 2
122 107 .na
123 108 \fB\fBisalpha()\fR\fR
124 109 .ad
125 110 .RS 13n
126 111 Tests for any character for which \fBisupper()\fR or \fBislower()\fR is true,
127 112 or any character that is one of the current locale-defined set of characters
128 113 for which none of \fBiscntrl()\fR, \fBisdigit()\fR, \fBispunct()\fR, or
129 114 \fBisspace()\fR is true. In "C" locale, \fBisalpha()\fR returns true only for
130 115 the characters for which \fBisupper()\fR or \fBislower()\fR is true.
131 116 .RE
132 117
133 118 .sp
134 119 .ne 2
135 120 .na
136 121 \fB\fBisalnum()\fR\fR
137 122 .ad
138 123 .RS 13n
139 124 Tests for any character for which \fBisalpha()\fR or \fBisdigit()\fR is true
140 125 (letter or digit).
141 126 .RE
142 127
143 128 .sp
144 129 .ne 2
145 130 .na
146 131 \fB\fBisascii()\fR\fR
147 132 .ad
148 133 .RS 13n
149 134 Tests for any ASCII character, code between \fB0\fR and \fB0177\fR inclusive.
150 135 .RE
151 136
152 137 .sp
153 138 .ne 2
154 139 .na
155 140 \fB\fBisblank()\fR\fR
156 141 .ad
157 142 .RS 13n
158 143 Tests whether \fIc\fR is a character of class blank in the current locale. This
159 144 macro/function is not available to applications conforming to standards prior
160 145 to SUSv3. See \fBstandards\fR(5)
161 146 .RE
162 147
163 148 .sp
164 149 .ne 2
165 150 .na
166 151 \fB\fBiscntrl()\fR\fR
167 152 .ad
168 153 .RS 13n
169 154 Tests for any ``control character'' as defined by the character set.
170 155 .RE
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
171 156
172 157 .sp
173 158 .ne 2
174 159 .na
175 160 \fB\fBisdigit()\fR\fR
176 161 .ad
177 162 .RS 13n
178 163 Tests for any decimal-digit character.
179 164 .RE
180 165
181 -.SS "Default"
182 166 .sp
183 167 .ne 2
184 168 .na
185 169 \fB\fBisgraph()\fR\fR
186 170 .ad
187 171 .RS 13n
188 -Tests for any character for which \fBispunct()\fR, \fBisupper()\fR,
189 -\fBislower()\fR, and \fBisdigit()\fR is true.
190 -.RE
191 -
192 -.SS "Standard conforming"
193 -.sp
194 -.ne 2
195 -.na
196 -\fB\fBisgraph()\fR\fR
197 -.ad
198 -.RS 13n
199 172 Tests for any character for which \fBisalnum()\fR and \fBispunct()\fR are true,
200 173 or any character in the current locale-defined "graph" class which is neither a
201 174 space ("\|") nor a character for which \fBiscntrl()\fR is true.
202 175 .RE
203 176
204 177 .sp
205 178 .ne 2
206 179 .na
207 180 \fB\fBislower()\fR\fR
208 181 .ad
209 182 .RS 13n
210 183 Tests for any character that is a lower-case letter or is one of the current
211 184 locale-defined set of characters for which none of \fBiscntrl()\fR,
212 185 \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBisupper()\fR is true.
213 186 In the "C" locale, \fBislower()\fR returns true only for the characters defined
214 187 as lower-case \fBASCII\fR characters.
215 188 .RE
216 189
217 -.SS "Default"
218 190 .sp
219 191 .ne 2
220 192 .na
221 193 \fB\fBisprint()\fR\fR
222 194 .ad
223 195 .RS 13n
224 -Tests for any character for which \fBispunct()\fR, \fBisupper()\fR,
225 -\fBislower()\fR, \fBisdigit()\fR, and the space character ("\|") is true.
226 -.RE
227 -
228 -.SS "Standard conforming"
229 -.sp
230 -.ne 2
231 -.na
232 -\fB\fBisprint()\fR\fR
233 -.ad
234 -.RS 13n
235 196 Tests for any character for which \fBiscntrl()\fR is false, and
236 197 \fBisalnum()\fR, \fBisgraph()\fR, \fBispunct()\fR, the space character ("\|"),
237 198 and the characters in the current locale-defined "print" class are true.
238 199 .RE
239 200
240 201 .sp
241 202 .ne 2
242 203 .na
243 204 \fB\fBispunct()\fR\fR
244 205 .ad
245 206 .RS 13n
246 207 Tests for any printing character which is neither a space ("\|") nor a
247 208 character for which \fBisalnum()\fR or \fBiscntrl()\fR is true.
248 209 .RE
249 210
250 211 .sp
251 212 .ne 2
252 213 .na
253 214 \fB\fBisspace()\fR\fR
254 215 .ad
255 216 .RS 13n
256 217 Tests for any space, tab, carriage-return, newline, vertical-tab or form-feed
257 218 (standard white-space characters) or for one of the current locale-defined set
258 219 of characters for which \fBisalnum()\fR is false. In the "C" locale,
259 220 \fBisspace()\fR returns true only for the standard white-space characters.
260 221 .RE
261 222
262 223 .sp
263 224 .ne 2
264 225 .na
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
265 226 \fB\fBisupper()\fR\fR
266 227 .ad
267 228 .RS 13n
268 229 Tests for any character that is an upper-case letter or is one of the current
269 230 locale-defined set of characters for which none of \fBiscntrl()\fR,
270 231 \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBislower()\fR is true.
271 232 In the "C" locale, \fBisupper()\fR returns true only for the characters defined
272 233 as upper-case \fBASCII\fR characters.
273 234 .RE
274 235
275 -.SS "Default"
276 236 .sp
277 237 .ne 2
278 -.na
279 -\fB\fBisxdigit()\fR\fR
280 -.ad
281 -.RS 14n
282 -Tests for any hexadecimal-digit character (\fB[0\(mi9]\fR, \fB[A\(miF]\fR, or
283 -\fB[a\(mif]\fR).
284 -.RE
285 -
286 -.SS "Standard conforming"
287 -.sp
288 -.ne 2
289 238 .na
290 239 \fB\fBisxdigit()\fR\fR
291 240 .ad
292 241 .RS 14n
293 242 Tests for any hexadecimal-digit character (\fB[0\(mi9]\fR, \fB[A\(miF]\fR, or
294 243 \fB[a\(mif]\fR or the current locale-defined sets of characters representing
295 244 the hexadecimal digits \fB10\fR to \fB15\fR inclusive). In the "C" locale, only
296 245 .sp
297 246 .in +2
298 247 .nf
299 248 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
300 249 .fi
301 250 .in -2
302 251
303 252 are included.
304 253 .RE
305 254
306 255 .SH RETURN VALUES
307 256 .sp
308 257 .LP
309 258 If the argument to any of the character handling macros is not in the domain of
310 259 the function, the result is undefined. Otherwise, the macro or function returns
311 260 non-zero if the classification is \fBTRUE\fR and \fB0\fR if the classification
312 261 is \fBFALSE\fR.
313 262 .SH USAGE
314 263 .sp
315 264 .LP
316 265 These macros or functions can be used safely in multithreaded applications, as
317 266 long as \fBsetlocale\fR(3C) is not being called to change the locale.
318 267 .SH ATTRIBUTES
319 268 .sp
320 269 .LP
321 270 See \fBattributes\fR(5) for descriptions of the following attributes:
322 271 .sp
323 272
324 273 .sp
325 274 .TS
326 275 box;
327 276 l l
328 277 l l .
329 278 ATTRIBUTE TYPE ATTRIBUTE VALUE
330 279 CSI Enabled
331 280 Interface Stability Standard
332 281 MT-Level MT-Safe with exceptions
333 282 .TE
334 283
335 284 .SH SEE ALSO
336 285 .sp
337 286 .LP
338 287 \fBsetlocale\fR(3C), \fBstdio\fR(3C), \fBascii\fR(5), \fBenviron\fR(5),
339 288 \fBstandards\fR(5)
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX