diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2014-11-05 22:14:05 +0100 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2016-01-03 21:06:21 +0100 |
commit | ff56995bceffcadad01e5b4fad02a44745d1f5e8 (patch) | |
tree | 052ec579fd1f1dcedf569844c8ba3cfe0b5807d1 | |
parent | 99ddbc44c8568bdfece258cb459ff1f3696d7e84 (diff) | |
download | microcom-ff56995bceffcadad01e5b4fad02a44745d1f5e8.tar.gz microcom-ff56995bceffcadad01e5b4fad02a44745d1f5e8.tar.xz |
Add option -v (--version) to print microcom's version
Finding out the version string doesn't work since commit f7e35c5989fc
(implement a cli for microcom) which was included in v2012.06.0.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r-- | microcom.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -187,6 +187,7 @@ void main_usage(int exitcode, char *str, char *dev) " from stdin\n" " -a, --answerback=<str> specify the answerback string sent as response to\n" " an ENQ (ASCII 0x05) Character\n" + " -v, --version print version string\n" " -h, --help This help\n", DEFAULT_DEVICE, DEFAULT_BAUDRATE, DEFAULT_CAN_INTERFACE, DEFAULT_CAN_ID, DEFAULT_CAN_ID); @@ -221,10 +222,11 @@ int main(int argc, char *argv[]) { "logfile", required_argument, 0, 'l'}, { "listenonly", no_argument, 0, 'o'}, { "answerback", required_argument, 0, 'a'}, + { "version", no_argument, 0, 'v' }, { 0, 0, 0, 0}, }; - while ((opt = getopt_long(argc, argv, "hp:s:t:c:dfl:oi:a:", long_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "hp:s:t:c:dfl:oi:a:v", long_options, NULL)) != -1) { switch (opt) { case '?': main_usage(1, "", ""); @@ -232,6 +234,10 @@ int main(int argc, char *argv[]) case 'h': main_usage(0, "", ""); break; + case 'v': + printf("%s\n", PACKAGE_VERSION); + exit(EXIT_SUCCESS); + break; case 'p': device = optarg; break; |