Index: ctwm.c =================================================================== RCS file: /home/fullermd/src/ctwm-hacks/cfgchk/cvs/ctwm/ctwm.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ctwm.c --- ctwm.c 9 Jul 2002 00:34:48 -0000 1.1.1.1 +++ ctwm.c 9 Jul 2002 04:35:03 -0000 @@ -143,6 +143,7 @@ #endif Window ResizeWindow; /* the window we are resizing */ +int cfgchk = 0; int captive = FALSE; char *captivename = NULL; @@ -327,11 +328,19 @@ } PrintErrorMessages = True; continue; + case 'c': /* -cfgchk */ + if(!strcmp(argv[i],"-cfgchk")) { + cfgchk = 1; + continue; + } #ifdef X11R6 - case 'c': /* -clientId */ - if (++i >= argc) goto usage; + if (++i >= argc) goto usage; /* -clientId */ client_id = argv[i]; continue; +#else + goto usage; +#endif +#ifdef X11R6 case 'r': /* -restore */ if (++i >= argc) goto usage; restore_filename = argv[i]; @@ -383,9 +392,9 @@ usage: fprintf (stderr, "usage: %s [-display dpy] [-version] [-info]", ProgramName); #ifdef USEM4 - fprintf (stderr, " [-f file] [-s] [-q] [-v] [-W] [-w [wid]] [-k] [-n] [-name name]\n"); + fprintf (stderr, " [-cfgchk] [-f file] [-s] [-q] [-v] [-W] [-w [wid]] [-k] [-n] [-name name]\n"); #else - fprintf (stderr, " [-f file] [-s] [-q] [-v] [-W] [-w [wid]] [-name name] \n"); + fprintf (stderr, " [-cfgchk] [-f file] [-s] [-q] [-v] [-W] [-w [wid]] [-name name] \n"); #endif exit (1); } @@ -523,7 +532,7 @@ XSync(dpy, 0); XSetErrorHandler(TwmErrorHandler); - if (RedirectError) + if (RedirectError && cfgchk==0) { fprintf (stderr, "%s: another window manager is already running", ProgramName); @@ -714,7 +723,18 @@ InitWorkSpaceManager (); /* Parse it once for each screen. */ - ParseTwmrc(InitFile); + if(cfgchk) { + if(ParseTwmrc(InitFile)==0) { + /* Error return */ + fprintf (stderr, "Errors found\n"); + exit(1); + } else { + fprintf (stderr, "No errors found\n"); + exit(0); + } + } + else + ParseTwmrc(InitFile); if (ShowWelcomeWindow && ! screenmasked) MaskScreen (NULL); if (Scr->ClickToFocus) { Scr->FocusRoot = FALSE; Index: ctwm.man =================================================================== RCS file: /home/fullermd/src/ctwm-hacks/cfgchk/cvs/ctwm/ctwm.man,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ctwm.man --- ctwm.man 9 Jul 2002 00:34:48 -0000 1.1.1.1 +++ ctwm.man 9 Jul 2002 04:40:22 -0000 @@ -17,7 +17,7 @@ ctwm - Tab Window Manager for the X Window System .SH SYNTAX .PP -\fIctwm \fP[-display \fIdpy\fP] [-s] [-f \fIinitfile\fP] [-v] [-n] [-k] [-w [win-id]] +\fIctwm \fP[-display \fIdpy\fP] [-s] [-cfgchk] [-f \fIinitfile\fP] [-v] [-n] [-k] [-w [win-id]] .PP .SH DESCRIPTION .PP @@ -90,6 +90,10 @@ \fB\-display\fP or by the \fBDISPLAY\fP environment variable) should be managed. By default, \fIctwm\fP will attempt to manage all screens on the display. +.TP 8 +.B \-cfgchk +This option cauases \fIctwm\fP to only try to parse the config file, and +indicate whether errors are found. .TP 8 .B \-f \fIfilename\fP This option specifies the name of the startup file to use. Index: parse.c =================================================================== RCS file: /home/fullermd/src/ctwm-hacks/cfgchk/cvs/ctwm/parse.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 parse.c --- parse.c 9 Jul 2002 00:34:48 -0000 1.1.1.1 +++ parse.c 9 Jul 2002 04:35:49 -0000 @@ -116,6 +116,7 @@ static int ParseRandomPlacement (); static int ParseButtonStyle (); extern int yyparse(),twmrc_error_prefix(); +extern int cfgchk; static FILE *twmrc; static int ptr = 0; @@ -267,6 +268,10 @@ break; #else case 0: /* -f filename.# */ + if (cfgchk) { + cp = filename; + break; + } if (filename) { cp = tmpfilename; (void) sprintf (tmpfilename, "%s.%d", filename, Scr->screen);