diff options
author | Ron Yorston <rmy@pobox.com> | 2021-09-21 15:19:18 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-09-21 15:19:18 +0100 |
commit | 90b3ba992ecb39e32e5a66b2e37579becc56d286 (patch) | |
tree | 4c4a2c9e1baeb8230d78efd058bb4bcabc3fd12b /libbb/lineedit.c | |
parent | df34f5e92b1d10f0bb858d2ea6e8c249e87ac593 (diff) | |
parent | 56f0e886db0543a27f369d7f95eb9da2fb3d069c (diff) | |
download | busybox-w32-90b3ba992ecb39e32e5a66b2e37579becc56d286.tar.gz busybox-w32-90b3ba992ecb39e32e5a66b2e37579becc56d286.tar.bz2 busybox-w32-90b3ba992ecb39e32e5a66b2e37579becc56d286.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index f17c9a215..7c46fa5db 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1219,7 +1219,16 @@ static void showfiles(void) | |||
1219 | 1219 | ||
1220 | static const char *is_special_char(char c) | 1220 | static const char *is_special_char(char c) |
1221 | { | 1221 | { |
1222 | return strchr(" `\"#$%^&*()=+{}[]:;'|\\<>", c); | 1222 | // {: It's mandatory to escape { only if entire name is "{" |
1223 | // (otherwise it's not special. Example: file named "{ " | ||
1224 | // can be escaped simply as "{\ "; "{a" or "a{" need no escaping), | ||
1225 | // or if shell supports brace expansion | ||
1226 | // (ash doesn't, hush optionally does). | ||
1227 | // (): unlike {, shell treats () specially even in contexts | ||
1228 | // where they clearly are not valid (e.g. "echo )" is an error). | ||
1229 | // #: needs escaping to not start a shell comment. | ||
1230 | return strchr(" `'\"\\#$~?*[{()&;|<>", c); | ||
1231 | // Used to also have %^=+}]: but not necessary to escape? | ||
1223 | } | 1232 | } |
1224 | 1233 | ||
1225 | static char *quote_special_chars(char *found) | 1234 | static char *quote_special_chars(char *found) |