NVIZ2.2

Jacques Bouchard bouchard at onera.fr
Thu Sep 16 05:13:40 EDT 1999


> Jaro Hofierka wrote:
> > 
> > the problem is in g.gisenv (main.c) where you must change
> > printf() to fprintf().
> > 
> > BTW, these printf() should be changed in all grass commands.
> 
> Uh ? I don't understand that.  There is no difference between
> printf( xxx...) and fprintf( stdout, xxx...).  And if the first
> arg of fprintf is not of type *FILE, you will get some run-time
> error...
> 
> -- 
> Michel Wurtz    ENGEES - CEREG

I don't understand any more than Michel that subtle
difference between printf and fprintf!

> fprintf(stderr,...) works, printf() not.
> 
> Jaro

What do you mean whith "works" ?

fprintf(stderr,...) is no better than fprintf(stdout,...)
(or printf(...) in g.gisenv), perhaps worse:

the stderr should be reserved for error messages
*when possible*.

The real problem in g.gisenv, when used from nviz (or from
any TCL/TK program, is that it doesn't contain any return
statement, although the type of the function "main" is "int":

this is certainly no good programming style!

So the value returned by the function "main" is undefined and
depends on the C implementation:

- if it is always 0: no problem: nviz will always work too

- if it is <> 0, the OS (and TCL) thinks the binary "g.gisenv"
  hasn't worked properly, hence the value returned by the
  procedure "g.gisenv" in "mapBrowser.tcl" contains an error
  message that prevents the map browser of nviz to work
  (unless the error message is removed, as Luca Palmeri suggests).

So, please, insert a "return 0;" before the last line in
"g.gisenv/main.c".

Jacques Bouchard



More information about the grass-user mailing list