diff options
| author | Matěj Cepl <mcepl@cepl.eu> | 2022-11-26 13:22:35 +0100 |
|---|---|---|
| committer | Felix Van der Jeugt <felix.vanderjeugt@posteo.net> | 2023-02-12 23:19:36 +0100 |
| commit | e45f573ddd592f38459591db1924c27272b2b763 (patch) | |
| tree | 0be6aff8b6905d65d19122c0547d15dd92cb1f3b /vis-cmds.c | |
| parent | d176a84fcdd82423aadfdbc30a66c5ed7d2e2a25 (diff) | |
| download | vis-e45f573ddd592f38459591db1924c27272b2b763.tar.gz vis-e45f573ddd592f38459591db1924c27272b2b763.tar.xz | |
Do tilde expansion only for the tilde character at the beginning of the pattern.
Diffstat (limited to 'vis-cmds.c')
| -rw-r--r-- | vis-cmds.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -379,7 +379,11 @@ static bool is_file_pattern(const char *pattern) { struct stat meta; if (stat(pattern, &meta) == 0 && S_ISDIR(meta.st_mode)) return true; - for (char special[] = "*?[{$~", *s = special; *s; s++) { + /* tilde expansion is defined only for the tilde at the + beginning of the pattern. */ + if (pattern[0] == '~') + return true; + for (char special[] = "*?[{$", *s = special; *s; s++) { if (strchr(pattern, *s)) return true; } |
