Support -v switch
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Tue, 2 Feb 2016 19:36:15 +0000 (21:36 +0200)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Tue, 2 Feb 2016 19:36:42 +0000 (21:36 +0200)
main.c
nmrpd.h

diff --git a/main.c b/main.c
index 0ed7979ee42fd9c7b3200fb01c37ab37abf47a27..94e3e98dc59ba97171352470e49e371ad3cfcd6f 100644 (file)
--- 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>    Timeout (in milliseconds) for regular messages\n"
                        " -T <timeout>    Time to wait after successfull TFTP upload\n"
                        " -p <port>       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 bd258eeddfdef1d58b36c39829499c2de4cec50b..25d9e5fa9b3e34094bfb8c607d2fe77a9401b828 100644 (file)
--- 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