summaryrefslogtreecommitdiff
path: root/src/hostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hostname.c')
-rw-r--r--src/hostname.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hostname.c b/src/hostname.c
index c9b62e446..ff7b4e4cc 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -97,6 +97,14 @@ main (int argc, char **argv)
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
+ /* The above handles --help and --version.
+ Since there is no other invocation of getopt, handle `--' here. */
+ if (1 < argc && STREQ (argv[1], "--"))
+ {
+ --argc;
+ ++argv;
+ }
+
#ifdef HAVE_SETHOSTNAME
if (argc == 2)
{