summaryrefslogtreecommitdiff
path: root/xconsole.c
diff options
context:
space:
mode:
Diffstat (limited to 'xconsole.c')
-rw-r--r--xconsole.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/xconsole.c b/xconsole.c
index 20cbacd..a4b3136 100644
--- a/xconsole.c
+++ b/xconsole.c
@@ -608,6 +608,20 @@ InsertSelection(Widget w, XtPointer client_data, Atom *selection, Atom *type,
OpenConsole ();
}
+static void _X_NORETURN
+usage(int exitval)
+{
+ const char *usage_message =
+ "usage: xconsole [-toolkitoption ...] [-file file-name] [-notify|-nonotify]\n"
+ " [-stripNonprint] [-daemon] [-verbose] [-exitOnFail]\n"
+ " [-saveLines count]\n"
+ " xconsole -help\n"
+ " xconsole -version\n";
+
+ fputs(usage_message, stderr);
+ exit(exitval);
+}
+
int
main(int argc, char *argv[])
{
@@ -619,10 +633,13 @@ main(int argc, char *argv[])
/* Handle args that don't require opening a display */
for (int n = 1; n < argc; n++) {
const char *argn = argv[n];
- /* accept single or double dash for -version */
+ /* accept single or double dash for -help & -version */
if (argn[0] == '-' && argn[1] == '-') {
argn++;
}
+ if (strcmp(argn, "-help") == 0) {
+ usage(0);
+ }
if (strcmp(argn, "-version") == 0) {
puts(PACKAGE_STRING);
exit(0);
@@ -631,6 +648,14 @@ main(int argc, char *argv[])
top = XtInitialize ("xconsole", "XConsole", options, XtNumber (options),
&argc, argv);
+ if (argc != 1) {
+ fputs("Unknown argument(s):", stderr);
+ for (int n = 1; n < argc; n++) {
+ fprintf(stderr, " %s", argv[n]);
+ }
+ fputs("\n\n", stderr);
+ usage(1);
+ }
XtGetApplicationResources (top, (XtPointer)&app_resources, resources,
XtNumber (resources), NULL, 0);