diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2020-06-17 15:56:04 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2020-06-17 15:56:04 -0400 |
commit | 8f1b54ee608af86d448a9981257fa58727dfe6fc (patch) | |
tree | 4a05012e325a15d1269674c67f285fab21d81676 /src | |
parent | 2741e9b381570f362732061dbca7835c8c185e9b (diff) |
add "-V" version-message
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/twm.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -75,6 +75,7 @@ in this Software without prior written authorization from The Open Group. #include "screen.h" #include "parse.h" #include "session.h" +#include "version.h" #include <X11/Xproto.h> #include <X11/Xatom.h> #include <X11/SM/SMlib.h> @@ -220,12 +221,12 @@ IsPrintScreen(Screen *s) static void usage(void) { - fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v]" + fprintf(stderr, "usage: %s [-display dpy] [-f file] [-s] [-q] [-v] [-V]" #ifdef XPRINT " [-noprint]" #endif /* XPRINT */ " [-clientId id] [-restore file]\n", ProgramName); - exit(1); + exit(EXIT_FAILURE); } /*********************************************************************** @@ -258,6 +259,9 @@ main(int argc, char *argv[]) for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { + case 'V': + printf("%s %s\n", ProgramName, Version); + exit(EXIT_SUCCESS); case 'd': /* -display dpy */ if (strcmp(&argv[i][1], "display")) usage(); @@ -355,14 +359,14 @@ main(int argc, char *argv[]) NULL, 0, &zero, NULL))) { fprintf(stderr, "%s: unable to open display \"%s\"\n", ProgramName, XDisplayName(display_name)); - exit(1); + exit(EXIT_FAILURE); } if (fcntl(ConnectionNumber(dpy), F_SETFD, 1) == -1) { fprintf(stderr, "%s: unable to mark display connection as close-on-exec\n", ProgramName); - exit(1); + exit(EXIT_FAILURE); } if (restore_filename) @@ -402,7 +406,7 @@ main(int argc, char *argv[]) fprintf(stderr, "%s: Unable to allocate memory for screen list, exiting.\n", ProgramName); - exit(1); + exit(EXIT_FAILURE); } numManaged = 0; PreviousScreen = DefaultScreen(dpy); @@ -683,7 +687,7 @@ main(int argc, char *argv[]) if (MultiScreen && NumScreens > 0) fprintf(stderr, "%s: unable to find any unmanaged %sscreens.\n", ProgramName, NoPrintscreens ? "" : "video "); - exit(1); + exit(EXIT_FAILURE); } (void) ConnectToSessionManager(client_id); @@ -692,7 +696,7 @@ main(int argc, char *argv[]) HandlingEvents = TRUE; InitEvents(); HandleEvents(); - exit(0); + exit(EXIT_SUCCESS); } /** @@ -948,7 +952,7 @@ Done(XtPointer client_data _X_UNUSED, XtSignalId *si2 _X_UNUSED) Reborder(CurrentTime); XCloseDisplay(dpy); } - exit(0); + exit(EXIT_SUCCESS); } /* |