summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-02-17 13:31:31 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-02-17 13:31:31 +0100
commitdb991f91447e16f6ad22974a6c599ae9e47a95eb (patch)
treea65644628ce607c2afc599f5f91c363711e80e2c
parenta009161daf789a1ac22e4c21b82216834e60d25b (diff)
main: Add options to usage message
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--main.c11
1 files 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 <name> set hostname to respond with (default: system hostname)\n"
+ " -p, --port <number> 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) {