[GRASS-dev] Re: testing native winGRASS

Moritz Lennert mlennert at club.worldonline.be
Mon Mar 19 06:11:59 EDT 2007


On 19/03/07 04:09, Glynn Clements wrote:
> Moritz Lennert wrote:

 > I'm not sure. It would be nice if someone would volunteer to write the
 > Windows implementation (using CreateProcess()).

I guess this means more than just replacing

execvp(command, args);

by a

CreateProcess() equivalent ?


 >
 > Hmm. We might want a function which returns the name of the platform's
 > null device (i.e. /dev/null on Unix, NUL: on Windows).


Would this just be a function returning 'NUL' or '/dev/null' as a 
string, or do we have to get the name of the null device from the system ?

> 
>> I also see the following code in ls_groups.c (line 37ff):
>>
>> strcpy (buf, "cd ");
>> G__file_name (buf+strlen(buf), element, "", G_mapset());
>> strcat (buf, ";ls");
>> if (!full) strcat (buf, " -C");
>> if ((ls = popen (buf, "r")))
> 
> This should probably use G__ls().
> 
>> Isn't this somewhat equivalent to a system() call ?
> 
> popen() is similar to system, in that it spawns a command using a
> shell. But popen() returns a FILE* corresponding to either the
> program's stdin ("w") or stdout ("r"), and doesn't wait for the
> command to complete.
> 
> You can achieve the same thing using G_spawn_ex(), pipe() and
> fdopen(), e.g.:

Again, depending on a windows version of G_spawn_ex()...

Moritz




More information about the grass-dev mailing list