From: Joseph C. Lehner Date: Tue, 2 Feb 2016 19:36:15 +0000 (+0200) Subject: Support -v switch X-Git-Tag: v0.9~59 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7dce485863231dd95795f89f195a28faa3ffcc9c;p=oweals%2Fnmrpflash.git Support -v switch --- diff --git a/main.c b/main.c index 0ed7979..94e3e98 100644 --- a/main.c +++ b/main.c @@ -23,6 +23,8 @@ #include "nmrpd.h" #include "ethsock.h" +int verbosity = 0; + void usage(FILE *fp) { fprintf(fp, @@ -37,6 +39,7 @@ void usage(FILE *fp) " -t Timeout (in milliseconds) for regular messages\n" " -T Time to wait after successfull TFTP upload\n" " -p Port to use for TFTP upload\n" + " -v Be verbose\n" " -V Print version and exit\n" " -L List network interfaces\n" " -h Show this screen\n" @@ -72,7 +75,7 @@ int main(int argc, char **argv) opterr = 0; - while ((c = getopt(argc, argv, "a:f:i:m:M:p:t:T:hLV")) != -1) { + while ((c = getopt(argc, argv, "a:f:i:m:M:p:t:T:hLVv")) != -1) { max = 0x7fffffff; switch (c) { case 'a': @@ -112,6 +115,9 @@ int main(int argc, char **argv) case 'V': printf("nmrp-flash v%s\n", NMRPD_VERSION); return 0; + case 'v': + ++verbosity; + break; case 'L': return ethsock_list_all(); case 'h': diff --git a/nmrpd.h b/nmrpd.h index bd258ee..25d9e5f 100644 --- a/nmrpd.h +++ b/nmrpd.h @@ -70,5 +70,6 @@ int sock_set_rx_timeout(int sock, unsigned msec); int tftp_put(struct nmrpd_args *args); int nmrp_do(struct nmrpd_args *args); +extern int verbosity; #endif