[GRASS-SVN] r60664 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jun 1 21:03:53 PDT 2014


Author: hcho
Date: 2014-06-01 21:03:53 -0700 (Sun, 01 Jun 2014)
New Revision: 60664

Modified:
   grass/trunk/lib/gis/parser.c
Log:
G_option_to_separator(): only accept separator options

Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2014-06-02 03:42:40 UTC (rev 60663)
+++ grass/trunk/lib/gis/parser.c	2014-06-02 04:03:53 UTC (rev 60664)
@@ -1445,8 +1445,12 @@
 {
     char* sep;
     
+    if (option->gisprompt == NULL ||
+	strcmp(option->gisprompt, "old,separator,separator") != 0)
+        G_fatal_error(_("%s= is not a separator option"), option->key);
+
     if (option->answer == NULL)
-        G_fatal_error(_("No separator given"));
+        G_fatal_error(_("No separator given for %s="), option->key);
 
     if (strcmp(option->answer, "pipe") == 0)
         sep = G_store("|");
@@ -1508,9 +1512,10 @@
 	    strcmp(option->answer, "-") == 0;
 
     if (option->gisprompt == NULL)
-        G_fatal_error(_("Not a file option"));
+        G_fatal_error(_("%s= is not a file option"), option->key);
     else if (option->multiple)
-	G_fatal_error(_("Multiple files not supported"));
+	G_fatal_error(_("Opening multiple files not supported for %s="),
+			option->key);
     else if (strcmp(option->gisprompt, "old,file,file") == 0) {
 	if (stdinout)
 	    fp = stdin;
@@ -1524,7 +1529,7 @@
 	    G_fatal_error(_("Unable to create %s file <%s>"),
 			    option->key, option->answer);
     } else
-        G_fatal_error(_("Not a file option"));
+        G_fatal_error(_("%s= is not a file option"), option->key);
 
     return fp;
 }



More information about the grass-commit mailing list