From db991f91447e16f6ad22974a6c599ae9e47a95eb Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 17 Feb 2015 13:31:31 +0100 Subject: main: Add options to usage message Signed-off-by: Tobias Klauser --- main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index ffee131..80cf6cc 100644 --- a/main.c +++ b/main.c @@ -35,6 +35,7 @@ #include "iface.h" #include "llmnr.h" +#include "llmnr-packet.h" static const char *short_opts = "H:p:dh"; static const struct option long_opts[] = { @@ -47,7 +48,13 @@ static const struct option long_opts[] = { static void __noreturn usage_and_exit(int status) { - fprintf(stdout, "Usage: llmnrd [OPTIONS]\n"); + fprintf(stdout, "Usage: llmnrd [OPTIONS]\n" + "Options:\n" + " -H, --hostname set hostname to respond with (default: system hostname)\n" + " -p, --port set port number to listen on (default: %d)\n" + " -d, --daemonize run as daemon in the background\n" + " -h, --help show this help and exit\n", + LLMNR_UDP_PORT); exit(status); } @@ -90,7 +97,7 @@ int main(int argc, char **argv) long num_arg; bool daemonize = false; char *hostname = ""; - uint16_t port = 0; + uint16_t port = LLMNR_UDP_PORT; while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) { switch (c) { -- cgit v1.2.3-54-g00ecf