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 2014 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 "Jun 27, 2014"
  11   12  .SH NAME
  12      -ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower, isprint,
  13      -isspace, isupper, ispunct, isgraph, isxdigit \- character handling
       13 +ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower,
       14 +isprint, isspace, isupper, ispunct, isgraph, isxdigit, isalpha_l,
       15 +isalnum_l, isblank_l, iscntrl_l, isdigit_l, islower_l, isprint_l,
       16 +isspace_l, isupper_l, ispunct_l, isgraph_l \- character handling
  14   17  .SH SYNOPSIS
  15   18  .LP
  16   19  .nf
  17   20  #include <ctype.h>
  18   21  
  19   22  \fBint\fR \fBisalpha\fR(\fBint\fR \fIc\fR);
  20   23  .fi
  21      -
  22   24  .LP
  23   25  .nf
  24   26  \fBint\fR \fBisalnum\fR(\fBint\fR \fIc\fR);
  25   27  .fi
  26      -
  27   28  .LP
  28   29  .nf
  29   30  \fBint\fR \fBisascii\fR(\fBint\fR \fIc\fR);
  30   31  .fi
  31      -
  32   32  .LP
  33   33  .nf
  34   34  \fBint\fR \fBisblank\fR(\fBint\fR \fIc\fR);
  35   35  .fi
  36      -
  37   36  .LP
  38   37  .nf
  39   38  \fBint\fR \fBiscntrl\fR(\fBint\fR \fIc\fR);
  40   39  .fi
  41      -
  42   40  .LP
  43   41  .nf
  44   42  \fBint\fR \fBisdigit\fR(\fBint\fR \fIc\fR);
  45   43  .fi
  46      -
  47   44  .LP
  48   45  .nf
  49   46  \fBint\fR \fBisgraph\fR(\fBint\fR \fIc\fR);
  50   47  .fi
  51      -
  52   48  .LP
  53   49  .nf
  54   50  \fBint\fR \fBislower\fR(\fBint\fR \fIc\fR);
  55   51  .fi
  56      -
  57   52  .LP
  58   53  .nf
  59   54  \fBint\fR \fBisprint\fR(\fBint\fR \fIc\fR);
  60   55  .fi
  61      -
  62   56  .LP
  63   57  .nf
  64   58  \fBint\fR \fBispunct\fR(\fBint\fR \fIc\fR);
  65   59  .fi
  66      -
  67   60  .LP
  68   61  .nf
  69   62  \fBint\fR \fBisspace\fR(\fBint\fR \fIc\fR);
  70   63  .fi
  71      -
  72   64  .LP
  73   65  .nf
  74   66  \fBint\fR \fBisupper\fR(\fBint\fR \fIc\fR);
  75   67  .fi
  76      -
  77   68  .LP
  78   69  .nf
  79   70  \fBint\fR \fBisxdigit\fR(\fBint\fR \fIc\fR);
  80   71  .fi
  81      -
       72 +.LP
       73 +.nf
       74 +\fBint\fR \fBisalpha_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
       75 +.fi
       76 +.LP
       77 +.nf
       78 +\fBint\fR \fBisalnum_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
       79 +.fi
       80 +.LP
       81 +.nf
       82 +\fBint\fR \fBisblank_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
       83 +.fi
       84 +.LP
       85 +.nf
       86 +\fBint\fR \fBiscntrl_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
       87 +.fi
       88 +.LP
       89 +.nf
       90 +\fBint\fR \fBisdigit_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
       91 +.fi
       92 +.LP
       93 +.nf
       94 +\fBint\fR \fBisgraph_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
       95 +.fi
       96 +.LP
       97 +.nf
       98 +\fBint\fR \fBislower_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
       99 +.fi
      100 +.LP
      101 +.nf
      102 +\fBint\fR \fBisprint_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
      103 +.fi
      104 +.LP
      105 +.nf
      106 +\fBint\fR \fBispunct_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
      107 +.fi
      108 +.LP
      109 +.nf
      110 +\fBint\fR \fBisspace_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
      111 +.fi
      112 +.LP
      113 +.nf
      114 +\fBint\fR \fBisupper_l\fR(\fBint\fR \fIc\fR, \fBlocale_t\fR \fIloc\fR);
      115 +.fi
  82  116  .SH DESCRIPTION
  83      -.sp
  84  117  .LP
  85      -These macros classify character-coded integer values. Each is a predicate
  86      -returning non-zero for true, \fB0\fR for false. The behavior of these macros,
  87      -except \fBisascii()\fR, is affected by the current locale (see
  88      -\fBsetlocale\fR(3C)). To modify the behavior, change the \fBLC_TYPE\fR category
  89      -in  \fBsetlocale()\fR, that is, \fBsetlocale(\fR\fBLC_CTYPE\fR,
  90      -\fInewlocale\fR). In the "C" locale, or in a locale where character type
  91      -information is not defined, characters are classified according to the rules of
  92      -the \fBUS-ASCII\fR 7-bit coded character set.
  93      -.sp
      118 +These functions classify character-coded integer values. Each is a
      119 +predicate returning non-zero for true, \fB0\fR for false. The behavior
      120 +of these macros, except \fBisascii()\fR, is affected by the current
      121 +locale (see \fBsetlocale\fR(3C) and \fBuselocale\fR(3C)). To modify
      122 +the behavior, change the \fBLC_TYPE\fR category in \fBsetlocale()\fR, that is,
      123 +\fBsetlocale(\fR\fBLC_CTYPE\fR, \fInewlocale\fR). In the "C" locale,
      124 +or in a locale where character type information is not defined,
      125 +characters are classified according to the rules of the \fBUS-ASCII\fR
      126 +7-bit coded character set.
  94  127  .LP
      128 +The functions \fBisalnum_l()\fR, \fBisalpha_l()\fR, \fBisblank_l()\fR,
      129 +\fBiscntrl_l\fR, \fBisdigit_l()\fR, \fBislower_l()\fR,
      130 +\fBisprint_l()\fR, \fBispunct_l()\fR, \fBisspace_l()\fR,
      131 +\fBisupper_l()\fR, all behave identically to their counterparts without
      132 +the '\fB_l\fR' prefix, except that instead of acting on the current
      133 +locale, that perform the test on the locale specified in the argument
      134 +\fIloc\fR.
      135 +.LP
  95  136  The \fBisascii()\fR macro is defined on all integer values. The rest are
  96  137  defined only where the argument is an \fBint\fR, the value of which is
  97  138  representable as an \fBunsigned char\fR, or \fBEOF\fR, which is defined by the
  98  139  <\fBstdio.h\fR> header and represents end-of-file.
  99  140  .sp
 100      -.LP
 101      -Functions exist for all the macros defined below. To get the function form, the
 102      -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  141  .ne 2
 112  142  .na
 113  143  \fB\fBisalpha()\fR\fR
 114  144  .ad
 115  145  .RS 13n
 116      -Tests for any character for which \fBisupper()\fR or \fBislower()\fR is true.
 117      -.RE
 118      -
 119      -.SS "Standard conforming"
 120      -.sp
 121      -.ne 2
 122      -.na
 123      -\fB\fBisalpha()\fR\fR
 124      -.ad
 125      -.RS 13n
 126  146  Tests for any character for which \fBisupper()\fR or \fBislower()\fR is true,
 127  147  or any character that is one of the current locale-defined set of characters
 128  148  for which none of \fBiscntrl()\fR, \fBisdigit()\fR, \fBispunct()\fR, or
 129  149  \fBisspace()\fR is true. In "C" locale, \fBisalpha()\fR returns true only for
 130  150  the characters for which \fBisupper()\fR or \fBislower()\fR is true.
 131  151  .RE
 132  152  
 133  153  .sp
 134  154  .ne 2
 135  155  .na
↓ open down ↓ 35 lines elided ↑ open up ↑
 171  191  
 172  192  .sp
 173  193  .ne 2
 174  194  .na
 175  195  \fB\fBisdigit()\fR\fR
 176  196  .ad
 177  197  .RS 13n
 178  198  Tests for any decimal-digit character.
 179  199  .RE
 180  200  
 181      -.SS "Default"
 182  201  .sp
 183  202  .ne 2
 184  203  .na
 185  204  \fB\fBisgraph()\fR\fR
 186  205  .ad
 187  206  .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  207  Tests for any character for which \fBisalnum()\fR and \fBispunct()\fR are true,
 200  208  or any character in the current locale-defined "graph" class which is neither a
 201  209  space ("\|") nor a character for which \fBiscntrl()\fR is true.
 202  210  .RE
 203  211  
 204  212  .sp
 205  213  .ne 2
 206  214  .na
 207  215  \fB\fBislower()\fR\fR
 208  216  .ad
 209  217  .RS 13n
 210  218  Tests for any character that is a lower-case letter or is one of the current
 211  219  locale-defined set of characters for which none of \fBiscntrl()\fR,
 212  220  \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBisupper()\fR is true.
 213  221  In the "C" locale, \fBislower()\fR returns true only for the characters defined
 214  222  as lower-case \fBASCII\fR characters.
 215  223  .RE
 216  224  
 217      -.SS "Default"
 218  225  .sp
 219  226  .ne 2
 220  227  .na
 221  228  \fB\fBisprint()\fR\fR
 222  229  .ad
 223  230  .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  231  Tests for any character for which \fBiscntrl()\fR is false, and
 236  232  \fBisalnum()\fR, \fBisgraph()\fR, \fBispunct()\fR, the space character ("\|"),
 237  233  and the characters in the current locale-defined "print" class are true.
 238  234  .RE
 239  235  
 240  236  .sp
 241  237  .ne 2
 242  238  .na
 243  239  \fB\fBispunct()\fR\fR
 244  240  .ad
↓ open down ↓ 20 lines elided ↑ open up ↑
 265  261  \fB\fBisupper()\fR\fR
 266  262  .ad
 267  263  .RS 13n
 268  264  Tests for any character that is an upper-case letter or is one of the current
 269  265  locale-defined set of characters for which none of \fBiscntrl()\fR,
 270  266  \fBisdigit()\fR, \fBispunct()\fR, \fBisspace()\fR, or \fBislower()\fR is true.
 271  267  In the "C" locale, \fBisupper()\fR returns true only for the characters defined
 272  268  as upper-case \fBASCII\fR characters.
 273  269  .RE
 274  270  
 275      -.SS "Default"
 276  271  .sp
 277  272  .ne 2
 278  273  .na
 279  274  \fB\fBisxdigit()\fR\fR
 280  275  .ad
 281  276  .RS 14n
 282  277  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      -.na
 290      -\fB\fBisxdigit()\fR\fR
 291      -.ad
 292      -.RS 14n
 293      -Tests for any hexadecimal-digit character (\fB[0\(mi9]\fR, \fB[A\(miF]\fR, or
 294  278  \fB[a\(mif]\fR or the current locale-defined sets of characters representing
 295  279  the hexadecimal digits \fB10\fR to \fB15\fR inclusive). In the "C" locale, only
 296  280  .sp
 297  281  .in +2
 298  282  .nf
 299  283  0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
 300  284  .fi
 301  285  .in -2
 302  286  
 303  287  are included.
 304  288  .RE
 305  289  
 306  290  .SH RETURN VALUES
 307      -.sp
 308  291  .LP
 309  292  If the argument to any of the character handling macros is not in the domain of
 310  293  the function, the result is undefined. Otherwise, the macro or function returns
 311  294  non-zero if the classification is \fBTRUE\fR and \fB0\fR if the classification
 312  295  is \fBFALSE\fR.
 313      -.SH USAGE
 314      -.sp
 315      -.LP
 316      -These macros or functions can be used safely in multithreaded applications, as
 317      -long as \fBsetlocale\fR(3C) is not being called to change the locale.
 318  296  .SH ATTRIBUTES
 319  297  .sp
 320  298  .LP
 321  299  See \fBattributes\fR(5) for descriptions of the following attributes:
 322      -.sp
 323      -
 324      -.sp
 325  300  .TS
 326  301  box;
 327      -l l
 328      -l l .
      302 +c | c
      303 +l | l .
 329  304  ATTRIBUTE TYPE  ATTRIBUTE VALUE
      305 +_
 330  306  CSI     Enabled
      307 +_
 331  308  Interface Stability     Standard
 332      -MT-Level        MT-Safe with exceptions
      309 +_
      310 +MT-Level        MT-Safe
 333  311  .TE
 334  312  
 335  313  .SH SEE ALSO
 336      -.sp
 337  314  .LP
 338      -\fBsetlocale\fR(3C), \fBstdio\fR(3C), \fBascii\fR(5), \fBenviron\fR(5),
      315 +\fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBuselocale\fR(3C),
      316 +\fBstdio\fR(3C), \fBascii\fR(5), \fBenviron\fR(5),
 339  317  \fBstandards\fR(5)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX