From 758381efbaa40d604253259cd43f194db1162859 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 14 Apr 2007 22:19:52 +0000 Subject: [PATCH] Fix error message when passing invalid command line arguments. I admit defeat, tedp wins, merging his patch. (Closes #88) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1424 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-autoipd/main.c | 2 -- avahi-daemon/main.c | 2 -- avahi-dnsconfd/main.c | 2 -- avahi-utils/avahi-browse.c | 2 -- avahi-utils/avahi-publish.c | 2 -- avahi-utils/avahi-resolve.c | 2 -- avahi-utils/avahi-set-host-name.c | 2 -- 7 files changed, 14 deletions(-) diff --git a/avahi-autoipd/main.c b/avahi-autoipd/main.c index f4574dc..bf3e775 100644 --- a/avahi-autoipd/main.c +++ b/avahi-autoipd/main.c @@ -1464,7 +1464,6 @@ static int parse_command_line(int argc, char *argv[]) { { NULL, 0, NULL, 0 } }; - opterr = 0; while ((c = getopt_long(argc, argv, "hDskrcVS:w", long_options, NULL)) >= 0) { switch(c) { @@ -1523,7 +1522,6 @@ static int parse_command_line(int argc, char *argv[]) { #endif default: - fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } } diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index 0b26446..d0a3c85 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -379,7 +379,6 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) { assert(c); - opterr = 0; while ((o = getopt_long(argc, argv, "hDkVf:rcs", long_options, NULL)) >= 0) { switch(o) { @@ -426,7 +425,6 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) { c->debug = 1; break; default: - fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } } diff --git a/avahi-dnsconfd/main.c b/avahi-dnsconfd/main.c index 1f3e3b8..d10374b 100644 --- a/avahi-dnsconfd/main.c +++ b/avahi-dnsconfd/main.c @@ -396,7 +396,6 @@ static int parse_command_line(int argc, char *argv[]) { { NULL, 0, NULL, 0 } }; - opterr = 0; while ((c = getopt_long(argc, argv, "hDkVrc", long_options, NULL)) >= 0) { switch(c) { @@ -419,7 +418,6 @@ static int parse_command_line(int argc, char *argv[]) { command = DAEMON_CHECK; break; default: - fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } } diff --git a/avahi-utils/avahi-browse.c b/avahi-utils/avahi-browse.c index 5d1a4c8..71964e6 100644 --- a/avahi-utils/avahi-browse.c +++ b/avahi-utils/avahi-browse.c @@ -647,7 +647,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv c->no_db_lookup = 0; #endif - opterr = 0; while ((o = getopt_long(argc, argv, "hVd:avtclrDf" #if defined(HAVE_GDBM) || defined(HAVE_DBM) "kb" @@ -698,7 +697,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv break; #endif default: - fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } } diff --git a/avahi-utils/avahi-publish.c b/avahi-utils/avahi-publish.c index 4edca6f..4e75176 100644 --- a/avahi-utils/avahi-publish.c +++ b/avahi-utils/avahi-publish.c @@ -256,7 +256,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv c->port = 0; c->txt = c->subtypes = NULL; - opterr = 0; while ((o = getopt_long(argc, argv, "hVsavd:H:f", long_options, NULL)) >= 0) { switch(o) { @@ -290,7 +289,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv c->subtypes = avahi_string_list_add(c->subtypes, optarg); break; default: - fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } } diff --git a/avahi-utils/avahi-resolve.c b/avahi-utils/avahi-resolve.c index fe01ae5..47e7ebf 100644 --- a/avahi-utils/avahi-resolve.c +++ b/avahi-utils/avahi-resolve.c @@ -186,7 +186,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv c->proto = AVAHI_PROTO_UNSPEC; c->verbose = 0; - opterr = 0; while ((o = getopt_long(argc, argv, "hVnav46", long_options, NULL)) >= 0) { switch(o) { @@ -212,7 +211,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv c->proto = AVAHI_PROTO_INET6; break; default: - fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } } diff --git a/avahi-utils/avahi-set-host-name.c b/avahi-utils/avahi-set-host-name.c index 8672e4e..bad6e4f 100644 --- a/avahi-utils/avahi-set-host-name.c +++ b/avahi-utils/avahi-set-host-name.c @@ -93,7 +93,6 @@ static int parse_command_line(Config *c, int argc, char *argv[]) { c->command = COMMAND_UNSPEC; c->verbose = 0; - opterr = 0; while ((o = getopt_long(argc, argv, "hVv", long_options, NULL)) >= 0) { switch(o) { @@ -107,7 +106,6 @@ static int parse_command_line(Config *c, int argc, char *argv[]) { c->verbose = 1; break; default: - fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } } -- 2.39.5