]> git.tuebingen.mpg.de Git - dss.git/commitdiff
Merge branch 'refs/heads/t/configtest'
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 13 Nov 2017 16:46:57 +0000 (17:46 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 13 Nov 2017 16:49:32 +0000 (17:49 +0100)
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.

NEWS
dss.c
dss.suite

diff --git a/NEWS b/NEWS
index de1dca67284ae98c713412eba429af24d45239e3..1dfffd0f79ea54502f90c391a8d6bdac30a7d269 100644 (file)
--- 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 ecd6ac35273c5fb04ab55fda8243204094532e86..57abf0248ad7b493248e7690a3452cc4927a8a1b 100644 (file)
--- 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);
 }
index e69cc28630c8a39359cba3aead33ab3b847011a8..394d7839347a9b312daf28568738051c3d9e795e 100644 (file)
--- 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