[GRASS5] d.vect.area

Glynn Clements glynn.clements at virgin.net
Sun Feb 3 21:28:57 EST 2002


Eric G. Miller wrote:

> > > I've modified d.vect.area a little.  Two things may be of interest to you.
> > > One is the possibility of specifying the "legend" file via standard
> > > input by using "legend=-".
> > 
> > Warning: if you do this, you need to massage the command string which
> > is passed to D_add_to_list().
> 
> Massage how?  I do see the problem though.  Maybe I should take that out?

Well, d.text does this:

        wind_file_name = G_tempfile();

	<copy data from stdin to temp file as it is processed>

	max_buff = G_malloc(strlen(wind_file_name)+strlen(G_recreate_command())+4);
	sprintf(max_buff, "%s < %s", G_recreate_command(), wind_file_name);
	D_add_to_list(max_buff);
	G_free(max_buff);

Temporary files are cleaned up at session exit, so they should remain
around long enough for XDRIVER redraws. However, scripts created with
d.save wouldn't work in subsequent sessions.

In a sense, d.text is a special case, as reading the text from stdin
was the historical behaviour.

Also, regardless of whether a given command has explicit support for
reading from stdin, a user could still use "/dev/stdin", with the same
consequences.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list