Here's one of Roland's old proposals:

RFE: Extend ksh93's printf %q to accept a modifier which defines the
quoting mode. Supported modes should be:

%(kshliteral)q same as existing %q
%(shliteral)q quote string with '\' (including spaces) that a POSIX
shell (and even the old bourne shell) can accept it
%(xml)q convert string into an xml literal (same as %H)
%(egrep)q convert string into a literal accepted plainly by egrep
(e.g. things like '[', ']', '(', ')' etc. are quoted)
%(grep)q convert string into a literal accepted plainly by grep (e.g.
things like '[', ']', etc. are quoted)
%(agrep)q, %(xgrep)q convert string into a literal accepted plainly by
grep -X/-A (e.g. things like '[', ']', '(', ')' etc. are quoted)
%(urlencode)q convert string into a literal accepted plainly as URL
(e.g. space gets encoded as '+', '!' as '%21', '*' as '%2A' etc.)
The modifers scheme will allow future extensions easily.

Comments welcome, I can try to make the patches if David and Glenn
like the idea.

Olga
-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     [email protected]   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`

_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to