mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-06-13 21:16:25 +02:00
51207: fix for read -d when the delimiter is a byte >= 0x80
This commit is contained in:
parent
a73c705b0c
commit
2701ab161d
|
@ -1,5 +1,8 @@
|
||||||
2022-12-16 Oliver Kiddle <opk@zsh.org>
|
2022-12-16 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
|
* Jun T.: 51207: Src/builtin.c, Test/B04read.ztst:
|
||||||
|
fix for read -d when the delimiter is a byte >= 0x80
|
||||||
|
|
||||||
* 51212: Etc/zsh-development-guide, Src/Modules/curses.c,
|
* 51212: Etc/zsh-development-guide, Src/Modules/curses.c,
|
||||||
Src/Modules/stat.c, Src/Modules/zftp.c, Src/Modules/zpty.c,
|
Src/Modules/stat.c, Src/Modules/zftp.c, Src/Modules/zpty.c,
|
||||||
Src/Modules/zutil.c, Src/Zle/compcore.c, Src/Zle/complete.c,
|
Src/Modules/zutil.c, Src/Zle/compcore.c, Src/Zle/complete.c,
|
||||||
|
|
|
@ -6286,7 +6286,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
|
||||||
char *laststart;
|
char *laststart;
|
||||||
size_t ret;
|
size_t ret;
|
||||||
#else
|
#else
|
||||||
char delim = '\n';
|
int delim = '\n';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (OPT_HASARG(ops,c='k')) {
|
if (OPT_HASARG(ops,c='k')) {
|
||||||
|
@ -6413,10 +6413,11 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
|
||||||
if (wi != WEOF)
|
if (wi != WEOF)
|
||||||
delim = (wchar_t)wi;
|
delim = (wchar_t)wi;
|
||||||
else
|
else
|
||||||
delim = (wchar_t)((delimstr[0] == Meta) ?
|
delim = (wchar_t) (unsigned char) ((delimstr[0] == Meta) ?
|
||||||
delimstr[1] ^ 32 : delimstr[0]);
|
delimstr[1] ^ 32 : delimstr[0]);
|
||||||
#else
|
#else
|
||||||
delim = (delimstr[0] == Meta) ? delimstr[1] ^ 32 : delimstr[0];
|
delim = (unsigned char) ((delimstr[0] == Meta) ?
|
||||||
|
delimstr[1] ^ 32 : delimstr[0]);
|
||||||
#endif
|
#endif
|
||||||
if (SHTTY != -1) {
|
if (SHTTY != -1) {
|
||||||
struct ttyinfo ti;
|
struct ttyinfo ti;
|
||||||
|
|
|
@ -82,6 +82,12 @@
|
||||||
>Testing the
|
>Testing the
|
||||||
>null hypothesis
|
>null hypothesis
|
||||||
|
|
||||||
|
print -n $'first line\x80second line\x80' |
|
||||||
|
while read -d $'\x80' line; do print $line; done
|
||||||
|
0:read with a delimiter >= 0x80
|
||||||
|
>first line
|
||||||
|
>second line
|
||||||
|
|
||||||
# Note that trailing NULLs are not stripped even if they are in
|
# Note that trailing NULLs are not stripped even if they are in
|
||||||
# $IFS; only whitespace characters contained in $IFS are stripped.
|
# $IFS; only whitespace characters contained in $IFS are stripped.
|
||||||
print -n $'Aaargh, I hate nulls.\0\0\0' | read line
|
print -n $'Aaargh, I hate nulls.\0\0\0' | read line
|
||||||
|
|
Loading…
Reference in New Issue