1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2010 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 /*
  17  * This file contains the implementation of various functional forms
  18  * of the ctype tests, specifically the required by ISO C.  These are defined
  19  * in the "C" (POSIX) locale.
  20  */
  21 
  22 #include "lint.h"
  23 #include <ctype.h>
  24 
  25 /*
  26  * We are supplying functional forms, so make sure to suppress any macros
  27  * we might have imported.
  28  */
  29 
  30 #ifdef isblank
  31 #undef isblank
  32 #endif
  33 
  34 int
  35 isblank(int c)
  36 {
  37         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISBLANK));
  38 }
  39 
  40 #ifdef isupper
  41 #undef isupper
  42 #endif
  43 
  44 int
  45 isupper(int c)
  46 {
  47         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISUPPER));
  48 }
  49 
  50 #ifdef islower
  51 #undef islower
  52 #endif
  53 
  54 int
  55 islower(int c)
  56 {
  57         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISLOWER));
  58 }
  59 
  60 #ifdef isdigit
  61 #undef isdigit
  62 #endif
  63 
  64 int
  65 isdigit(int c)
  66 {
  67         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISDIGIT));
  68 }
  69 
  70 #ifdef isxdigit
  71 #undef isxdigit
  72 #endif
  73 
  74 int
  75 isxdigit(int c)
  76 {
  77         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISXDIGIT));
  78 }
  79 
  80 #ifdef isalpha
  81 #undef isalpha
  82 #endif
  83 
  84 int
  85 isalpha(int c)
  86 {
  87         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISALPHA));
  88 }
  89 
  90 #ifdef isalnum
  91 #undef isalnum
  92 #endif
  93 
  94 int
  95 isalnum(int c)
  96 {
  97         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISALNUM));
  98 }
  99 
 100 #ifdef isspace
 101 #undef isspace
 102 #endif
 103 
 104 int
 105 isspace(int c)
 106 {
 107         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISSPACE));
 108 }
 109 
 110 #ifdef iscntrl
 111 #undef iscntrl
 112 #endif
 113 
 114 int
 115 iscntrl(int c)
 116 {
 117         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISCNTRL));
 118 }
 119 
 120 #ifdef isgraph
 121 #undef isgraph
 122 #endif
 123 
 124 int
 125 isgraph(int c)
 126 {
 127         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISGRAPH));
 128 }
 129 
 130 #ifdef ispunct
 131 #undef ispunct
 132 #endif
 133 
 134 int
 135 ispunct(int c)
 136 {
 137         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISPUNCT));
 138 }
 139 
 140 #ifdef isprint
 141 #undef isprint
 142 #endif
 143 
 144 int
 145 isprint(int c)
 146 {
 147         return (((unsigned)c > 255) ? 0 : (__ctype_mask[c] & _ISPRINT));
 148 }