From b24b0f33d24b508b9ffcd1458dc7fd70e2add785 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 11 Sep 2023 20:47:33 -0400 Subject: Think I nailed it? --- main.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index 474aa42..b1eb159 100644 --- a/main.c +++ b/main.c @@ -40,6 +40,9 @@ #define ZX_CHAR_TOKEN_HIGH(c) \ (c >= 0xc0) +#define ZX_CHAR_TOKEN(c) \ + (ZX_CHAR_TOKEN_LOW(c) || ZX_CHAR_TOKEN_HIGH(c)) + #define ZX_BASIC_STATE_LEN 116 #define ZX_CHAR_TOKEN_INTEGRAL(c) \ @@ -268,7 +271,7 @@ static ssize_t zx_dump_basic(int fd) { while (1) { ssize_t readlen, len, i; zx_basic_line line; - uint8_t last = 0; + uint8_t last = 0xc0; if ((readlen = read(fd, &line, sizeof(line))) < 0) { goto error_io; @@ -276,27 +279,30 @@ static ssize_t zx_dump_basic(int fd) { break; } + len = le16toh(line.len); + + if (be16toh(line.num) == len) { + break; + } + if (printf("%d", (int)be16toh(line.num)) < 0) { goto error_io; } - len = le16toh(line.len); - if (read(fd, buf, len) < 0) { goto error_io; } for (i=0; i