diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/acl-internal.c | 2 | ||||
| -rw-r--r-- | lib/acl-internal.h | 2 | ||||
| -rw-r--r-- | lib/c-ctype.c | 394 | ||||
| -rw-r--r-- | lib/c-ctype.h | 850 | ||||
| -rw-r--r-- | lib/get-permissions.c | 2 | ||||
| -rw-r--r-- | lib/qcopy-acl.c | 2 | ||||
| -rw-r--r-- | lib/set-permissions.c | 2 |
7 files changed, 677 insertions, 577 deletions
diff --git a/lib/acl-internal.c b/lib/acl-internal.c index 1eaa671bd37..c1b70176ac0 100644 --- a/lib/acl-internal.c +++ b/lib/acl-internal.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Test whether a file has a nontrivial access control list. | 1 | /* Test whether a file has a nontrivial ACL. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/acl-internal.h b/lib/acl-internal.h index 38a4ab2eb3a..560d1464daa 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Internal implementation of access control lists. | 1 | /* Internal implementation of access control lists. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/c-ctype.c b/lib/c-ctype.c index 1fb5fe675e9..5d9d4d87a61 100644 --- a/lib/c-ctype.c +++ b/lib/c-ctype.c | |||
| @@ -1,395 +1,3 @@ | |||
| 1 | /* Character handling in C locale. | ||
| 2 | |||
| 3 | Copyright 2000-2003, 2006, 2009-2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software; you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | #include <config.h> | 1 | #include <config.h> |
| 19 | 2 | #define C_CTYPE_INLINE _GL_EXTERN_INLINE | |
| 20 | /* Specification. */ | ||
| 21 | #define NO_C_CTYPE_MACROS | ||
| 22 | #include "c-ctype.h" | 3 | #include "c-ctype.h" |
| 23 | |||
| 24 | /* The function isascii is not locale dependent. Its use in EBCDIC is | ||
| 25 | questionable. */ | ||
| 26 | bool | ||
| 27 | c_isascii (int c) | ||
| 28 | { | ||
| 29 | return (c >= 0x00 && c <= 0x7f); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool | ||
| 33 | c_isalnum (int c) | ||
| 34 | { | ||
| 35 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
| 36 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 37 | #if C_CTYPE_ASCII | ||
| 38 | return ((c >= '0' && c <= '9') | ||
| 39 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); | ||
| 40 | #else | ||
| 41 | return ((c >= '0' && c <= '9') | ||
| 42 | || (c >= 'A' && c <= 'Z') | ||
| 43 | || (c >= 'a' && c <= 'z')); | ||
| 44 | #endif | ||
| 45 | #else | ||
| 46 | switch (c) | ||
| 47 | { | ||
| 48 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 49 | case '6': case '7': case '8': case '9': | ||
| 50 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 51 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 52 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 53 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 54 | case 'Y': case 'Z': | ||
| 55 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 56 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 57 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 58 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 59 | case 'y': case 'z': | ||
| 60 | return 1; | ||
| 61 | default: | ||
| 62 | return 0; | ||
| 63 | } | ||
| 64 | #endif | ||
| 65 | } | ||
| 66 | |||
| 67 | bool | ||
| 68 | c_isalpha (int c) | ||
| 69 | { | ||
| 70 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 71 | #if C_CTYPE_ASCII | ||
| 72 | return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); | ||
| 73 | #else | ||
| 74 | return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); | ||
| 75 | #endif | ||
| 76 | #else | ||
| 77 | switch (c) | ||
| 78 | { | ||
| 79 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 80 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 81 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 82 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 83 | case 'Y': case 'Z': | ||
| 84 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 85 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 86 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 87 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 88 | case 'y': case 'z': | ||
| 89 | return 1; | ||
| 90 | default: | ||
| 91 | return 0; | ||
| 92 | } | ||
| 93 | #endif | ||
| 94 | } | ||
| 95 | |||
| 96 | bool | ||
| 97 | c_isblank (int c) | ||
| 98 | { | ||
| 99 | return (c == ' ' || c == '\t'); | ||
| 100 | } | ||
| 101 | |||
| 102 | bool | ||
| 103 | c_iscntrl (int c) | ||
| 104 | { | ||
| 105 | #if C_CTYPE_ASCII | ||
| 106 | return ((c & ~0x1f) == 0 || c == 0x7f); | ||
| 107 | #else | ||
| 108 | switch (c) | ||
| 109 | { | ||
| 110 | case ' ': case '!': case '"': case '#': case '$': case '%': | ||
| 111 | case '&': case '\'': case '(': case ')': case '*': case '+': | ||
| 112 | case ',': case '-': case '.': case '/': | ||
| 113 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 114 | case '6': case '7': case '8': case '9': | ||
| 115 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 116 | case '@': | ||
| 117 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 118 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 119 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 120 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 121 | case 'Y': case 'Z': | ||
| 122 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 123 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 124 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 125 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 126 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 127 | case 'y': case 'z': | ||
| 128 | case '{': case '|': case '}': case '~': | ||
| 129 | return 0; | ||
| 130 | default: | ||
| 131 | return 1; | ||
| 132 | } | ||
| 133 | #endif | ||
| 134 | } | ||
| 135 | |||
| 136 | bool | ||
| 137 | c_isdigit (int c) | ||
| 138 | { | ||
| 139 | #if C_CTYPE_CONSECUTIVE_DIGITS | ||
| 140 | return (c >= '0' && c <= '9'); | ||
| 141 | #else | ||
| 142 | switch (c) | ||
| 143 | { | ||
| 144 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 145 | case '6': case '7': case '8': case '9': | ||
| 146 | return 1; | ||
| 147 | default: | ||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | #endif | ||
| 151 | } | ||
| 152 | |||
| 153 | bool | ||
| 154 | c_islower (int c) | ||
| 155 | { | ||
| 156 | #if C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 157 | return (c >= 'a' && c <= 'z'); | ||
| 158 | #else | ||
| 159 | switch (c) | ||
| 160 | { | ||
| 161 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 162 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 163 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 164 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 165 | case 'y': case 'z': | ||
| 166 | return 1; | ||
| 167 | default: | ||
| 168 | return 0; | ||
| 169 | } | ||
| 170 | #endif | ||
| 171 | } | ||
| 172 | |||
| 173 | bool | ||
| 174 | c_isgraph (int c) | ||
| 175 | { | ||
| 176 | #if C_CTYPE_ASCII | ||
| 177 | return (c >= '!' && c <= '~'); | ||
| 178 | #else | ||
| 179 | switch (c) | ||
| 180 | { | ||
| 181 | case '!': case '"': case '#': case '$': case '%': case '&': | ||
| 182 | case '\'': case '(': case ')': case '*': case '+': case ',': | ||
| 183 | case '-': case '.': case '/': | ||
| 184 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 185 | case '6': case '7': case '8': case '9': | ||
| 186 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 187 | case '@': | ||
| 188 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 189 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 190 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 191 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 192 | case 'Y': case 'Z': | ||
| 193 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 194 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 195 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 196 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 197 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 198 | case 'y': case 'z': | ||
| 199 | case '{': case '|': case '}': case '~': | ||
| 200 | return 1; | ||
| 201 | default: | ||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | #endif | ||
| 205 | } | ||
| 206 | |||
| 207 | bool | ||
| 208 | c_isprint (int c) | ||
| 209 | { | ||
| 210 | #if C_CTYPE_ASCII | ||
| 211 | return (c >= ' ' && c <= '~'); | ||
| 212 | #else | ||
| 213 | switch (c) | ||
| 214 | { | ||
| 215 | case ' ': case '!': case '"': case '#': case '$': case '%': | ||
| 216 | case '&': case '\'': case '(': case ')': case '*': case '+': | ||
| 217 | case ',': case '-': case '.': case '/': | ||
| 218 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 219 | case '6': case '7': case '8': case '9': | ||
| 220 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 221 | case '@': | ||
| 222 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 223 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 224 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 225 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 226 | case 'Y': case 'Z': | ||
| 227 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 228 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 229 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 230 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 231 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 232 | case 'y': case 'z': | ||
| 233 | case '{': case '|': case '}': case '~': | ||
| 234 | return 1; | ||
| 235 | default: | ||
| 236 | return 0; | ||
| 237 | } | ||
| 238 | #endif | ||
| 239 | } | ||
| 240 | |||
| 241 | bool | ||
| 242 | c_ispunct (int c) | ||
| 243 | { | ||
| 244 | #if C_CTYPE_ASCII | ||
| 245 | return ((c >= '!' && c <= '~') | ||
| 246 | && !((c >= '0' && c <= '9') | ||
| 247 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); | ||
| 248 | #else | ||
| 249 | switch (c) | ||
| 250 | { | ||
| 251 | case '!': case '"': case '#': case '$': case '%': case '&': | ||
| 252 | case '\'': case '(': case ')': case '*': case '+': case ',': | ||
| 253 | case '-': case '.': case '/': | ||
| 254 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 255 | case '@': | ||
| 256 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 257 | case '{': case '|': case '}': case '~': | ||
| 258 | return 1; | ||
| 259 | default: | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | #endif | ||
| 263 | } | ||
| 264 | |||
| 265 | bool | ||
| 266 | c_isspace (int c) | ||
| 267 | { | ||
| 268 | return (c == ' ' || c == '\t' | ||
| 269 | || c == '\n' || c == '\v' || c == '\f' || c == '\r'); | ||
| 270 | } | ||
| 271 | |||
| 272 | bool | ||
| 273 | c_isupper (int c) | ||
| 274 | { | ||
| 275 | #if C_CTYPE_CONSECUTIVE_UPPERCASE | ||
| 276 | return (c >= 'A' && c <= 'Z'); | ||
| 277 | #else | ||
| 278 | switch (c) | ||
| 279 | { | ||
| 280 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 281 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 282 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 283 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 284 | case 'Y': case 'Z': | ||
| 285 | return 1; | ||
| 286 | default: | ||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | #endif | ||
| 290 | } | ||
| 291 | |||
| 292 | bool | ||
| 293 | c_isxdigit (int c) | ||
| 294 | { | ||
| 295 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
| 296 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 297 | #if C_CTYPE_ASCII | ||
| 298 | return ((c >= '0' && c <= '9') | ||
| 299 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); | ||
| 300 | #else | ||
| 301 | return ((c >= '0' && c <= '9') | ||
| 302 | || (c >= 'A' && c <= 'F') | ||
| 303 | || (c >= 'a' && c <= 'f')); | ||
| 304 | #endif | ||
| 305 | #else | ||
| 306 | switch (c) | ||
| 307 | { | ||
| 308 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 309 | case '6': case '7': case '8': case '9': | ||
| 310 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 311 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 312 | return 1; | ||
| 313 | default: | ||
| 314 | return 0; | ||
| 315 | } | ||
| 316 | #endif | ||
| 317 | } | ||
| 318 | |||
| 319 | int | ||
| 320 | c_tolower (int c) | ||
| 321 | { | ||
| 322 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 323 | return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); | ||
| 324 | #else | ||
| 325 | switch (c) | ||
| 326 | { | ||
| 327 | case 'A': return 'a'; | ||
| 328 | case 'B': return 'b'; | ||
| 329 | case 'C': return 'c'; | ||
| 330 | case 'D': return 'd'; | ||
| 331 | case 'E': return 'e'; | ||
| 332 | case 'F': return 'f'; | ||
| 333 | case 'G': return 'g'; | ||
| 334 | case 'H': return 'h'; | ||
| 335 | case 'I': return 'i'; | ||
| 336 | case 'J': return 'j'; | ||
| 337 | case 'K': return 'k'; | ||
| 338 | case 'L': return 'l'; | ||
| 339 | case 'M': return 'm'; | ||
| 340 | case 'N': return 'n'; | ||
| 341 | case 'O': return 'o'; | ||
| 342 | case 'P': return 'p'; | ||
| 343 | case 'Q': return 'q'; | ||
| 344 | case 'R': return 'r'; | ||
| 345 | case 'S': return 's'; | ||
| 346 | case 'T': return 't'; | ||
| 347 | case 'U': return 'u'; | ||
| 348 | case 'V': return 'v'; | ||
| 349 | case 'W': return 'w'; | ||
| 350 | case 'X': return 'x'; | ||
| 351 | case 'Y': return 'y'; | ||
| 352 | case 'Z': return 'z'; | ||
| 353 | default: return c; | ||
| 354 | } | ||
| 355 | #endif | ||
| 356 | } | ||
| 357 | |||
| 358 | int | ||
| 359 | c_toupper (int c) | ||
| 360 | { | ||
| 361 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 362 | return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); | ||
| 363 | #else | ||
| 364 | switch (c) | ||
| 365 | { | ||
| 366 | case 'a': return 'A'; | ||
| 367 | case 'b': return 'B'; | ||
| 368 | case 'c': return 'C'; | ||
| 369 | case 'd': return 'D'; | ||
| 370 | case 'e': return 'E'; | ||
| 371 | case 'f': return 'F'; | ||
| 372 | case 'g': return 'G'; | ||
| 373 | case 'h': return 'H'; | ||
| 374 | case 'i': return 'I'; | ||
| 375 | case 'j': return 'J'; | ||
| 376 | case 'k': return 'K'; | ||
| 377 | case 'l': return 'L'; | ||
| 378 | case 'm': return 'M'; | ||
| 379 | case 'n': return 'N'; | ||
| 380 | case 'o': return 'O'; | ||
| 381 | case 'p': return 'P'; | ||
| 382 | case 'q': return 'Q'; | ||
| 383 | case 'r': return 'R'; | ||
| 384 | case 's': return 'S'; | ||
| 385 | case 't': return 'T'; | ||
| 386 | case 'u': return 'U'; | ||
| 387 | case 'v': return 'V'; | ||
| 388 | case 'w': return 'W'; | ||
| 389 | case 'x': return 'X'; | ||
| 390 | case 'y': return 'Y'; | ||
| 391 | case 'z': return 'Z'; | ||
| 392 | default: return c; | ||
| 393 | } | ||
| 394 | #endif | ||
| 395 | } | ||
diff --git a/lib/c-ctype.h b/lib/c-ctype.h index 47644731782..50ebbb58293 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h | |||
| @@ -25,6 +25,13 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | 25 | ||
| 26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
| 27 | 27 | ||
| 28 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
| 29 | #error "Please include config.h first." | ||
| 30 | #endif | ||
| 31 | _GL_INLINE_HEADER_BEGIN | ||
| 32 | #ifndef C_CTYPE_INLINE | ||
| 33 | # define C_CTYPE_INLINE _GL_INLINE | ||
| 34 | #endif | ||
| 28 | 35 | ||
| 29 | #ifdef __cplusplus | 36 | #ifdef __cplusplus |
| 30 | extern "C" { | 37 | extern "C" { |
| @@ -39,38 +46,6 @@ extern "C" { | |||
| 39 | characters. */ | 46 | characters. */ |
| 40 | 47 | ||
| 41 | 48 | ||
| 42 | /* Check whether the ASCII optimizations apply. */ | ||
| 43 | |||
| 44 | /* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that | ||
| 45 | '0', '1', ..., '9' have consecutive integer values. */ | ||
| 46 | #define C_CTYPE_CONSECUTIVE_DIGITS 1 | ||
| 47 | |||
| 48 | #if ('A' <= 'Z') \ | ||
| 49 | && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ | ||
| 50 | && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ | ||
| 51 | && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ | ||
| 52 | && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ | ||
| 53 | && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ | ||
| 54 | && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ | ||
| 55 | && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ | ||
| 56 | && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ | ||
| 57 | && ('Y' + 1 == 'Z') | ||
| 58 | #define C_CTYPE_CONSECUTIVE_UPPERCASE 1 | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if ('a' <= 'z') \ | ||
| 62 | && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ | ||
| 63 | && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ | ||
| 64 | && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ | ||
| 65 | && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ | ||
| 66 | && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ | ||
| 67 | && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ | ||
| 68 | && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ | ||
| 69 | && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ | ||
| 70 | && ('y' + 1 == 'z') | ||
| 71 | #define C_CTYPE_CONSECUTIVE_LOWERCASE 1 | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 49 | #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
| 75 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | 50 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ |
| 76 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | 51 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ |
| @@ -96,11 +71,99 @@ extern "C" { | |||
| 96 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) | 71 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) |
| 97 | /* The character set is ASCII or one of its variants or extensions, not EBCDIC. | 72 | /* The character set is ASCII or one of its variants or extensions, not EBCDIC. |
| 98 | Testing the value of '\n' and '\r' is not relevant. */ | 73 | Testing the value of '\n' and '\r' is not relevant. */ |
| 99 | #define C_CTYPE_ASCII 1 | 74 | # define C_CTYPE_ASCII 1 |
| 75 | #elif ! (' ' == '\x40' && '0' == '\xf0' \ | ||
| 76 | && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \ | ||
| 77 | && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2') | ||
| 78 | # error "Only ASCII and EBCDIC are supported" | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #define _C_CTYPE_SIGNED_EBCDIC ('A' < 0) | ||
| 82 | |||
| 83 | #if C_CTYPE_ASCII | ||
| 84 | # define _C_CTYPE_CNTRL \ | ||
| 85 | case '\x00': case '\x01': case '\x02': case '\x03': \ | ||
| 86 | case '\x04': case '\x05': case '\x06': case '\x07': \ | ||
| 87 | case '\x08': case '\x09': case '\x0a': case '\x0b': \ | ||
| 88 | case '\x0c': case '\x0d': case '\x0e': case '\x0f': \ | ||
| 89 | case '\x10': case '\x11': case '\x12': case '\x13': \ | ||
| 90 | case '\x14': case '\x15': case '\x16': case '\x17': \ | ||
| 91 | case '\x18': case '\x19': case '\x1a': case '\x1b': \ | ||
| 92 | case '\x1c': case '\x1d': case '\x1e': case '\x1f': \ | ||
| 93 | case '\x7f' | ||
| 94 | #else | ||
| 95 | /* Use EBCDIC code page 1047's assignments for ASCII control chars; | ||
| 96 | assume all EBCDIC code pages agree about these assignments. */ | ||
| 97 | # define _C_CTYPE_CNTRL \ | ||
| 98 | case '\x00': case '\x01': case '\x02': case '\x03': \ | ||
| 99 | case '\x05': case '\x07': case '\x0b': case '\x0c': \ | ||
| 100 | case '\x0d': case '\x0e': case '\x0f': case '\x10': \ | ||
| 101 | case '\x11': case '\x12': case '\x13': case '\x16': \ | ||
| 102 | case '\x18': case '\x19': case '\x1c': case '\x1d': \ | ||
| 103 | case '\x1e': case '\x1f': case '\x25': case '\x26': \ | ||
| 104 | case '\x27': case '\x2d': case '\x2e': case '\x2f': \ | ||
| 105 | case '\x32': case '\x37': case '\x3c': case '\x3d': \ | ||
| 106 | case '\x3f' | ||
| 100 | #endif | 107 | #endif |
| 101 | 108 | ||
| 109 | /* Cases for hex letter digits, digits, lower, and upper, offset by N. */ | ||
| 110 | |||
| 111 | #define _C_CTYPE_A_THRU_F_N(n) \ | ||
| 112 | case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ | ||
| 113 | case 'e' + (n): case 'f' + (n): \ | ||
| 114 | case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \ | ||
| 115 | case 'E' + (n): case 'F' + (n) | ||
| 116 | #define _C_CTYPE_DIGIT_N(n) \ | ||
| 117 | case '0' + (n): case '1' + (n): case '2' + (n): case '3' + (n): \ | ||
| 118 | case '4' + (n): case '5' + (n): case '6' + (n): case '7' + (n): \ | ||
| 119 | case '8' + (n): case '9' + (n) | ||
| 120 | #define _C_CTYPE_LOWER_N(n) \ | ||
| 121 | case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ | ||
| 122 | case 'e' + (n): case 'f' + (n): case 'g' + (n): case 'h' + (n): \ | ||
| 123 | case 'i' + (n): case 'j' + (n): case 'k' + (n): case 'l' + (n): \ | ||
| 124 | case 'm' + (n): case 'n' + (n): case 'o' + (n): case 'p' + (n): \ | ||
| 125 | case 'q' + (n): case 'r' + (n): case 's' + (n): case 't' + (n): \ | ||
| 126 | case 'u' + (n): case 'v' + (n): case 'w' + (n): case 'x' + (n): \ | ||
| 127 | case 'y' + (n): case 'z' + (n) | ||
| 128 | #define _C_CTYPE_UPPER_N(n) \ | ||
| 129 | case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \ | ||
| 130 | case 'E' + (n): case 'F' + (n): case 'G' + (n): case 'H' + (n): \ | ||
| 131 | case 'I' + (n): case 'J' + (n): case 'K' + (n): case 'L' + (n): \ | ||
| 132 | case 'M' + (n): case 'N' + (n): case 'O' + (n): case 'P' + (n): \ | ||
| 133 | case 'Q' + (n): case 'R' + (n): case 'S' + (n): case 'T' + (n): \ | ||
| 134 | case 'U' + (n): case 'V' + (n): case 'W' + (n): case 'X' + (n): \ | ||
| 135 | case 'Y' + (n): case 'Z' + (n) | ||
| 136 | |||
| 137 | /* Given MACRO_N, expand to all the cases for the corresponding class. */ | ||
| 138 | #if _C_CTYPE_SIGNED_EBCDIC | ||
| 139 | # define _C_CTYPE_CASES(macro_n) macro_n (0): macro_n (256) | ||
| 140 | #else | ||
| 141 | # define _C_CTYPE_CASES(macro_n) macro_n (0) | ||
| 142 | #endif | ||
| 102 | 143 | ||
| 103 | /* Function declarations. */ | 144 | /* Cases for hex letter digits, digits, lower, and upper, with another |
| 145 | case for unsigned char if the original char is negative. */ | ||
| 146 | |||
| 147 | #define _C_CTYPE_A_THRU_F _C_CTYPE_CASES (_C_CTYPE_A_THRU_F_N) | ||
| 148 | #define _C_CTYPE_DIGIT _C_CTYPE_CASES (_C_CTYPE_DIGIT_N) | ||
| 149 | #define _C_CTYPE_LOWER _C_CTYPE_CASES (_C_CTYPE_LOWER_N) | ||
| 150 | #define _C_CTYPE_UPPER _C_CTYPE_CASES (_C_CTYPE_UPPER_N) | ||
| 151 | |||
| 152 | /* The punct class differs because some punctuation characters may be | ||
| 153 | negative while others are nonnegative. Instead of attempting to | ||
| 154 | define _C_CTYPE_PUNCT, define just the plain chars here, and do any | ||
| 155 | cases-plus-256 by hand after using this macro. */ | ||
| 156 | #define _C_CTYPE_PUNCT_PLAIN \ | ||
| 157 | case '!': case '"': case '#': case '$': \ | ||
| 158 | case '%': case '&': case '\'': case '(': \ | ||
| 159 | case ')': case '*': case '+': case ',': \ | ||
| 160 | case '-': case '.': case '/': case ':': \ | ||
| 161 | case ';': case '<': case '=': case '>': \ | ||
| 162 | case '?': case '@': case '[': case '\\': \ | ||
| 163 | case ']': case '^': case '_': case '`': \ | ||
| 164 | case '{': case '|': case '}': case '~' | ||
| 165 | |||
| 166 | /* Function definitions. */ | ||
| 104 | 167 | ||
| 105 | /* Unlike the functions in <ctype.h>, which require an argument in the range | 168 | /* Unlike the functions in <ctype.h>, which require an argument in the range |
| 106 | of the 'unsigned char' type, the functions here operate on values that are | 169 | of the 'unsigned char' type, the functions here operate on values that are |
| @@ -117,179 +180,608 @@ extern "C" { | |||
| 117 | if (c_isalpha (*s)) ... | 180 | if (c_isalpha (*s)) ... |
| 118 | */ | 181 | */ |
| 119 | 182 | ||
| 120 | extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */ | 183 | C_CTYPE_INLINE bool |
| 184 | c_isalnum (int c) | ||
| 185 | { | ||
| 186 | switch (c) | ||
| 187 | { | ||
| 188 | _C_CTYPE_DIGIT: | ||
| 189 | _C_CTYPE_LOWER: | ||
| 190 | _C_CTYPE_UPPER: | ||
| 191 | return true; | ||
| 192 | |||
| 193 | default: | ||
| 194 | return false; | ||
| 195 | } | ||
| 196 | } | ||
| 121 | 197 | ||
| 122 | extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST; | 198 | C_CTYPE_INLINE bool |
| 123 | extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST; | 199 | c_isalpha (int c) |
| 124 | extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST; | 200 | { |
| 125 | extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST; | 201 | switch (c) |
| 126 | extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST; | 202 | { |
| 127 | extern bool c_islower (int c) _GL_ATTRIBUTE_CONST; | 203 | _C_CTYPE_LOWER: |
| 128 | extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST; | 204 | _C_CTYPE_UPPER: |
| 129 | extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST; | 205 | return true; |
| 130 | extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST; | 206 | |
| 131 | extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST; | 207 | default: |
| 132 | extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST; | 208 | return false; |
| 133 | extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST; | 209 | } |
| 210 | } | ||
| 134 | 211 | ||
| 135 | extern int c_tolower (int c) _GL_ATTRIBUTE_CONST; | 212 | /* The function isascii is not locale dependent. |
| 136 | extern int c_toupper (int c) _GL_ATTRIBUTE_CONST; | 213 | Its use in EBCDIC is questionable. */ |
| 214 | C_CTYPE_INLINE bool | ||
| 215 | c_isascii (int c) | ||
| 216 | { | ||
| 217 | switch (c) | ||
| 218 | { | ||
| 219 | case ' ': | ||
| 220 | _C_CTYPE_CNTRL: | ||
| 221 | _C_CTYPE_DIGIT: | ||
| 222 | _C_CTYPE_LOWER: | ||
| 223 | _C_CTYPE_UPPER: | ||
| 224 | |||
| 225 | _C_CTYPE_PUNCT_PLAIN: | ||
| 226 | #if '!' < 0 | ||
| 227 | case '!' + 256: | ||
| 228 | #endif | ||
| 229 | #if '"' < 0 | ||
| 230 | case '"' + 256: | ||
| 231 | #endif | ||
| 232 | #if '#' < 0 | ||
| 233 | case '#' + 256: | ||
| 234 | #endif | ||
| 235 | #if '$' < 0 | ||
| 236 | case '$' + 256: | ||
| 237 | #endif | ||
| 238 | #if '%' < 0 | ||
| 239 | case '%' + 256: | ||
| 240 | #endif | ||
| 241 | #if '&' < 0 | ||
| 242 | case '&' + 256: | ||
| 243 | #endif | ||
| 244 | #if '\'' < 0 | ||
| 245 | case '\'' + 256: | ||
| 246 | #endif | ||
| 247 | #if '(' < 0 | ||
| 248 | case '(' + 256: | ||
| 249 | #endif | ||
| 250 | #if ')' < 0 | ||
| 251 | case ')' + 256: | ||
| 252 | #endif | ||
| 253 | #if '*' < 0 | ||
| 254 | case '*' + 256: | ||
| 255 | #endif | ||
| 256 | #if '+' < 0 | ||
| 257 | case '+' + 256: | ||
| 258 | #endif | ||
| 259 | #if ',' < 0 | ||
| 260 | case ',' + 256: | ||
| 261 | #endif | ||
| 262 | #if '-' < 0 | ||
| 263 | case '-' + 256: | ||
| 264 | #endif | ||
| 265 | #if '.' < 0 | ||
| 266 | case '.' + 256: | ||
| 267 | #endif | ||
| 268 | #if '/' < 0 | ||
| 269 | case '/' + 256: | ||
| 270 | #endif | ||
| 271 | #if ':' < 0 | ||
| 272 | case ':' + 256: | ||
| 273 | #endif | ||
| 274 | #if ';' < 0 | ||
| 275 | case ';' + 256: | ||
| 276 | #endif | ||
| 277 | #if '<' < 0 | ||
| 278 | case '<' + 256: | ||
| 279 | #endif | ||
| 280 | #if '=' < 0 | ||
| 281 | case '=' + 256: | ||
| 282 | #endif | ||
| 283 | #if '>' < 0 | ||
| 284 | case '>' + 256: | ||
| 285 | #endif | ||
| 286 | #if '?' < 0 | ||
| 287 | case '?' + 256: | ||
| 288 | #endif | ||
| 289 | #if '@' < 0 | ||
| 290 | case '@' + 256: | ||
| 291 | #endif | ||
| 292 | #if '[' < 0 | ||
| 293 | case '[' + 256: | ||
| 294 | #endif | ||
| 295 | #if '\\' < 0 | ||
| 296 | case '\\' + 256: | ||
| 297 | #endif | ||
| 298 | #if ']' < 0 | ||
| 299 | case ']' + 256: | ||
| 300 | #endif | ||
| 301 | #if '^' < 0 | ||
| 302 | case '^' + 256: | ||
| 303 | #endif | ||
| 304 | #if '_' < 0 | ||
| 305 | case '_' + 256: | ||
| 306 | #endif | ||
| 307 | #if '`' < 0 | ||
| 308 | case '`' + 256: | ||
| 309 | #endif | ||
| 310 | #if '{' < 0 | ||
| 311 | case '{' + 256: | ||
| 312 | #endif | ||
| 313 | #if '|' < 0 | ||
| 314 | case '|' + 256: | ||
| 315 | #endif | ||
| 316 | #if '}' < 0 | ||
| 317 | case '}' + 256: | ||
| 318 | #endif | ||
| 319 | #if '~' < 0 | ||
| 320 | case '~' + 256: | ||
| 321 | #endif | ||
| 322 | return true; | ||
| 137 | 323 | ||
| 324 | default: | ||
| 325 | return false; | ||
| 326 | } | ||
| 327 | } | ||
| 138 | 328 | ||
| 139 | #if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \ | 329 | C_CTYPE_INLINE bool |
| 140 | && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS) | 330 | c_isblank (int c) |
| 331 | { | ||
| 332 | return c == ' ' || c == '\t'; | ||
| 333 | } | ||
| 141 | 334 | ||
| 142 | /* ASCII optimizations. */ | 335 | C_CTYPE_INLINE bool |
| 336 | c_iscntrl (int c) | ||
| 337 | { | ||
| 338 | switch (c) | ||
| 339 | { | ||
| 340 | _C_CTYPE_CNTRL: | ||
| 341 | return true; | ||
| 342 | default: | ||
| 343 | return false; | ||
| 344 | } | ||
| 345 | } | ||
| 143 | 346 | ||
| 144 | #undef c_isascii | 347 | C_CTYPE_INLINE bool |
| 145 | #define c_isascii(c) \ | 348 | c_isdigit (int c) |
| 146 | ({ int __c = (c); \ | 349 | { |
| 147 | (__c >= 0x00 && __c <= 0x7f); \ | 350 | switch (c) |
| 148 | }) | 351 | { |
| 352 | _C_CTYPE_DIGIT: | ||
| 353 | return true; | ||
| 354 | default: | ||
| 355 | return false; | ||
| 356 | } | ||
| 357 | } | ||
| 149 | 358 | ||
| 150 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | 359 | C_CTYPE_INLINE bool |
| 151 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | 360 | c_isgraph (int c) |
| 152 | #if C_CTYPE_ASCII | 361 | { |
| 153 | #undef c_isalnum | 362 | switch (c) |
| 154 | #define c_isalnum(c) \ | 363 | { |
| 155 | ({ int __c = (c); \ | 364 | _C_CTYPE_DIGIT: |
| 156 | ((__c >= '0' && __c <= '9') \ | 365 | _C_CTYPE_LOWER: |
| 157 | || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ | 366 | _C_CTYPE_UPPER: |
| 158 | }) | 367 | |
| 159 | #else | 368 | _C_CTYPE_PUNCT_PLAIN: |
| 160 | #undef c_isalnum | 369 | #if '!' < 0 |
| 161 | #define c_isalnum(c) \ | 370 | case '!' + 256: |
| 162 | ({ int __c = (c); \ | ||
| 163 | ((__c >= '0' && __c <= '9') \ | ||
| 164 | || (__c >= 'A' && __c <= 'Z') \ | ||
| 165 | || (__c >= 'a' && __c <= 'z')); \ | ||
| 166 | }) | ||
| 167 | #endif | 371 | #endif |
| 372 | #if '"' < 0 | ||
| 373 | case '"' + 256: | ||
| 168 | #endif | 374 | #endif |
| 169 | 375 | #if '#' < 0 | |
| 170 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | 376 | case '#' + 256: |
| 171 | #if C_CTYPE_ASCII | 377 | #endif |
| 172 | #undef c_isalpha | 378 | #if '$' < 0 |
| 173 | #define c_isalpha(c) \ | 379 | case '$' + 256: |
| 174 | ({ int __c = (c); \ | 380 | #endif |
| 175 | ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ | 381 | #if '%' < 0 |
| 176 | }) | 382 | case '%' + 256: |
| 177 | #else | 383 | #endif |
| 178 | #undef c_isalpha | 384 | #if '&' < 0 |
| 179 | #define c_isalpha(c) \ | 385 | case '&' + 256: |
| 180 | ({ int __c = (c); \ | 386 | #endif |
| 181 | ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ | 387 | #if '\'' < 0 |
| 182 | }) | 388 | case '\'' + 256: |
| 389 | #endif | ||
| 390 | #if '(' < 0 | ||
| 391 | case '(' + 256: | ||
| 392 | #endif | ||
| 393 | #if ')' < 0 | ||
| 394 | case ')' + 256: | ||
| 395 | #endif | ||
| 396 | #if '*' < 0 | ||
| 397 | case '*' + 256: | ||
| 398 | #endif | ||
| 399 | #if '+' < 0 | ||
| 400 | case '+' + 256: | ||
| 401 | #endif | ||
| 402 | #if ',' < 0 | ||
| 403 | case ',' + 256: | ||
| 404 | #endif | ||
| 405 | #if '-' < 0 | ||
| 406 | case '-' + 256: | ||
| 407 | #endif | ||
| 408 | #if '.' < 0 | ||
| 409 | case '.' + 256: | ||
| 410 | #endif | ||
| 411 | #if '/' < 0 | ||
| 412 | case '/' + 256: | ||
| 413 | #endif | ||
| 414 | #if ':' < 0 | ||
| 415 | case ':' + 256: | ||
| 416 | #endif | ||
| 417 | #if ';' < 0 | ||
| 418 | case ';' + 256: | ||
| 419 | #endif | ||
| 420 | #if '<' < 0 | ||
| 421 | case '<' + 256: | ||
| 422 | #endif | ||
| 423 | #if '=' < 0 | ||
| 424 | case '=' + 256: | ||
| 425 | #endif | ||
| 426 | #if '>' < 0 | ||
| 427 | case '>' + 256: | ||
| 428 | #endif | ||
| 429 | #if '?' < 0 | ||
| 430 | case '?' + 256: | ||
| 431 | #endif | ||
| 432 | #if '@' < 0 | ||
| 433 | case '@' + 256: | ||
| 434 | #endif | ||
| 435 | #if '[' < 0 | ||
| 436 | case '[' + 256: | ||
| 437 | #endif | ||
| 438 | #if '\\' < 0 | ||
| 439 | case '\\' + 256: | ||
| 440 | #endif | ||
| 441 | #if ']' < 0 | ||
| 442 | case ']' + 256: | ||
| 443 | #endif | ||
| 444 | #if '^' < 0 | ||
| 445 | case '^' + 256: | ||
| 446 | #endif | ||
| 447 | #if '_' < 0 | ||
| 448 | case '_' + 256: | ||
| 449 | #endif | ||
| 450 | #if '`' < 0 | ||
| 451 | case '`' + 256: | ||
| 452 | #endif | ||
| 453 | #if '{' < 0 | ||
| 454 | case '{' + 256: | ||
| 455 | #endif | ||
| 456 | #if '|' < 0 | ||
| 457 | case '|' + 256: | ||
| 458 | #endif | ||
| 459 | #if '}' < 0 | ||
| 460 | case '}' + 256: | ||
| 183 | #endif | 461 | #endif |
| 462 | #if '~' < 0 | ||
| 463 | case '~' + 256: | ||
| 184 | #endif | 464 | #endif |
| 465 | return true; | ||
| 185 | 466 | ||
| 186 | #undef c_isblank | 467 | default: |
| 187 | #define c_isblank(c) \ | 468 | return false; |
| 188 | ({ int __c = (c); \ | 469 | } |
| 189 | (__c == ' ' || __c == '\t'); \ | 470 | } |
| 190 | }) | ||
| 191 | 471 | ||
| 192 | #if C_CTYPE_ASCII | 472 | C_CTYPE_INLINE bool |
| 193 | #undef c_iscntrl | 473 | c_islower (int c) |
| 194 | #define c_iscntrl(c) \ | 474 | { |
| 195 | ({ int __c = (c); \ | 475 | switch (c) |
| 196 | ((__c & ~0x1f) == 0 || __c == 0x7f); \ | 476 | { |
| 197 | }) | 477 | _C_CTYPE_LOWER: |
| 198 | #endif | 478 | return true; |
| 479 | default: | ||
| 480 | return false; | ||
| 481 | } | ||
| 482 | } | ||
| 199 | 483 | ||
| 200 | #if C_CTYPE_CONSECUTIVE_DIGITS | 484 | C_CTYPE_INLINE bool |
| 201 | #undef c_isdigit | 485 | c_isprint (int c) |
| 202 | #define c_isdigit(c) \ | 486 | { |
| 203 | ({ int __c = (c); \ | 487 | switch (c) |
| 204 | (__c >= '0' && __c <= '9'); \ | 488 | { |
| 205 | }) | 489 | case ' ': |
| 490 | _C_CTYPE_DIGIT: | ||
| 491 | _C_CTYPE_LOWER: | ||
| 492 | _C_CTYPE_UPPER: | ||
| 493 | |||
| 494 | _C_CTYPE_PUNCT_PLAIN: | ||
| 495 | #if '!' < 0 | ||
| 496 | case '!' + 256: | ||
| 206 | #endif | 497 | #endif |
| 207 | 498 | #if '"' < 0 | |
| 208 | #if C_CTYPE_CONSECUTIVE_LOWERCASE | 499 | case '"' + 256: |
| 209 | #undef c_islower | ||
| 210 | #define c_islower(c) \ | ||
| 211 | ({ int __c = (c); \ | ||
| 212 | (__c >= 'a' && __c <= 'z'); \ | ||
| 213 | }) | ||
| 214 | #endif | 500 | #endif |
| 215 | 501 | #if '#' < 0 | |
| 216 | #if C_CTYPE_ASCII | 502 | case '#' + 256: |
| 217 | #undef c_isgraph | ||
| 218 | #define c_isgraph(c) \ | ||
| 219 | ({ int __c = (c); \ | ||
| 220 | (__c >= '!' && __c <= '~'); \ | ||
| 221 | }) | ||
| 222 | #endif | 503 | #endif |
| 223 | 504 | #if '$' < 0 | |
| 224 | #if C_CTYPE_ASCII | 505 | case '$' + 256: |
| 225 | #undef c_isprint | 506 | #endif |
| 226 | #define c_isprint(c) \ | 507 | #if '%' < 0 |
| 227 | ({ int __c = (c); \ | 508 | case '%' + 256: |
| 228 | (__c >= ' ' && __c <= '~'); \ | 509 | #endif |
| 229 | }) | 510 | #if '&' < 0 |
| 511 | case '&' + 256: | ||
| 512 | #endif | ||
| 513 | #if '\'' < 0 | ||
| 514 | case '\'' + 256: | ||
| 515 | #endif | ||
| 516 | #if '(' < 0 | ||
| 517 | case '(' + 256: | ||
| 518 | #endif | ||
| 519 | #if ')' < 0 | ||
| 520 | case ')' + 256: | ||
| 521 | #endif | ||
| 522 | #if '*' < 0 | ||
| 523 | case '*' + 256: | ||
| 524 | #endif | ||
| 525 | #if '+' < 0 | ||
| 526 | case '+' + 256: | ||
| 527 | #endif | ||
| 528 | #if ',' < 0 | ||
| 529 | case ',' + 256: | ||
| 530 | #endif | ||
| 531 | #if '-' < 0 | ||
| 532 | case '-' + 256: | ||
| 533 | #endif | ||
| 534 | #if '.' < 0 | ||
| 535 | case '.' + 256: | ||
| 536 | #endif | ||
| 537 | #if '/' < 0 | ||
| 538 | case '/' + 256: | ||
| 539 | #endif | ||
| 540 | #if ':' < 0 | ||
| 541 | case ':' + 256: | ||
| 542 | #endif | ||
| 543 | #if ';' < 0 | ||
| 544 | case ';' + 256: | ||
| 230 | #endif | 545 | #endif |
| 546 | #if '<' < 0 | ||
| 547 | case '<' + 256: | ||
| 548 | #endif | ||
| 549 | #if '=' < 0 | ||
| 550 | case '=' + 256: | ||
| 551 | #endif | ||
| 552 | #if '>' < 0 | ||
| 553 | case '>' + 256: | ||
| 554 | #endif | ||
| 555 | #if '?' < 0 | ||
| 556 | case '?' + 256: | ||
| 557 | #endif | ||
| 558 | #if '@' < 0 | ||
| 559 | case '@' + 256: | ||
| 560 | #endif | ||
| 561 | #if '[' < 0 | ||
| 562 | case '[' + 256: | ||
| 563 | #endif | ||
| 564 | #if '\\' < 0 | ||
| 565 | case '\\' + 256: | ||
| 566 | #endif | ||
| 567 | #if ']' < 0 | ||
| 568 | case ']' + 256: | ||
| 569 | #endif | ||
| 570 | #if '^' < 0 | ||
| 571 | case '^' + 256: | ||
| 572 | #endif | ||
| 573 | #if '_' < 0 | ||
| 574 | case '_' + 256: | ||
| 575 | #endif | ||
| 576 | #if '`' < 0 | ||
| 577 | case '`' + 256: | ||
| 578 | #endif | ||
| 579 | #if '{' < 0 | ||
| 580 | case '{' + 256: | ||
| 581 | #endif | ||
| 582 | #if '|' < 0 | ||
| 583 | case '|' + 256: | ||
| 584 | #endif | ||
| 585 | #if '}' < 0 | ||
| 586 | case '}' + 256: | ||
| 587 | #endif | ||
| 588 | #if '~' < 0 | ||
| 589 | case '~' + 256: | ||
| 590 | #endif | ||
| 591 | return true; | ||
| 231 | 592 | ||
| 232 | #if C_CTYPE_ASCII | 593 | default: |
| 233 | #undef c_ispunct | 594 | return false; |
| 234 | #define c_ispunct(c) \ | 595 | } |
| 235 | ({ int _c = (c); \ | 596 | } |
| 236 | (c_isgraph (_c) && ! c_isalnum (_c)); \ | 597 | |
| 237 | }) | 598 | C_CTYPE_INLINE bool |
| 238 | #endif | 599 | c_ispunct (int c) |
| 239 | 600 | { | |
| 240 | #undef c_isspace | 601 | switch (c) |
| 241 | #define c_isspace(c) \ | 602 | { |
| 242 | ({ int __c = (c); \ | 603 | _C_CTYPE_PUNCT_PLAIN: |
| 243 | (__c == ' ' || __c == '\t' \ | 604 | #if '!' < 0 |
| 244 | || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ | 605 | case '!' + 256: |
| 245 | }) | 606 | #endif |
| 246 | 607 | #if '"' < 0 | |
| 247 | #if C_CTYPE_CONSECUTIVE_UPPERCASE | 608 | case '"' + 256: |
| 248 | #undef c_isupper | ||
| 249 | #define c_isupper(c) \ | ||
| 250 | ({ int __c = (c); \ | ||
| 251 | (__c >= 'A' && __c <= 'Z'); \ | ||
| 252 | }) | ||
| 253 | #endif | ||
| 254 | |||
| 255 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
| 256 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 257 | #if C_CTYPE_ASCII | ||
| 258 | #undef c_isxdigit | ||
| 259 | #define c_isxdigit(c) \ | ||
| 260 | ({ int __c = (c); \ | ||
| 261 | ((__c >= '0' && __c <= '9') \ | ||
| 262 | || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ | ||
| 263 | }) | ||
| 264 | #else | ||
| 265 | #undef c_isxdigit | ||
| 266 | #define c_isxdigit(c) \ | ||
| 267 | ({ int __c = (c); \ | ||
| 268 | ((__c >= '0' && __c <= '9') \ | ||
| 269 | || (__c >= 'A' && __c <= 'F') \ | ||
| 270 | || (__c >= 'a' && __c <= 'f')); \ | ||
| 271 | }) | ||
| 272 | #endif | 609 | #endif |
| 610 | #if '#' < 0 | ||
| 611 | case '#' + 256: | ||
| 273 | #endif | 612 | #endif |
| 613 | #if '$' < 0 | ||
| 614 | case '$' + 256: | ||
| 615 | #endif | ||
| 616 | #if '%' < 0 | ||
| 617 | case '%' + 256: | ||
| 618 | #endif | ||
| 619 | #if '&' < 0 | ||
| 620 | case '&' + 256: | ||
| 621 | #endif | ||
| 622 | #if '\'' < 0 | ||
| 623 | case '\'' + 256: | ||
| 624 | #endif | ||
| 625 | #if '(' < 0 | ||
| 626 | case '(' + 256: | ||
| 627 | #endif | ||
| 628 | #if ')' < 0 | ||
| 629 | case ')' + 256: | ||
| 630 | #endif | ||
| 631 | #if '*' < 0 | ||
| 632 | case '*' + 256: | ||
| 633 | #endif | ||
| 634 | #if '+' < 0 | ||
| 635 | case '+' + 256: | ||
| 636 | #endif | ||
| 637 | #if ',' < 0 | ||
| 638 | case ',' + 256: | ||
| 639 | #endif | ||
| 640 | #if '-' < 0 | ||
| 641 | case '-' + 256: | ||
| 642 | #endif | ||
| 643 | #if '.' < 0 | ||
| 644 | case '.' + 256: | ||
| 645 | #endif | ||
| 646 | #if '/' < 0 | ||
| 647 | case '/' + 256: | ||
| 648 | #endif | ||
| 649 | #if ':' < 0 | ||
| 650 | case ':' + 256: | ||
| 651 | #endif | ||
| 652 | #if ';' < 0 | ||
| 653 | case ';' + 256: | ||
| 654 | #endif | ||
| 655 | #if '<' < 0 | ||
| 656 | case '<' + 256: | ||
| 657 | #endif | ||
| 658 | #if '=' < 0 | ||
| 659 | case '=' + 256: | ||
| 660 | #endif | ||
| 661 | #if '>' < 0 | ||
| 662 | case '>' + 256: | ||
| 663 | #endif | ||
| 664 | #if '?' < 0 | ||
| 665 | case '?' + 256: | ||
| 666 | #endif | ||
| 667 | #if '@' < 0 | ||
| 668 | case '@' + 256: | ||
| 669 | #endif | ||
| 670 | #if '[' < 0 | ||
| 671 | case '[' + 256: | ||
| 672 | #endif | ||
| 673 | #if '\\' < 0 | ||
| 674 | case '\\' + 256: | ||
| 675 | #endif | ||
| 676 | #if ']' < 0 | ||
| 677 | case ']' + 256: | ||
| 678 | #endif | ||
| 679 | #if '^' < 0 | ||
| 680 | case '^' + 256: | ||
| 681 | #endif | ||
| 682 | #if '_' < 0 | ||
| 683 | case '_' + 256: | ||
| 684 | #endif | ||
| 685 | #if '`' < 0 | ||
| 686 | case '`' + 256: | ||
| 687 | #endif | ||
| 688 | #if '{' < 0 | ||
| 689 | case '{' + 256: | ||
| 690 | #endif | ||
| 691 | #if '|' < 0 | ||
| 692 | case '|' + 256: | ||
| 693 | #endif | ||
| 694 | #if '}' < 0 | ||
| 695 | case '}' + 256: | ||
| 696 | #endif | ||
| 697 | #if '~' < 0 | ||
| 698 | case '~' + 256: | ||
| 699 | #endif | ||
| 700 | return true; | ||
| 274 | 701 | ||
| 275 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | 702 | default: |
| 276 | #undef c_tolower | 703 | return false; |
| 277 | #define c_tolower(c) \ | 704 | } |
| 278 | ({ int __c = (c); \ | 705 | } |
| 279 | (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ | 706 | |
| 280 | }) | 707 | C_CTYPE_INLINE bool |
| 281 | #undef c_toupper | 708 | c_isspace (int c) |
| 282 | #define c_toupper(c) \ | 709 | { |
| 283 | ({ int __c = (c); \ | 710 | switch (c) |
| 284 | (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ | 711 | { |
| 285 | }) | 712 | case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': |
| 713 | return true; | ||
| 714 | default: | ||
| 715 | return false; | ||
| 716 | } | ||
| 717 | } | ||
| 718 | |||
| 719 | C_CTYPE_INLINE bool | ||
| 720 | c_isupper (int c) | ||
| 721 | { | ||
| 722 | switch (c) | ||
| 723 | { | ||
| 724 | _C_CTYPE_UPPER: | ||
| 725 | return true; | ||
| 726 | default: | ||
| 727 | return false; | ||
| 728 | } | ||
| 729 | } | ||
| 730 | |||
| 731 | C_CTYPE_INLINE bool | ||
| 732 | c_isxdigit (int c) | ||
| 733 | { | ||
| 734 | switch (c) | ||
| 735 | { | ||
| 736 | _C_CTYPE_DIGIT: | ||
| 737 | _C_CTYPE_A_THRU_F: | ||
| 738 | return true; | ||
| 739 | |||
| 740 | default: | ||
| 741 | return false; | ||
| 742 | } | ||
| 743 | } | ||
| 744 | |||
| 745 | C_CTYPE_INLINE int | ||
| 746 | c_tolower (int c) | ||
| 747 | { | ||
| 748 | switch (c) | ||
| 749 | { | ||
| 750 | _C_CTYPE_UPPER_N (0): | ||
| 751 | #if _C_CTYPE_SIGNED_EBCDIC | ||
| 752 | c += 256; | ||
| 753 | /* Fall through. */ | ||
| 754 | _C_CTYPE_UPPER_N (256): | ||
| 286 | #endif | 755 | #endif |
| 756 | return c - 'A' + 'a'; | ||
| 287 | 757 | ||
| 288 | #endif /* optimizing for speed */ | 758 | default: |
| 759 | return c; | ||
| 760 | } | ||
| 761 | } | ||
| 289 | 762 | ||
| 763 | C_CTYPE_INLINE int | ||
| 764 | c_toupper (int c) | ||
| 765 | { | ||
| 766 | switch (c) | ||
| 767 | { | ||
| 768 | _C_CTYPE_LOWER_N (0): | ||
| 769 | #if _C_CTYPE_SIGNED_EBCDIC | ||
| 770 | c += 256; | ||
| 771 | /* Fall through. */ | ||
| 772 | _C_CTYPE_LOWER_N (256): | ||
| 773 | #endif | ||
| 774 | return c - 'a' + 'A'; | ||
| 775 | |||
| 776 | default: | ||
| 777 | return c; | ||
| 778 | } | ||
| 779 | } | ||
| 290 | 780 | ||
| 291 | #ifdef __cplusplus | 781 | #ifdef __cplusplus |
| 292 | } | 782 | } |
| 293 | #endif | 783 | #endif |
| 294 | 784 | ||
| 785 | _GL_INLINE_HEADER_END | ||
| 786 | |||
| 295 | #endif /* C_CTYPE_H */ | 787 | #endif /* C_CTYPE_H */ |
diff --git a/lib/get-permissions.c b/lib/get-permissions.c index 459513c9251..9dfb0764ce4 100644 --- a/lib/get-permissions.c +++ b/lib/get-permissions.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* get-permissions.c - get permissions of a file | 1 | /* Get permissions of a file. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c index c4507424719..9db9033816d 100644 --- a/lib/qcopy-acl.c +++ b/lib/qcopy-acl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* copy-acl.c - copy access control list from one file to another file | 1 | /* Copy access control list from one file to another. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/set-permissions.c b/lib/set-permissions.c index 1aa5b4941c7..8e6ecf365d1 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* set-permissions.c - set permissions of a file | 1 | /* Set permissions of a file. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||