bc: fix another thinko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
335b4efd2f
commit
818b602c88
@ -7059,22 +7059,21 @@ static BC_STATUS zbc_vm_stdin(void)
|
|||||||
str = 0;
|
str = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
size_t len;
|
size_t len;
|
||||||
char *string;
|
|
||||||
|
|
||||||
bc_read_line(&buf);
|
bc_read_line(&buf);
|
||||||
len = buf.len - 1;
|
len = buf.len - 1;
|
||||||
if (len == 0) // "" buf means EOF
|
if (len == 0) // "" buf means EOF
|
||||||
break;
|
break;
|
||||||
string = buf.v;
|
|
||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
if (str && buf.v[0] == G.send)
|
if (str && buf.v[0] == G.send)
|
||||||
str -= 1;
|
str -= 1;
|
||||||
else if (buf.v[0] == G.sbgn)
|
else if (buf.v[0] == G.sbgn)
|
||||||
str += 1;
|
str += 1;
|
||||||
} else {
|
} else {
|
||||||
|
char *string = buf.v;
|
||||||
while (*string) {
|
while (*string) {
|
||||||
char c = *string;
|
char c = *string;
|
||||||
if (string != buf.v && string[-1] != '\\') {
|
if (string == buf.v || string[-1] != '\\') {
|
||||||
// checking applet type is cheaper than accessing sbgn/send
|
// checking applet type is cheaper than accessing sbgn/send
|
||||||
if (IS_BC) // bc: sbgn = send = '"'
|
if (IS_BC) // bc: sbgn = send = '"'
|
||||||
str ^= (c == '"');
|
str ^= (c == '"');
|
||||||
|
@ -16,6 +16,16 @@ testing "bc comment 2: /*/ is not a closed comment" \
|
|||||||
"4\n" \
|
"4\n" \
|
||||||
"" "1 /*/ + 2 */ + 3"
|
"" "1 /*/ + 2 */ + 3"
|
||||||
|
|
||||||
|
testing "bc backslash 1" \
|
||||||
|
"bc" \
|
||||||
|
"3\n" \
|
||||||
|
"" "1 \\\\\n + 2"
|
||||||
|
|
||||||
|
testing "bc string 1" \
|
||||||
|
"bc" \
|
||||||
|
"STR\n" \
|
||||||
|
"" "\"STR\n\""
|
||||||
|
|
||||||
tar xJf bc_large.tar.xz
|
tar xJf bc_large.tar.xz
|
||||||
|
|
||||||
for f in bc*.bc; do
|
for f in bc*.bc; do
|
||||||
|
Loading…
Reference in New Issue
Block a user