GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
legal_dbname.c
Go to the documentation of this file.
1
#include <grass/gis.h>
2
#include <grass/dbmi.h>
3
#include <grass/glocale.h>
4
5
/* TODO: are we as restrictive here as for vector names? */
6
17
int
db_legal_tablename
(
const
char
*
s
)
18
{
19
char
buf[GNAME_MAX];
20
21
sprintf(buf,
"%s"
, s);
22
23
if
(*s ==
'.'
|| *s == 0) {
24
fprintf(stderr,
25
_(
"Illegal table map name <%s>. May not contain '.' or 'NULL'.\n"
),
26
buf);
27
return
DB_FAILED;
28
}
29
30
/* file name must start with letter */
31
if
(!((*s >=
'A'
&& *s <=
'Z'
) || (*s >=
'a'
&& *s <=
'z'
))) {
32
fprintf(stderr,
33
_(
"Illegal table map name <%s>. Must start with a letter.\n"
),
34
buf);
35
return
DB_FAILED;
36
}
37
38
for
(s++; *
s
; s++)
39
if
(!
40
((*s >=
'A'
&& *s <=
'Z'
) || (*s >=
'a'
&& *s <=
'z'
) ||
41
(*s >=
'0'
&& *s <=
'9'
) || *s ==
'_'
|| *s ==
'@'
)) {
42
fprintf(stderr,
43
_(
"Illegal table map name <%s>. Character <%c> not allowed.\n"
),
44
buf, *s);
45
return
DB_FAILED;
46
}
47
48
return
DB_OK;
49
}
lib
db
dbmi_base
legal_dbname.c
Generated on Sat Oct 5 2013 12:11:08 for GRASS Programmer's Manual by
1.8.4