summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2020-06-15 00:08:35 +0200
committerGravatar Martin Szulecki2020-06-15 00:08:35 +0200
commitf26cb457954f129850c265060b84000128839c5a (patch)
treef092dde5da0e1efef775aaab4cea76837262cc43 /tools
parent06e70e0f51ad12931298c472688ff9a07ff0c535 (diff)
downloadlibusbmuxd-f26cb457954f129850c265060b84000128839c5a.tar.gz
libusbmuxd-f26cb457954f129850c265060b84000128839c5a.tar.bz2
iproxy: Add new "--version" option to output version information
Diffstat (limited to 'tools')
-rw-r--r--tools/iproxy.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/iproxy.c b/tools/iproxy.c
index d89a01b..5b7cf03 100644
--- a/tools/iproxy.c
+++ b/tools/iproxy.c
@@ -26,6 +26,9 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+
+#define TOOL_NAME "iproxy"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -227,6 +230,7 @@ static void print_usage(int argc, char **argv, int is_error)
" -s, --source ADDR source address for listening socket (default 127.0.0.1)\n" \
" -h, --help prints usage information\n" \
" -d, --debug increase debug level\n" \
+ " -v, --version prints version information\n" \
"\n" \
"Homepage: <" PACKAGE_URL ">\n"
"Bug Reports: <" PACKAGE_BUGREPORT ">\n"
@@ -260,10 +264,11 @@ int main(int argc, char **argv)
{ "local", no_argument, NULL, 'l' },
{ "network", no_argument, NULL, 'n' },
{ "source", required_argument, NULL, 's' },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0}
};
int c = 0;
- while ((c = getopt_long(argc, argv, "dhu:lns:", longopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "dhu:lns:v", longopts, NULL)) != -1) {
switch (c) {
case 'd':
libusbmuxd_set_debug_level(++debug_level);
@@ -295,6 +300,9 @@ int main(int argc, char **argv)
case 'h':
print_usage(argc, argv, 0);
return 0;
+ case 'v':
+ printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
+ return 0;
default:
print_usage(argc, argv, 1);
return 2;