bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnulib] wordexp function available on Android versions different fr


From: Bruno Haible
Subject: Re: [Gnulib] wordexp function available on Android versions different from 9? And how can we know? How do I discover that?
Date: Fri, 03 Sep 2021 17:18:37 +0200

Luca Saiu wrote:
> > Are you sure you don't want to use glob() or fnmatch() instead?
> 
> What I actually need is variable expansion, and wordexp can be called to
> do (almost) only that;

wordexp [1] also has a notion of quoting and unquoting. And of invalid 
characters
(<newline>, '|', '&', ';', '<', '>', '(', ')', '{', '}').

> In the end I am implementing something from scratch.

Then I would suggest just a homemade function that parses a string and does
variable expansion. This way you control the syntax and also what happens if
a variable's expansion references another variable. It's about 50 to 100 lines
of code to write it from scratch.

But if you really want wordexp(), then you can borrow the code from glibc
(2500 lines of code) and propose it as a Gnulib module [2], then use it from
Gnulib.

Bruno

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/wordexp.html
[2] https://www.gnu.org/software/gnulib/manual/html_node/Writing-modules.html






reply via email to

[Prev in Thread] Current Thread [Next in Thread]