19 #include <grass/gis.h>
20 #include <grass/Vect.h>
21 #include <grass/glocale.h>
41 static const char *keywords[] = {
"and",
"or",
"not",
NULL };
47 if (*s ==
'.' || *s == 0) {
48 G_warning(_(
"Illegal vector map name <%s>. May not contain '.' or 'NULL'."),
54 if (!((*s >=
'A' && *s <=
'Z') || (*s >=
'a' && *s <=
'z'))) {
55 G_warning(_(
"Illegal vector map name <%s>. Must start with a letter."),
61 if (!((*s >=
'A' && *s <=
'Z') || (*s >=
'a' && *s <=
'z') ||
62 (*s >=
'0' && *s <=
'9') || *s ==
'_' || *s ==
'@')) {
63 G_warning(_(
"Illegal vector map name <%s>. Character '%c' not allowed."),
68 for (i = 0; keywords[i]; i++)
70 G_warning(_(
"Illegal vector map name <%s>. SQL keyword cannot be used as vector map name."),
100 if (error == GV_FATAL_EXIT) {
101 G_fatal_error(_(
"Output vector map name <%s> is not valid map name"),
104 else if (error == GV_FATAL_PRINT) {
105 G_warning(_(
"Output vector map name <%s> is not valid map name"),
116 if (mapset ==
NULL) {
117 if (error == GV_FATAL_EXIT) {
120 else if (error == GV_FATAL_PRINT) {
121 G_warning(_(
"Vector map <%s> not found"), input);
129 if (strcmp(mapset,
G_mapset()) == 0) {
131 char nm[GNAME_MAX], ms[GMAPSET_MAX];
140 if (strcmp(in, output) == 0) {
141 if (error == GV_FATAL_EXIT) {
145 else if (error == GV_FATAL_PRINT) {
146 G_warning(_(
"Output vector map <%s> is used as input"),
char * G_mapset(void)
current mapset name
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower)
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
char * G_find_vector2(const char *name, const char *mapset)
find a vector map (look but don't touch)
int Vect_legal_filename(const char *s)
Check if output is legal vector name.
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int Vect_check_input_output_name(const char *input, const char *output, int error)
Check for input and output vector map name.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
void output(const char *fmt,...)
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)