summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2011-07-28 20:28:22 +0200
committerJulien Cristau <jcristau@debian.org>2011-07-28 20:28:22 +0200
commitb8747f951cb3652975ce8484aaaddd50247729f7 (patch)
treead5bd007792921ed26d9ca5bee871eadea9cc31e
parent24685cf1a3987a72310b0160b102fef615359731 (diff)
Move "-help" handling up to before XOpenDisplay
We don't need a display to show the usage message. X.Org bug#39633 <https://bugs.freedesktop.org/show_bug.cgi?id=39633> Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--xhost.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/xhost.c b/xhost.c
index 49d4690..6495d9b 100644
--- a/xhost.c
+++ b/xhost.c
@@ -213,6 +213,11 @@ main(int argc, char *argv[])
ProgramName = argv[0];
+ if (argc == 2 && !strcmp(argv[1], "-help")) {
+ fprintf(stderr, "usage: %s [[+-]hostname ...]\n", argv[0]);
+ exit(1);
+ }
+
if ((dpy = XOpenDisplay(NULL)) == NULL) {
fprintf(stderr, "%s: unable to open display \"%s\"\n",
ProgramName, XDisplayName (NULL));
@@ -281,11 +286,6 @@ main(int argc, char *argv[])
exit(0);
}
- if (argc == 2 && !strcmp(argv[1], "-help")) {
- fprintf(stderr, "usage: %s [[+-]hostname ...]\n", argv[0]);
- exit(1);
- }
-
for (i = 1; i < argc; i++) {
arg = argv[i];
if (*arg == '-') {