summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2021-09-24 23:06:49 +0200
committerStefan Roese <sr@denx.de>2021-10-01 11:07:13 +0200
commit408ea6138bc5e94245ea0ebcb87666b9a47aed99 (patch)
tree26e532791061c9e78ff903bd287e41a7dae90ec3 /tools
parent2ef87f75d16bcdc2a29e7339b8f2c2508985fe12 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/kwboot.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 7f231c0823..2e5684b91c 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -376,6 +376,12 @@ kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
}
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 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block)
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, '+');