tools: kwboot: Use a function to check whether received byte is a Xmodem reply
This is a non-functional change that should make the code more readable.
Signed-off-by: Marek BehĂșn <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 7f231c0..2e5684b 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -376,6 +376,12 @@
}
static int
+_is_xm_reply(char c)
+{
+ return c == ACK || c == NAK || c == CAN;
+}
+
+static int
kwboot_xm_sendblock(int fd, struct kwboot_block *block)
{
int rc, retries;
@@ -395,10 +401,10 @@
c = NAK;
}
- if (c != ACK && c != NAK && c != CAN)
+ if (!_is_xm_reply(c))
printf("%c", c);
- } while (c != ACK && c != NAK && c != CAN);
+ } while (!_is_xm_reply(c));
if (c != ACK)
kwboot_progress(-1, '+');