Browse Source

r.series: allow file=- for stdin (backport from trunk, https://trac.osgeo.org/grass/changeset/60522)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@60523 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 11 years ago
parent
commit
4fcb2b23ae
1 changed files with 8 additions and 4 deletions
  1. 8 4
      raster/r.series/main.c

+ 8 - 4
raster/r.series/main.c

@@ -205,10 +205,14 @@ int main(int argc, char *argv[])
     if (parm.file->answer) {
     if (parm.file->answer) {
 	FILE *in;
 	FILE *in;
 	int max_inputs;
 	int max_inputs;
-    
-	in = fopen(parm.file->answer, "r");
-	if (!in)
-	    G_fatal_error(_("Unable to open input file <%s>"), parm.file->answer);
+
+	if (strcmp(parm.file->answer, "-") == 0)
+	    in = stdin;
+	else {
+	    in = fopen(parm.file->answer, "r");
+	    if (!in)
+		G_fatal_error(_("Unable to open input file <%s>"), parm.file->answer);
+	}
     
     
 	num_inputs = 0;
 	num_inputs = 0;
 	max_inputs = 0;
 	max_inputs = 0;