From c3cb12e87f7dd29f5ed5a8da179993a1affc20d8 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Fri, 9 May 2008 04:50:24 -0400 Subject: [PATCH] Make binwire a little bit more error-resistant --- binwire.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/binwire.c b/binwire.c index 3f19ca2..101b5c1 100644 --- a/binwire.c +++ b/binwire.c @@ -87,14 +87,22 @@ void main(int argc, char **argv) while ((sz = read(rfd, buf+3, 255)) > 0) { int rv; + char abuf[5]; buf[0] = 0x1B; buf[1] = 'D'; buf[2] = sz+1; + abuf[0] = 0x1B; + abuf[1] = 'A'; + abuf[2] = (tc >> 16) & 0xFF; + abuf[3] = (tc >> 8) & 0xFF; + abuf[4] = tc & 0xFF; tc += sz; retry: + dowrite(abuf, 5); + rv = expect("A", 1); dowrite(buf, sz + 3); fprintf(stderr, "Data sent (%d)\n", tc); - rv = expect("D", 1); + rv |= expect("D", 1); expect_no_chars(); if (rv) { -- 2.43.0