[GRASS-dev] Merging stdout and stderr

Hamish hamish_nospam at yahoo.com
Mon Nov 20 17:08:20 EST 2006


> >>> 2. Might it be a worthwhile idea to include a simple program with
> >>> GRASS that did this (copies everything from stdin to stdout) so we
> >>> can be sure what's going on?
> >>
> >> I suggest the latter, i.e. write our own mini-"cat" program. It
> >> will need to explicitly put stdin/stdout into line-buffered mode
> >> (pipes are block-buffered by default).

Hamish:
> > see also:
> >  lib/init/echo.c -> $GISBASE/etc/echo
> >
> > funny that that outputs to stderr..

Paul:
> Yes! This would be useful on Windows if it didn't write to stderr, as
> the Windows echo behaves differently to the Unix one. The comments in
> the header in the source say it writes to stdout but the earliest CVS
> version from 1999 writes to stderr. I wonder could we change it. I
> wonder does  anything use it and/or need the stderr functionality...


grass63$ grep -rI etc/echo *
lib/init/echo.c: * $GISBASE/etc/echo [-n] args

grass-5.4.0$ grep -rI etc/echo *
pkg/prototype:f none /opt/GNUgrass/grass5/etc/echo=/opt/GNUgrass/grass5/etc/echo 0775 root bin
rpmspecs/rpm.specs:%{_prefix}/grass5/etc/echo
src/general/init/echo.c: * $GISBASE/etc/echo [-n] args
src.contrib/SCS/scripts/shells/dlg_extract.sh:$GISBASE/etc/echo -n  "Enter DEVICE or FILE_NAME for input : "
src.contrib/SCS/scripts/shells/dlg_extract.sh:$GISBASE/etc/echo -n  "Enter TOTAL NUMBER of FILES : "
src.contrib/SCS/scripts/shells/dlg_extract.sh:$GISBASE/etc/echo -n  "Enter LRECL: "
src.contrib/SCS/scripts/shells/dlg_extract.sh:$GISBASE/etc/echo -n  "Enter BLKSIZE:  "
src.contrib/SCS/scripts/shells/dlg_extract.sh:  $GISBASE/etc/echo -n  "Enter NUMBER OF FILE TO EXTRACT: "
src.contrib/SCS/scripts/shells/dlg_extract.sh:  $GISBASE/etc/echo -n  "Enter No. of Records: "
src.contrib/SCS/scripts/shells/dlg_extract.sh:  $GISBASE/etc/echo -n  "Enter name for output file: "
src.contrib/SCS/scripts/shells/dlg_extract.sh:  $GISBASE/etc/echo -n  "ARE THESE CORRECT [y/n]: "
src.contrib/SCS/scripts/shells/dlg_extract.sh:  $GISBASE/etc/echo -n  "Do you want to EXTRACT another FILE [y/n]: "

so nothing in GRASS 6 uses it.

It would be pretty easy to change it output to stdout and add a flag to
to it to have it output to stderr.


Hamish




More information about the grass-dev mailing list