[GRASS-dev] etc file finder, take 2

William Kyngesburye woklist at kyngchaos.com
Wed Apr 18 09:57:50 EDT 2007


(ooh, my brain hurts after this - not made for C)

Here's what I came up with.  It uses an env var, GRASS_ADDON_ETC,  
much like the PATH and GRASS_ADDON_PATH vars - a colon-delimited list  
of paths to look in.  And finally checks the GRASS application etc/.

It returns the full path to the found file or folder, or null if not  
found.

-------------- next part --------------
Skipped content of type multipart/appledouble-------------- next part --------------

And a companion g.findetc for use in scripts:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: application/octet-stream
Size: 1242 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070418/d03e15d5/main.obj
-------------- next part --------------


Comments welcome.  As before, I'm not much of a C programmer, so  
there is probably something wrong - maybe memory cleanup needed or  
very inefficient.  At least it tested OK.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"This is a question about the past, is it? ... How can I tell that  
the past isn't a fiction designed to account for the discrepancy  
between my immediate physical sensations and my state of mind?"

- The Ruler of the Universe




More information about the grass-dev mailing list