From: Andre Noll Date: Sun, 15 Oct 2017 13:03:08 +0000 (+0200) Subject: New subcommand: configtest. X-Git-Tag: v1.0.0~18^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=e22eda4676173486ab4a50909b0a581a1d798503;p=dss.git New subcommand: configtest. Similar to the identically named subcommand of apache2ctl. This is trivial to implement because we only need to describe the subcommand in dss.suite and create a command handler which prints an OK message and returns success. If the config file contains errors, we abort earlier anyway. --- diff --git a/dss.c b/dss.c index 3e626ab..e0b38a4 100644 --- a/dss.c +++ b/dss.c @@ -1696,6 +1696,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; 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