[GRASS-SVN] r34414 - in grass/trunk/raster: r.reclass r.recode
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 20 16:37:40 EST 2008
Author: glynn
Date: 2008-11-20 16:37:39 -0500 (Thu, 20 Nov 2008)
New Revision: 34414
Modified:
grass/trunk/raster/r.reclass/main.c
grass/trunk/raster/r.recode/main.c
Log:
Use rules=- to read from stdin
Modified: grass/trunk/raster/r.reclass/main.c
===================================================================
--- grass/trunk/raster/r.reclass/main.c 2008-11-20 21:26:40 UTC (rev 34413)
+++ grass/trunk/raster/r.reclass/main.c 2008-11-20 21:37:39 UTC (rev 34414)
@@ -60,9 +60,10 @@
parm.rules = G_define_option();
parm.rules->key = "rules";
parm.rules->type = TYPE_STRING;
- parm.rules->description = _("File containing reclass rules");
+ parm.rules->description = _("File containing reclass rules; \"-\" to read from stdin");
parm.rules->key_desc = "name";
parm.rules->gisprompt = "old_file,file,input";
+ parm.rules->answer = "-";
parm.title = G_define_option();
parm.title->key = "title";
@@ -82,7 +83,7 @@
G_fatal_error(_("Input map can NOT be the same as output map"));
srcfp = stdin;
- if (parm.rules->answer) {
+ if (strcmp(parm.rules->answer, "-") != 0) {
srcfp = fopen(parm.rules->answer, "r");
if (!srcfp)
G_fatal_error(_("Cannot open rules file <%s>"),
Modified: grass/trunk/raster/r.recode/main.c
===================================================================
--- grass/trunk/raster/r.recode/main.c 2008-11-20 21:26:40 UTC (rev 34413)
+++ grass/trunk/raster/r.recode/main.c 2008-11-20 21:37:39 UTC (rev 34414)
@@ -42,9 +42,6 @@
struct Flag *a, *d;
} parm;
- /* any interaction must run in a term window */
- G_putenv("GRASS_UI_TERM", "1");
-
G_gisinit(argv[0]);
module = G_define_module();
@@ -59,9 +56,10 @@
parm.rules = G_define_option();
parm.rules->key = "rules";
parm.rules->type = TYPE_STRING;
- parm.rules->description = _("File containing recode rules");
+ parm.rules->description = _("File containing recode rules; \"-\" to read from stdin");
parm.rules->key_desc = "name";
parm.rules->gisprompt = "old_file,file,input";
+ parm.rules->answer = "-";
parm.title = G_define_option();
parm.title->key = "title";
@@ -87,7 +85,7 @@
make_dcell = parm.d->answer;
srcfp = stdin;
- if (parm.rules->answer) {
+ if (strcmp(parm.rules->answer, "-") != 0) {
srcfp = fopen(parm.rules->answer, "r");
if (!srcfp)
G_fatal_error(_("Cannot open rules file <%s>"),
More information about the grass-commit
mailing list