19 #include <grass/Vect.h>
20 #include <grass/gis.h>
29 char buff[20001], buf1[1024];
33 G_debug(3,
"dig_read_frmt_ascii()");
36 if (
G_getl2(buff, 2000, dascii)) {
39 if (!(ptr =
G_index(buff,
':'))) {
40 G_warning(
"Vector format not recognized: %s", buff);
45 buf1[ptr -
buff] =
'\0';
51 if (strcmp(buf1,
"FORMAT") == 0) {
58 G_warning(
"Vector format not recognized: %s", buff);
64 finfo->ogr.dsn =
NULL;
65 finfo->ogr.layer_name =
NULL;
68 while (
G_getl2(buff, 2000, dascii)) {
71 if (!(ptr =
G_index(buff,
':'))) {
72 G_warning(
"Format definition is not correct: %s", buff);
77 buf1[ptr -
buff] =
'\0';
84 if (strcmp(buf1,
"DSN") == 0)
86 if (strcmp(buf1,
"LAYER") == 0)
87 finfo->ogr.layer_name =
G_store(ptr);
102 G_debug(3,
"dig_write_frmt_ascii()");
104 G_fatal_error(
"Format not supported by dig_write_frmt_ascii()");
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower)
char * G_store(const char *s)
Copy string to allocated memory.
char * G_index(const char *str, int delim)
delimiter
char * G_chop(char *line)
Chop leading and trailing white spaces:
int dig_write_frmt_ascii(FILE *dascii, struct Format_info *finfo, int format)
int G_getl2(char *buf, int n, FILE *fd)
gets a line of text from a file of any pedigree
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_debug(int level, const char *msg,...)
Print debugging message.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int dig_read_frmt_ascii(FILE *dascii, struct Format_info *finfo)