shell: correctly count backslashes in read built-in
No binary (build failed)
gcc -Wp,-MD,applets/.usage.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -Iinclude -Iinclude -o applets/usage applets/usage.c
(log yok)
| @@ -1,3 +1,5 @@ | |
| test | |
| tes | |
| tes | |
| + | 12 |
| + | \1 |
| @@ -1,3 +1,5 @@ | |
| echo 'test' | (read reply; echo "$reply") | |
| echo 'test' | (read -n 3 reply; echo "$reply") | |
| echo 'test' | (read -n3 reply; echo "$reply") | |
| + | echo '\1\2' | (read -n 2 reply; echo "$reply") |
| + | echo '\1\2' | (read -r -n 2 reply; echo "$reply") |
| @@ -1,3 +1,5 @@ | |
| test | |
| tes | |
| tes | |
| + | 12 |
| + | \1 |
| @@ -1,3 +1,5 @@ | |
| echo 'test' | (read reply; echo "$reply") | |
| echo 'test' | (read -n 3 reply; echo "$reply") | |
| echo 'test' | (read -n3 reply; echo "$reply") | |
| + | echo '\1\2' | (read -n 2 reply; echo "$reply") |
| + | echo '\1\2' | (read -r -n 2 reply; echo "$reply") |
| @@ -279,7 +279,7 @@ shell_builtin_read(struct builtin_read_params *params) | |
| } | |
| put: | |
| bufpos++; | |
| - | } while (--nchars); |
| + | } while (backslash || --nchars); |
| if (argv[0]) { | |
| /* Remove trailing space $IFS chars */ | |