1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-06 23:31:28 +02:00

41484: Make ${(q+)...} quote backsleshes.

This commit is contained in:
Martijn Dekker 2017-08-03 19:57:04 +02:00 committed by Peter Stephenson
parent 623be7199e
commit a51cd62b45
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2017-08-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Martijn: 41484: Src/utils.c: ${(q+)...} didn't properly
quote backslashes.
2017-08-02 Daniel Shahaf <d.s@daniel.shahaf.name>
* 41479: Completion/Unix/Command/_xz: Complete compressed,

View file

@ -5119,7 +5119,7 @@ niceztrlen(char const *s)
* If flags contains NICEFLAG_HEAP, use the heap for *outstrp, else
* zalloc.
* If flags contsins NICEFLAG_QUOTE, the output is going to be within
* $'...', so quote "'" with a backslash.
* $'...', so quote "'" and "\" with a backslash.
*/
/**/
@ -5175,6 +5175,10 @@ mb_niceformat(const char *s, FILE *stream, char **outstrp, int flags)
fmt = "\\'";
newl = 2;
}
else if (c == L'\\' && (flags & NICEFLAG_QUOTE)) {
fmt = "\\\\";
newl = 2;
}
else
fmt = wcs_nicechar_sel(c, &newl, NULL, flags & NICEFLAG_QUOTE);
break;