add-patch: response to unknown command
[alt-git.git] / ctype.c
blob345174555077984f695dba702593e08fbed95031
1 /*
2 * Sane locale-independent, ASCII ctype.
4 * No surprises, and works with signed and unsigned chars.
5 */
6 #include "git-compat-util.h"
8 enum {
9 S = GIT_SPACE,
10 A = GIT_ALPHA,
11 D = GIT_DIGIT,
12 G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
13 R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
14 P = GIT_PATHSPEC_MAGIC, /* other non-alnum, except for ] and } */
15 X = GIT_CNTRL,
16 U = GIT_PUNCT,
17 Z = GIT_CNTRL | GIT_SPACE
20 const unsigned char sane_ctype[256] = {
21 X, X, X, X, X, X, X, X, X, Z, Z, X, X, Z, X, X, /* 0.. 15 */
22 X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 16.. 31 */
23 S, P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */
24 D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */
25 P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
26 A, A, A, A, A, A, A, A, A, A, A, G, G, U, R, P, /* 80.. 95 */
27 P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
28 A, A, A, A, A, A, A, A, A, A, A, R, R, U, P, X, /* 112..127 */
29 /* Nothing in the 128.. range */