Add license notifications to all source files
[blerg.git] / database / util.c
1 /* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
2  * BSD-style license.  Please see the COPYING file for details.
3  */
4
5 #define VALID_CHAR(x) (x == ' ' || x == '\'' || x == '-' || x == '.' || (x >= '0' && x <= '9') || (x >= 'A' && x <= 'Z') || x == '_' || (x >= 'a' && x <= 'z'))
6
7 int valid_name(const char *name) {
8         int i;
9
10         for (i = 0; i < 32; i++) {
11                 if (name[i] == 0) break;
12                 if (!VALID_CHAR(name[i])) return 0;
13         }
14
15         if (i >= 32)
16                 return 0;
17
18         return 1;
19 }