Follow-up Comment #2, bug #64816 (project findutils):

Oh and just for the records:

If I'm not mistaken, bash's implementation of `%q` in its `printf` builtin can
be found at:
https://github.com/bminor/bash/blob/ec8113b9861375e4e17b3307372569d429dec814/builtins/printf.def#L595-L644

with the actual work horses being:
https://github.com/bminor/bash/blob/ec8113b9861375e4e17b3307372569d429dec814/lib/sh/strtrans.c#L230-L317

or:

https://github.com/bminor/bash/blob/ec8113b9861375e4e17b3307372569d429dec814/lib/sh/shquote.c#L261-L312

(notice that these are unofficial git mirrors)


Also note, that for such functionality to be useful in the way I propose, it
would be crucial that the escaping is done right, so that and arbitrary input
string is quoted in a manner so that it can really be safely re-used as input
(e.g. in `eval`) without any expansions/substitutions/etc. happening.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64816>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/


Reply via email to