diff options
-rw-r--r-- | src/bfstd.c | 2 | ||||
-rw-r--r-- | tests/bfstd.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/bfstd.c b/src/bfstd.c index 12af438..2499f00 100644 --- a/src/bfstd.c +++ b/src/bfstd.c @@ -908,7 +908,7 @@ static char *dollar_quote(char *dest, char *end, const char *str, size_t len, en /** How much of this string is safe as a bare word? */ static size_t bare_len(const char *str, size_t len) { // https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02 - size_t ret = strcspn(str, "|&;<>()$`\\\"' *?[#˜=%!{}"); + size_t ret = strcspn(str, "|&;<>()$`\\\"' *?[#~=%!{}"); return ret < len ? ret : len; } diff --git a/tests/bfstd.c b/tests/bfstd.c index 3ffab41..dc5ceaa 100644 --- a/tests/bfstd.c +++ b/tests/bfstd.c @@ -75,6 +75,7 @@ bool check_bfstd(void) { ret &= check_wordesc("\"word's\"", "'\"word'\\''s\"'", WESC_SHELL); ret &= check_wordesc("\033[1mbold's\033[0m", "$'\\e[1mbold\\'s\\e[0m'", WESC_SHELL | WESC_TTY); ret &= check_wordesc("\x7F", "$'\\x7F'", WESC_SHELL | WESC_TTY); + ret &= check_wordesc("~user", "\"~user\"", WESC_SHELL); const char *charmap = nl_langinfo(CODESET); if (strcmp(charmap, "UTF-8") == 0) { @@ -82,6 +83,7 @@ bool check_bfstd(void) { ret &= check_wordesc("\xF0\x9F", "$'\\xF0\\x9F'", WESC_SHELL | WESC_TTY); ret &= check_wordesc("\xF0\x9F\x98", "$'\\xF0\\x9F\\x98'", WESC_SHELL | WESC_TTY); ret &= check_wordesc("\xF0\x9F\x98\x80", "\xF0\x9F\x98\x80", WESC_SHELL | WESC_TTY); + ret &= check_wordesc("\xCB\x9Cuser", "\xCB\x9Cuser", WESC_SHELL); } ret &= bfs_check(xstrwidth("Hello world") == 11); |