Просмотр исходного кода

v.external: use lower case for keys (as r.external or r|v.external.out)
links with upper case keys are still suppored by vector library


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53899 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 12 лет назад
Родитель
Сommit
980818b04f
3 измененных файлов с 22 добавлено и 23 удалено
  1. 7 7
      lib/vector/Vlib/close.c
  2. 6 6
      lib/vector/diglib/frmt.c
  3. 9 10
      vector/v.external/main.c

+ 7 - 7
lib/vector/Vlib/close.c

@@ -235,19 +235,19 @@ int Vect_save_frmt(struct Map_info *Map)
 
     if (Map->format == GV_FORMAT_POSTGIS) {
 #ifdef HAVE_POSTGRES
-        fprintf(fd, "FORMAT: postgis\n");
-        fprintf(fd, "CONNINFO: %s\n", Map->fInfo.pg.conninfo);
-        fprintf(fd, "SCHEMA: %s\n",   Map->fInfo.pg.schema_name);
-        fprintf(fd, "TABLE: %s\n",    Map->fInfo.pg.table_name);
+        fprintf(fd, "format: postgis\n");
+        fprintf(fd, "conninfo: %s\n", Map->fInfo.pg.conninfo);
+        fprintf(fd, "schema: %s\n",   Map->fInfo.pg.schema_name);
+        fprintf(fd, "table: %s\n",    Map->fInfo.pg.table_name);
 #else
         G_fatal_error(_("GRASS is not compiled with PostgreSQL support"));
         return 0;
 #endif
     } else if (Map->format == GV_FORMAT_OGR) {
 #ifdef HAVE_OGR
-        fprintf(fd, "FORMAT: ogr\n");
-        fprintf(fd, "DSN: %s\n",   Map->fInfo.ogr.dsn);
-        fprintf(fd, "LAYER: %s\n", Map->fInfo.ogr.layer_name);
+        fprintf(fd, "format: ogr\n");
+        fprintf(fd, "dsn: %s\n",   Map->fInfo.ogr.dsn);
+        fprintf(fd, "layer: %s\n", Map->fInfo.ogr.layer_name);
 #else
         G_fatal_error(_("GRASS is not compiled with OGR support"));
         return 0;

+ 6 - 6
lib/vector/diglib/frmt.c

@@ -53,7 +53,7 @@ int dig_read_frmt_ascii(FILE * dascii, struct Format_info *finfo)
         while (*ptr == ' ')
             ptr++;
 
-        if (strcmp(buf1, "FORMAT") == 0) {
+        if (G_strcasecmp(buf1, "FORMAT") == 0) {
 #ifdef HAVE_OGR
             if (G_strcasecmp(ptr, "ogr") == 0) {
                 frmt = GV_FORMAT_OGR;
@@ -107,19 +107,19 @@ int dig_read_frmt_ascii(FILE * dascii, struct Format_info *finfo)
 
 #ifdef HAVE_OGR
         if (frmt == GV_FORMAT_OGR) {
-            if (strcmp(buf1, "DSN") == 0)
+            if (G_strcasecmp(buf1, "DSN") == 0)
                 finfo->ogr.dsn = G_store(ptr);
-            if (strcmp(buf1, "LAYER") == 0)
+            if (G_strcasecmp(buf1, "LAYER") == 0)
                 finfo->ogr.layer_name = G_store(ptr);
         }
 #endif
 #ifdef HAVE_POSTGRES
         if (frmt == GV_FORMAT_POSTGIS) {
-            if (strcmp(buf1, "CONNINFO") == 0)
+            if (G_strcasecmp(buf1, "CONNINFO") == 0)
                 finfo->pg.conninfo = G_store(ptr);
-            if (strcmp(buf1, "SCHEMA") == 0)
+            if (G_strcasecmp(buf1, "SCHEMA") == 0)
                 finfo->pg.schema_name = G_store(ptr);
-            if (strcmp(buf1, "TABLE") == 0)
+            if (G_strcasecmp(buf1, "TABLE") == 0)
                 finfo->pg.table_name = G_store(ptr);
         }
 #endif

+ 9 - 10
vector/v.external/main.c

@@ -161,28 +161,27 @@ int main(int argc, char *argv[])
     /* create frmt file */
     sprintf(buf, "%s/%s", GV_DIRECTORY, output);
     fd = G_fopen_new(buf, GV_FRMT_ELEMENT);
-    if (fd == NULL) {
-        G_fatal_error("Unable to create file '%s'", buf);
-    }
+    if (fd == NULL)
+        G_fatal_error(_("Unable to create file '%s/%s'"), buf, GV_FRMT_ELEMENT);
     
     if (!use_ogr) {
         char *table_name, *schema_name;
         
         get_table_name(options.layer->answer, &table_name, &schema_name);
         
-        fprintf(fd, "FORMAT: postgis\n");
-        fprintf(fd, "CONNINFO: %s\n", dsn);
+        fprintf(fd, "format: postgis\n");
+        fprintf(fd, "conninfo: %s\n", dsn);
         if (schema_name)
-            fprintf(fd, "SCHEMA: %s\n", schema_name);
-        fprintf(fd, "TABLE: %s\n", table_name);
+            fprintf(fd, "schema: %s\n", schema_name);
+        fprintf(fd, "table: %s\n", table_name);
 
         G_free(table_name);
         G_free(schema_name);
     }
     else {
-        fprintf(fd, "FORMAT: ogr\n");
-        fprintf(fd, "DSN: %s\n", dsn);
-        fprintf(fd, "LAYER: %s\n", options.layer->answer);
+        fprintf(fd, "format: ogr\n");
+        fprintf(fd, "dsn: %s\n", dsn);
+        fprintf(fd, "layer: %s\n", options.layer->answer);
     }
     fclose(fd);