From 932424af0aadcfcc9dcf3f66ff844fea6ac53986 Mon Sep 17 00:00:00 2001 From: Thomas Albers Date: Thu, 10 Aug 2023 11:12:23 +0200 Subject: Add progress option to write command --- zup.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'zup.c') diff --git a/zup.c b/zup.c index 844a693..d3acc54 100644 --- a/zup.c +++ b/zup.c @@ -97,17 +97,18 @@ parse_baud(const char *str) static int parse_options(int argc, char *const argv[]) { - const char *sopts = "b:p:hHVRrv"; + const char *sopts = "b:p:hHVPRrv"; const struct option lopts[] = { - { "baud", required_argument, 0, 'b'}, - { "verbose", no_argument, 0, 'v'}, - { "version", no_argument, 0, 'V'}, - { "raw", no_argument, 0, 'r'}, - { "repl", no_argument, 0, 'R'}, - { "port", required_argument, 0, 'p'}, - { "human-readable", no_argument, 0, 'H'}, - { "help", no_argument, 0, 'h'}, - { 0, 0, 0, 0 } + {"baud", required_argument, 0, 'b'}, + {"verbose", no_argument, 0, 'v'}, + {"version", no_argument, 0, 'V'}, + {"raw", no_argument, 0, 'r'}, + {"repl", no_argument, 0, 'R'}, + {"port", required_argument, 0, 'p'}, + {"progress", no_argument, 0, 'P'}, + {"human-readable", no_argument, 0, 'H'}, + {"help", no_argument, 0, 'h'}, + { 0, 0, 0, 0 } }; int c; @@ -130,6 +131,10 @@ parse_options(int argc, char *const argv[]) strncpy(param.port, optarg, LEN(param.port)); break; + case 'P': + param.show_progress = 1; + break; + case 'R': param.repl = 1; break; @@ -215,7 +220,8 @@ struct param param = { .baud = B9600, .verbose = 0, .human_readable = 0, - .repl = 0 + .repl = 0, + .show_progress = 0 }; // TODO: Support stdin/stdout -- cgit v1.2.3