diff options
-rw-r--r-- | man/twm.man | 53 | ||||
-rw-r--r-- | src/twm.c | 30 |
2 files changed, 61 insertions, 22 deletions
diff --git a/man/twm.man b/man/twm.man index 619ddaa..c54e38e 100644 --- a/man/twm.man +++ b/man/twm.man @@ -43,11 +43,7 @@ .SH NAME twm \- Tab Window Manager for the X Window System .SH SYNTAX -\fBtwm \fP[ \fB\-display\fP \fIdpy\fP ] -[ \fB\-s\fP ] -[ \fB\-f\fP \fIinitfile\fP ] -[ \fB\-v\fP ] -[ \fB\-V\fP ] +\fBtwm \fP[ \fIoptions\fP ] .SH DESCRIPTION \fITwm\fP is a window manager for the X Window System. It provides @@ -111,27 +107,48 @@ Clicking pointer Button3 (usually the right pointer button) will give the window its current position but attempt to make it long enough to touch the bottom the screen. .SH OPTIONS -\fITwm\fP accepts the following command line options: +\fITwm\fP accepts several command line options, +which may be abbreviated, e.g., +\*(``\fB\-d\fP\*('' for +\*(``\fB\-display\fP\*('' +(but upper/lower-case are different): +.TP 8 +.B \-clientId \fIID\fP +Each time \fItwm\fP starts, it calls +\fBSmcOpenConnection\fP +to establish a new session. +It can be told to restart from a previous session by giving the previous +session's client-identifier. .TP 8 .B \-display \fIdpy\fP -This option specifies the X server to use. +Specify the X server to use. +.TP 8 +.B \-file \fIfilename\fP +Specify the name of the startup file to use. +By default, +\fItwm\fP will look in the user's home directory for files +named \fI.twmrc.num\fP (where \fInum\fP is a screen number) or \fI.twmrc\fP. +.TP 8 +.B \-quiet +Tells \fItwm\fP that it should not print error messages when +it receives unexpected X Error events. .TP 8 -.B \-s -This option indicates that only the default screen (as specified by +.B \-restore \fIfilename\fP +When \fItwm\fP's session is stopped, it attempts to save the current +window configuration. +Use this option to tell \fItwm\fP to read this file for that information +when starting (or restarting) a session. +.TP 8 +.B \-single +Tells \fItwm\fP that only the default screen (as specified by \fB\-display\fP or by the \fBDISPLAY\fP environment variable) should be managed. By default, \fItwm\fP will attempt to manage all screens on the display. .TP 8 -.B \-f \fIfilename\fP -This option specifies the name of the startup file to use. -By default, -\fItwm\fP will look in the user's home directory for files -named \fI.twmrc.num\fP (where \fInum\fP is a screen number) or \fI.twmrc\fP. -.TP 8 -.B \-v -This option indicates that \fItwm\fP should print error messages whenever -an unexpected X Error event is received. +.B \-verbose +Tells \fItwm\fP that it should print error messages whenever +it receives an unexpected X Error event. This can be useful when debugging applications but can be distracting in regular use. .TP 8 @@ -229,6 +229,20 @@ usage(void) exit(EXIT_FAILURE); } +static Bool +brief_opt(const char *param, const char *option) +{ + size_t have = strlen(++param); + size_t want = strlen(option); + Bool result = False; + + if (have <= want) { + if (!strncmp(param, option, have)) + result = True; + } + return result; +} + /*********************************************************************** * * Procedure: @@ -263,45 +277,53 @@ main(int argc, char *argv[]) printf("%s %s\n", ProgramName, Version); exit(EXIT_SUCCESS); case 'd': /* -display dpy */ - if (strcmp(&argv[i][1], "display")) + if (!brief_opt(argv[i], "display")) usage(); if (++i >= argc) usage(); display_name = argv[i]; continue; case 's': /* -single */ + if (!brief_opt(argv[i], "single")) + usage(); MultiScreen = FALSE; continue; #ifdef XPRINT case 'n': /* -noprint */ - if (strcmp(&argv[i][1], "noprint")) + if (!brief_opt(argv[i], "noprint")) usage(); NoPrintscreens = True; continue; #endif /* XPRINT */ case 'f': /* -file twmrcfilename */ + if (!brief_opt(argv[i], "file")) + usage(); if (++i >= argc) usage(); InitFile = argv[i]; continue; case 'v': /* -verbose */ + if (!brief_opt(argv[i], "verbose")) + usage(); PrintErrorMessages = True; continue; case 'c': /* -clientId */ - if (strcmp(&argv[i][1], "clientId")) + if (!brief_opt(argv[i], "clientId")) usage(); if (++i >= argc) usage(); client_id = argv[i]; continue; case 'r': /* -restore */ - if (strcmp(&argv[i][1], "restore")) + if (!brief_opt(argv[i], "restore")) usage(); if (++i >= argc) usage(); restore_filename = argv[i]; continue; case 'q': /* -quiet */ + if (!brief_opt(argv[i], "quiet")) + usage(); PrintErrorMessages = False; continue; } |