Markus Neteler wrote:

> > 7.0 has G_popen_{read,write}, which do most of the work for you, but
> > these haven't been back-ported to 6.x yet.
> 
> I have compared the two lib/gis/popen.c files. Is backport as "easy" as
> adding the GRASS 7 functions in 6 to also keep the old G_popen() and
> G_pclose() for backward compatibility?

Yes.

But the existing G_popen() and G_pclose() functions should either be
removed or replaced with:

        FILE *G_popen(const char *cmd, const char *mode)
        {
            return popen(cmd, mode);
        }
        
        int G_pclose(FILE *ptr)
        {
            return pclose(ptr);
        }

There's no reason to (attempt to) provide our own implementations of
these functions, particularly when the Windows version is completely
broken.

Note that G_popen() has already been removed from 6.5, with the code
changed to use popen() instead. This still suffers from the usual
issues with trying to reliably construct a shell command, but it
avoids the G_popen()-specific bugs.

In 7.0, all references to popen() have been removed, and the only use
of system() is in D_close_driver(), to execute a shell command
specified by the GRASS_NOTIFY environment variable.

-- 
Glynn Clements <[email protected]>
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to