mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Add a configtest flag (-n).
based on a diff from Sascha Paunovic.
This commit is contained in:
parent
a5ba9aa9da
commit
cd4be1c17a
16
calmwm.c
16
calmwm.c
@ -55,7 +55,7 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
char *display_name = NULL;
|
char *display_name = NULL;
|
||||||
char *fallback;
|
char *fallback;
|
||||||
int ch, xfd;
|
int ch, xfd, nflag = 0;
|
||||||
struct pollfd pfd[1];
|
struct pollfd pfd[1];
|
||||||
|
|
||||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
@ -66,7 +66,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
fallback = u_argv(argv);
|
fallback = u_argv(argv);
|
||||||
Conf.wm_argv = u_argv(argv);
|
Conf.wm_argv = u_argv(argv);
|
||||||
while ((ch = getopt(argc, argv, "c:d:v")) != -1) {
|
while ((ch = getopt(argc, argv, "c:d:nv")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'c':
|
case 'c':
|
||||||
free(Conf.conf_file);
|
free(Conf.conf_file);
|
||||||
@ -75,6 +75,9 @@ main(int argc, char **argv)
|
|||||||
case 'd':
|
case 'd':
|
||||||
display_name = optarg;
|
display_name = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
nflag = 1;
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
Conf.debug++;
|
Conf.debug++;
|
||||||
break;
|
break;
|
||||||
@ -90,8 +93,13 @@ main(int argc, char **argv)
|
|||||||
if (signal(SIGHUP, sighdlr) == SIG_ERR)
|
if (signal(SIGHUP, sighdlr) == SIG_ERR)
|
||||||
err(1, "signal");
|
err(1, "signal");
|
||||||
|
|
||||||
if (parse_config(Conf.conf_file, &Conf) == -1)
|
if (parse_config(Conf.conf_file, &Conf) == -1) {
|
||||||
warnx("error parsing config file");
|
warnx("error parsing config file");
|
||||||
|
if (nflag)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (nflag)
|
||||||
|
return 0;
|
||||||
|
|
||||||
xfd = x_init(display_name);
|
xfd = x_init(display_name);
|
||||||
cwm_status = CWM_RUNNING;
|
cwm_status = CWM_RUNNING;
|
||||||
@ -219,7 +227,7 @@ usage(void)
|
|||||||
{
|
{
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
|
|
||||||
(void)fprintf(stderr, "usage: %s [-v] [-c file] [-d display]\n",
|
(void)fprintf(stderr, "usage: %s [-nv] [-c file] [-d display]\n",
|
||||||
__progname);
|
__progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
5
cwm.1
5
cwm.1
@ -23,7 +23,7 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.\" For a program: program [-abc] file ...
|
.\" For a program: program [-abc] file ...
|
||||||
.Nm cwm
|
.Nm cwm
|
||||||
.Op Fl v
|
.Op Fl nv
|
||||||
.Op Fl c Ar file
|
.Op Fl c Ar file
|
||||||
.Op Fl d Ar display
|
.Op Fl d Ar display
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@ -48,6 +48,9 @@ however,
|
|||||||
will continue to process the rest of the configuration file.
|
will continue to process the rest of the configuration file.
|
||||||
.It Fl d Ar display
|
.It Fl d Ar display
|
||||||
Specify the display to use.
|
Specify the display to use.
|
||||||
|
.It Fl n
|
||||||
|
Configtest mode.
|
||||||
|
Only check the configuration file for validity.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Verbose mode.
|
Verbose mode.
|
||||||
Multiple
|
Multiple
|
||||||
|
Loading…
Reference in New Issue
Block a user