Add TFTP upload spinner
This commit is contained in:
parent
79daac1e22
commit
cf95657f5d
1 changed files with 6 additions and 0 deletions
6
tftp.c
6
tftp.c
|
@ -305,6 +305,8 @@ inline bool tftp_is_valid_filename(const char *filename)
|
||||||
return strlen(filename) <= 255 && is_netascii(filename);
|
return strlen(filename) <= 255 && is_netascii(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *spinner = "\\|/-";
|
||||||
|
|
||||||
int tftp_put(struct nmrpd_args *args)
|
int tftp_put(struct nmrpd_args *args)
|
||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
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, DATA);
|
||||||
pkt_mknum(tx + 2, block);
|
pkt_mknum(tx + 2, block);
|
||||||
len = read(fd, tx + 4, blksize);
|
len = read(fd, tx + 4, blksize);
|
||||||
|
|
Loading…
Add table
Reference in a new issue