From e22eda4676173486ab4a50909b0a581a1d798503 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 15 Oct 2017 15:03:08 +0200 Subject: [PATCH] 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. --- dss.c | 7 +++++++ dss.suite | 8 ++++++++ 2 files changed, 15 insertions(+) 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 -- 2.39.2