浏览代码

G_option_to_separator(): only accept separator options

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60664 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 11 年之前
父节点
当前提交
8d1758d3f9
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      lib/gis/parser.c

+ 9 - 4
lib/gis/parser.c

@@ -1445,8 +1445,12 @@ char* G_option_to_separator(const struct Option *option)
 {
     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 @@ FILE *G_open_option_file(const struct Option *option)
 	    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 @@ FILE *G_open_option_file(const struct Option *option)
 	    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;
 }