Properly implement -h (fixes error message about unknown option)

pull/1/head
Michael Stapelberg 2011-11-06 14:11:20 +00:00
parent 409025c7cc
commit 8e3c506c90
1 changed files with 4 additions and 3 deletions

View File

@ -379,6 +379,7 @@ int main(int argc, char *argv[]) {
{"color", required_argument, NULL, 'c'}, {"color", required_argument, NULL, 'c'},
{"pointer", required_argument, NULL , 'p'}, {"pointer", required_argument, NULL , 'p'},
{"debug", no_argument, NULL, 0}, {"debug", no_argument, NULL, 0},
{"help", no_argument, NULL, 'h'},
#ifndef NOLIBCAIRO #ifndef NOLIBCAIRO
{"image", required_argument, NULL, 'i'}, {"image", required_argument, NULL, 'i'},
{"tiling", no_argument, NULL, 't'}, {"tiling", no_argument, NULL, 't'},
@ -389,7 +390,7 @@ int main(int argc, char *argv[]) {
if ((username = getenv("USER")) == NULL) if ((username = getenv("USER")) == NULL)
errx(1, "USER environment variable not set, please set it.\n"); 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 #ifndef NOLIBCAIRO
"i:t" "i:t"
#endif #endif
@ -440,13 +441,13 @@ int main(int argc, char *argv[]) {
debug_mode = true; debug_mode = true;
break; break;
default: 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 #ifndef NOLIBCAIRO
" [-i image.png] [-t]" " [-i image.png] [-t]"
#else #else
" (compiled with NOLIBCAIRO)" " (compiled with NOLIBCAIRO)"
#endif #endif
"\n"); );
} }
} }