AUTHORS, util/: Drop individual copyright notices
[coreboot.git] / util / nvramtool / accessors / layout-common.c
blob15a2672726421217b04f541444356dda12e65bd1
1 /*****************************************************************************\
2 * layout_common.c
3 *****************************************************************************
4 * This file is part of nvramtool, a utility for reading/writing coreboot
5 * parameters and displaying information from the coreboot table.
6 * For details, see https://coreboot.org/nvramtool.
8 * Please also read the file DISCLAIMER which is included in this software
9 * distribution.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License (as published by the
13 * Free Software Foundation) version 2, dated June 1991.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
18 * conditions of the GNU General Public License for more details.
19 \*****************************************************************************/
21 #include <ctype.h>
23 #include "layout-text.h"
25 static int is_ident_nondigit(int c)
27 int result;
28 switch(c) {
29 case 'A': case 'B': case 'C': case 'D':
30 case 'E': case 'F': case 'G': case 'H':
31 case 'I': case 'J': case 'K': case 'L':
32 case 'M': case 'N': case 'O': case 'P':
33 case 'Q': case 'R': case 'S': case 'T':
34 case 'U': case 'V': case 'W': case 'X':
35 case 'Y': case 'Z':
36 case 'a': case 'b': case 'c': case 'd':
37 case 'e': case 'f': case 'g': case 'h':
38 case 'i': case 'j': case 'k': case 'l':
39 case 'm': case 'n': case 'o': case 'p':
40 case 'q': case 'r': case 's': case 't':
41 case 'u': case 'v': case 'w': case 'x':
42 case 'y': case 'z':
43 case '_':
44 result = 1;
45 break;
46 default:
47 result = 0;
48 break;
50 return result;
53 int is_ident(char *str)
55 int result;
56 int ch;
57 ch = *str;
58 result = 0;
59 if (is_ident_nondigit(ch)) {
60 do {
61 str++;
62 ch = *str;
63 } while(ch && (is_ident_nondigit(ch) || (isdigit(ch))));
64 result = (ch == '\0');
66 return result;