Browse Source

v.segment: accept stdin as default

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58050 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 11 years ago
parent
commit
4d0cd3a67a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      vector/v.segment/main.c

+ 2 - 1
vector/v.segment/main.c

@@ -70,6 +70,7 @@ int main(int argc, char **argv)
     
     
     file_opt = G_define_standard_option(G_OPT_F_INPUT);
     file_opt = G_define_standard_option(G_OPT_F_INPUT);
     file_opt->key = "file";
     file_opt->key = "file";
+    file_opt->required = NO;
     file_opt->label = _("Name of file containing segment rules");
     file_opt->label = _("Name of file containing segment rules");
     file_opt->description = _("'-' for standard input");
     file_opt->description = _("'-' for standard input");
 
 
@@ -86,7 +87,7 @@ int main(int argc, char **argv)
     Vect_check_input_output_name(in_opt->answer, out_opt->answer,
     Vect_check_input_output_name(in_opt->answer, out_opt->answer,
 				 G_FATAL_EXIT);
 				 G_FATAL_EXIT);
 
 
-    if (strcmp(file_opt->answer, "-")) {
+    if (file_opt->answer && strcmp(file_opt->answer, "-") != 0) {
 	/* open input file */
 	/* open input file */
 	if ((in_file = fopen(file_opt->answer, "r")) == NULL)
 	if ((in_file = fopen(file_opt->answer, "r")) == NULL)
 	    G_fatal_error(_("Unable to open input file <%s>"),
 	    G_fatal_error(_("Unable to open input file <%s>"),