瀏覽代碼

hcho: G_OPT_F_SEP: added "pipe" for "|"
(merge https://trac.osgeo.org/grass/changeset/60614 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@60637 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 11 年之前
父節點
當前提交
4849300325
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 5 3
      lib/gis/parser.c
  2. 2 2
      lib/gis/parser_standard_options.c

+ 5 - 3
lib/gis/parser.c

@@ -1448,15 +1448,17 @@ char* G_option_to_separator(const struct Option *option)
     if (option->answer == NULL)
         G_fatal_error(_("No separator given"));
 
-    if (strcmp(option->answer, "space") == 0)
+    if (strcmp(option->answer, "pipe") == 0)
+        sep = G_store("|");
+    else if (strcmp(option->answer, "comma") == 0)
+        sep = G_store(",");
+    else if (strcmp(option->answer, "space") == 0)
 	sep = G_store(" ");
     else if (strcmp(option->answer, "tab") == 0 ||
              strcmp(option->answer, "\\t") == 0)
         sep = G_store("\t");
     else if (strcmp(option->answer, "newline") == 0)
         sep = G_store("\n");
-    else if (strcmp(option->answer, "comma") == 0)
-        sep = G_store(",");
     else {
         sep = G_store(option->answer);
     }

+ 2 - 2
lib/gis/parser_standard_options.c

@@ -544,9 +544,9 @@ struct Option *G_define_standard_option(int opt)
 	Opt->type = TYPE_STRING;
 	Opt->key_desc = "character";
 	Opt->required = NO;
-	Opt->answer = "|";
+	Opt->answer = "pipe";
 	Opt->label = _("Field separator");
-	Opt->description = _("Special characters: newline, space, comma, tab");
+	Opt->description = _("Special characters: pipe, comma, space, tab, newline");
 	break;
 
 	/* colors */