From: Andre Noll Date: Mon, 13 Nov 2017 16:46:57 +0000 (+0100) Subject: Merge branch 'refs/heads/t/configtest' X-Git-Tag: v1.0.0~18 X-Git-Url: http://git.tuebingen.mpg.de/dss.git/log?a=commitdiff_plain;h=a4544b07746d58815d78c4f1213ccdb96d256919;hp=e64460eb7c840399e46fc54da3b348fee33e550d;p=dss.git Merge branch 'refs/heads/t/configtest' A single patch which adds the new configtest subcommand, plus a fixup for a formatting issue which was noticed only after the branch had already been merged to next. * refs/heads/t/configtest: show_subcommand_summary(): Increase column width. New subcommand: configtest. --- diff --git a/NEWS b/NEWS index de1dca6..1dfffd0 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,9 @@ x.y.z (to be announced) lopsub must be installed to compile this package. Also help2man is no longer required since lopsub has built-in roff support. + - New subcommand "configtest" to check the command line options and + the configuration file for syntactic correctness. + - "make install" will install the executable and the man page. - In run mode, dss no longer exits successfully if another instance diff --git a/dss.c b/dss.c index ecd6ac3..57abf02 100644 --- a/dss.c +++ b/dss.c @@ -1697,6 +1697,13 @@ static int com_ls(void) } EXPORT_CMD_HANDLER(ls); +static int com_configtest(void) +{ + printf("Syntax Ok\n"); + return 0; +} +EXPORT_CMD_HANDLER(configtest); + static int setup_signal_handling(void) { int ret; @@ -1738,7 +1745,7 @@ static void show_subcommand_summary(void) for (i = 1; (cmd = lls_cmd(i, dss_suite)); i++) { const char *name = lls_command_name(cmd); const char *purpose = lls_purpose(cmd); - printf("%-10s%s\n", name, purpose); + printf("%-11s%s\n", name, purpose); } exit(EXIT_SUCCESS); } diff --git a/dss.suite b/dss.suite index e69cc28..394d783 100644 --- a/dss.suite +++ b/dss.suite @@ -475,6 +475,14 @@ caption = Subcommands Sending SIGHUP causes the running dss process to reload its config file. [/help] +[subcommand configtest] + purpose = run a configuration file syntax test + [description] + This command checks the command line options and the configuration + file for syntactic correctness. It either reports "Syntax Ok" and + exits successfully or prints information about the first syntax error + detected and terminates with exit code 1. + [/description] [section copyright] Written by Andre Noll