Go to the documentation of this file.00001 #include <grass/gis.h>
00002 #include <grass/dbmi.h>
00003 #include <grass/glocale.h>
00004
00005
00006
00017 int db_legal_tablename(const char *s)
00018 {
00019 char buf[GNAME_MAX];
00020
00021 sprintf(buf, "%s", s);
00022
00023 if (*s == '.' || *s == 0) {
00024 fprintf(stderr,
00025 _("Illegal table map name <%s>. May not contain '.' or 'NULL'.\n"),
00026 buf);
00027 return DB_FAILED;
00028 }
00029
00030
00031 if (!((*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z'))) {
00032 fprintf(stderr,
00033 _("Illegal table map name <%s>. Must start with a letter.\n"),
00034 buf);
00035 return DB_FAILED;
00036 }
00037
00038 for (s++; *s; s++)
00039 if (!
00040 ((*s >= 'A' && *s <= 'Z') || (*s >= 'a' && *s <= 'z') ||
00041 (*s >= '0' && *s <= '9') || *s == '_' || *s == '@')) {
00042 fprintf(stderr,
00043 _("Illegal table map name <%s>. Character <%c> not allowed.\n"),
00044 buf, *s);
00045 return DB_FAILED;
00046 }
00047
00048 return DB_OK;
00049 }