From 8e3c506c90c7c7b3569c41a52d940665e75e8af9 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 6 Nov 2011 14:11:20 +0000 Subject: [PATCH] Properly implement -h (fixes error message about unknown option) --- i3lock.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/i3lock.c b/i3lock.c index 2241f05..2a43750 100644 --- a/i3lock.c +++ b/i3lock.c @@ -379,6 +379,7 @@ int main(int argc, char *argv[]) { {"color", required_argument, NULL, 'c'}, {"pointer", required_argument, NULL , 'p'}, {"debug", no_argument, NULL, 0}, + {"help", no_argument, NULL, 'h'}, #ifndef NOLIBCAIRO {"image", required_argument, NULL, 'i'}, {"tiling", no_argument, NULL, 't'}, @@ -389,7 +390,7 @@ int main(int argc, char *argv[]) { if ((username = getenv("USER")) == NULL) errx(1, "USER environment variable not set, please set it.\n"); - while ((o = getopt_long(argc, argv, "vnbdc:p:" + while ((o = getopt_long(argc, argv, "hvnbdc:p:" #ifndef NOLIBCAIRO "i:t" #endif @@ -440,13 +441,13 @@ int main(int argc, char *argv[]) { debug_mode = true; break; default: - errx(1, "i3lock: Unknown option. Syntax: i3lock [-v] [-n] [-b] [-d] [-c color] [-p win|default]" + errx(1, "Syntax: i3lock [-v] [-n] [-b] [-d] [-c color] [-p win|default]" #ifndef NOLIBCAIRO " [-i image.png] [-t]" #else " (compiled with NOLIBCAIRO)" #endif - "\n"); + ); } }