RE: [PATCH] vi: POSIX backslashes in expand_args

Morgan via busybox <[email protected]>
Newsgroups gmane.linux.busybox
Message-ID <[email protected]>
On Tue, 18 Aug 2026 18:05
David Laight <[email protected]> wrote:

> On Tue, 18 Aug 2026 08:54:11 +1000
> Morgan via busybox <[email protected]> wrote:
>
> > vi: POSIX backslashes in expand_args
>
> POSIX won't say anything about the way vi should handle \ escapes.
> The best you can do is look at how other re-implementations of vi
> behave.

It does under ex. (which the vi command-line reference refers to) [1]

> Backslash quoting in ex is non-intuitive. <backslash>-escapes are ignored
> unless they escape a special character; for example, when performing file
> argument expansion, the string "\\%" is equivalent to '\%', not "\<current
> pathname>". This can be confusing for users because <backslash> is usually
> one of the characters that causes shell expansion to be performed, and
> therefore shell quoting rules must be taken into consideration. Generally,
> quoting characters are only considered if they escape a special character,
> and a quoting character must be provided for each layer of parsing for
which
> the character is special. As another example, only a single <backslash> is
> necessary for the '\l' sequence in substitute replacement patterns,
because
> the character 'l' is not special to any parsing layer above it.

[1]:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html#tag_20_40
_18_08

> 	David
>
> [...]

-Morgan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.