From b8747f951cb3652975ce8484aaaddd50247729f7 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Thu, 28 Jul 2011 20:28:22 +0200 Subject: Move "-help" handling up to before XOpenDisplay We don't need a display to show the usage message. X.Org bug#39633 Signed-off-by: Julien Cristau --- xhost.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xhost.c') 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 == '-') { -- cgit v1.2.3