[GRASS-SVN] r53899 - in grass/trunk: lib/vector/Vlib lib/vector/diglib vector/v.external

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 18 10:40:12 PST 2012


Author: martinl
Date: 2012-11-18 10:40:11 -0800 (Sun, 18 Nov 2012)
New Revision: 53899

Modified:
   grass/trunk/lib/vector/Vlib/close.c
   grass/trunk/lib/vector/diglib/frmt.c
   grass/trunk/vector/v.external/main.c
Log:
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


Modified: grass/trunk/lib/vector/Vlib/close.c
===================================================================
--- grass/trunk/lib/vector/Vlib/close.c	2012-11-18 18:14:38 UTC (rev 53898)
+++ grass/trunk/lib/vector/Vlib/close.c	2012-11-18 18:40:11 UTC (rev 53899)
@@ -235,19 +235,19 @@
 
     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;

Modified: grass/trunk/lib/vector/diglib/frmt.c
===================================================================
--- grass/trunk/lib/vector/diglib/frmt.c	2012-11-18 18:14:38 UTC (rev 53898)
+++ grass/trunk/lib/vector/diglib/frmt.c	2012-11-18 18:40:11 UTC (rev 53899)
@@ -53,7 +53,7 @@
         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 @@
 
 #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

Modified: grass/trunk/vector/v.external/main.c
===================================================================
--- grass/trunk/vector/v.external/main.c	2012-11-18 18:14:38 UTC (rev 53898)
+++ grass/trunk/vector/v.external/main.c	2012-11-18 18:40:11 UTC (rev 53899)
@@ -161,28 +161,27 @@
     /* 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);
     



More information about the grass-commit mailing list