From cf95657f5da5dab919f861febf59cbc9d09de833 Mon Sep 17 00:00:00 2001 From: "Joseph C. Lehner" Date: Mon, 2 Mar 2020 14:21:02 +0100 Subject: [PATCH] Add TFTP upload spinner --- tftp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tftp.c b/tftp.c index eb2c314..735f992 100644 --- a/tftp.c +++ b/tftp.c @@ -305,6 +305,8 @@ inline bool tftp_is_valid_filename(const char *filename) return strlen(filename) <= 255 && is_netascii(filename); } +static const char *spinner = "\\|/-"; + int tftp_put(struct nmrpd_args *args) { struct sockaddr_in addr; @@ -416,6 +418,10 @@ int tftp_put(struct nmrpd_args *args) } } + printf("%c ", spinner[block & 3]); + fflush(stdout); + printf("\b\b"); + pkt_mknum(tx, DATA); pkt_mknum(tx + 2, block); len = read(fd, tx + 4, blksize); -- 2.25.1