Re: searchpath

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: searchpath

J.J. Green
Hi all

I've implemented the searchpath as suggested
by Martin Hedenfalk, it seems to work rather
well.  A git patch against today's master version
is attached.

Note that this requires stat() to check whether
files exist, so I've added a new check for
sys/stat.h in configure.ac.  If not found then
the code will still compile but included files
will not be found.  I would imagine it would be
fairly easy to add an equivalent WIN32 file check,
but I don't use windows so I couldn't test it.

A new file tests/searchpath.c tests this
functionality

Cheers

Jim
--
J.J. Green,  Seaview Sensing Ltd.,
http://seaviewsensing.com/

_______________________________________________
Confuse-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/confuse-devel

confuse-searchpath.patch (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: searchpath patch 3

Martin Hedenfalk-4
27 apr 2010 kl. 13.03 skrev J.J. Green:

> Hi Martin
>
> Attached the 3rd version of the searchpath patch.
> This addresses two problems,

Hi Jim, thank you for the patch. I'll test it this weekend.


> 1) In testing my own code I realised that, with the
>   searchpath active it was not possible to specify
>   an absolute path to the root cfg file, which is
>   contrary to the "principle of least surprise".
>   So now, in the case that a searchpath is given, but
>   an absolute path is specified in the cfg_parse
>   filename (after tilde expansion), then we no longer
>   attempt to find the file on the searchpath, but pass
>   it directly to cfg_parse(). Likewise in the lexer
>   include action. This needs a new cfg_absolute_path()
>   function which I have implemented for Unix and win32,
>   but the win32 version is **entirely untested**.
I don't have access to a win32 system either, so any libconfuse users on the list that can test this? If not, the win32 parts will be #ifdef'd out.


> 2) The segfault I mentioned yesterday seems to be a
>   bug in the libconfuse git master but which has
>   been fixed in the Debian port already, namely
>
> -    if (cfg_include_stack_ptr <= 0)
> +    if (string_scan_state != 0 || cfg_include_stack_ptr <= 0)
>
>   in the lexer <<EOF>> action.  I know that Debian reports
>   its fixes upstream, so you should have received this
>   report already.
I'll make sure it gets committed this time.

        -martin

> Cheers
>
> Jim
> --
> J.J. Green,  Seaview Sensing Ltd.,
> http://seaviewsensing.com/


_______________________________________________
Confuse-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/confuse-devel

confuse-searchpath-3.patch (28K) Download Attachment