diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-02-17 18:00:40 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-02-17 18:00:40 +0100 |
commit | 09e957eec11ac38a4c6dcef9012aa4ab8de9fb5b (patch) | |
tree | 31a15764863eb4f85501f1156ba29e0f7799bb9b /llmnr-query.c | |
parent | dca3fbc189503465d5720b487533c6a5a8e6996e (diff) |
all: Add version information
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'llmnr-query.c')
-rw-r--r-- | llmnr-query.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llmnr-query.c b/llmnr-query.c index 5ee07ec..e3565e6 100644 --- a/llmnr-query.c +++ b/llmnr-query.c @@ -35,12 +35,13 @@ #include "log.h" #include "pkt.h" -static const char *short_ops = "c:i:p:T:h"; +static const char *short_ops = "c:i:p:T:hV"; static const struct option long_opts[] = { { "count", required_argument, NULL, 'c' }, { "interval", required_argument, NULL, 'i' }, { "type", required_argument, NULL, 'T' }, { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; @@ -51,10 +52,19 @@ static void __noreturn usage_and_exit(int status) " -c, --count number of queries to send (default: 1)\n" " -i, --interval interval between queries in ms (default: 500)\n" " -T, --type LLMNR query type, must be one of A, AAAA, ANY (default: A)\n" - " -h, --help show this help and exit"); + " -h, --help show this help and exit\n" + " -V, --version show version information and exit\n"); exit(status); } +static void __noreturn version_and_exit(void) +{ + fprintf(stdout, "llmnr-query %s\n" + "Copyright (C) 2015 Tobias Klauser <tklauser@distanz.ch>\n" + "Licensed unter the GNU General Public License, version 2\n", VERSION_STRING); + exit(EXIT_SUCCESS); +} + static const char *query_type(uint16_t qtype) { switch (qtype) { @@ -98,6 +108,8 @@ int main(int argc, char **argv) usage_and_exit(EXIT_FAILURE); } break; + case 'V': + version_and_exit(); case 'h': usage_and_exit(EXIT_SUCCESS); default: |