arch/arm64: Support FEAT_CCIDX
[coreboot2.git] / util / nvramtool / accessors / layout-common.c
bloba117207d9a63599312a4bf218b1373fb6448e47c
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <ctype.h>
5 #include "layout-text.h"
7 static int is_ident_nondigit(int c)
9 int result;
10 switch(c) {
11 case 'A': case 'B': case 'C': case 'D':
12 case 'E': case 'F': case 'G': case 'H':
13 case 'I': case 'J': case 'K': case 'L':
14 case 'M': case 'N': case 'O': case 'P':
15 case 'Q': case 'R': case 'S': case 'T':
16 case 'U': case 'V': case 'W': case 'X':
17 case 'Y': case 'Z':
18 case 'a': case 'b': case 'c': case 'd':
19 case 'e': case 'f': case 'g': case 'h':
20 case 'i': case 'j': case 'k': case 'l':
21 case 'm': case 'n': case 'o': case 'p':
22 case 'q': case 'r': case 's': case 't':
23 case 'u': case 'v': case 'w': case 'x':
24 case 'y': case 'z':
25 case '_':
26 result = 1;
27 break;
28 default:
29 result = 0;
30 break;
32 return result;
35 int is_ident(char *str)
37 int result;
38 int ch;
39 ch = *str;
40 result = 0;
41 if (is_ident_nondigit(ch)) {
42 do {
43 str++;
44 ch = *str;
45 } while(ch && (is_ident_nondigit(ch) || (isdigit(ch))));
46 result = (ch == '\0');
48 return result;