[GRASS-dev] using G_parser() --script in the wild

Hamish hamish_nospam at yahoo.com
Mon Feb 26 22:31:25 EST 2007


Hi,

WRT d.path bug #302, d.path from GIS.m runs without a backdrop map.
 http://wald.intevation.org/tracker/index.php?func=detail&aid=302


After coding a solution in the d.path C code using D_get_dig_list() to
check if the target map was already drawn, and if not draw it by closing
the driver, running G_system(d.vect), and then opening the driver again,
I decided that that solution was fragile and not so good.

So I decided to to it with a wrapper shell script instead using the new
--script parser option. (see attached)


Problem:
the template script calls g.parser (which resets "$@" command line
options to "@ARGS_PARSED@") before I can get my hands on it, and I'd
rather not have to code all the command line options by hand.

Can we add a line in G_script() before the g.parser call like:

GRASS_CL_OPTS="$@"

if [ "$1" != "@ARGS_PARSED@" ] ; then
  exec g.parser "$0" "$@"
fi

?


Portability: currently I have it creating a temp file and then making
it executable with chmod. Would it be more portable to add a
permissions=777 option to g.tempfile to have this done during creation?
Is that in any way translateable to native Windows? if it will only work
with unix, may as well stick to chmod? (a -d create directory flag would
be nice too)


thanks,
Hamish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gen_d.path_wrapper.sh
Type: text/x-sh
Size: 634 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070227/b156f951/gen_d.path_wrapper.bin


More information about the grass-dev mailing list