This adds the CLI command 'configure status' so that it is possible to check if reconfiguration is done.
Signed-off-by: Kenth Eriksson <[email protected]> --- conf/conf.c | 6 ++++++ conf/conf.h | 1 + sysdep/unix/config.Y | 3 +++ sysdep/unix/main.c | 7 +++++++ sysdep/unix/unix.h | 1 + 5 files changed, 18 insertions(+) diff --git a/conf/conf.c b/conf/conf.c index 439aa41d..1905da8d 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -444,6 +444,12 @@ config_undo(void) return CONF_PROGRESS; } +int +config_status(void) +{ + return configuring? CONF_PROGRESS : CONF_DONE; +} + extern void cmd_reconfig_undo_notify(void); static void diff --git a/conf/conf.h b/conf/conf.h index 427569fd..e5998146 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -68,6 +68,7 @@ void config_free(struct config *); int config_commit(struct config *, int type, uint timeout); int config_confirm(void); int config_undo(void); +int config_status(void); void config_init(void); void cf_error(const char *msg, ...) NORET; void config_add_obstacle(struct config *); diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y index e7ecd735..8ad7da60 100644 --- a/sysdep/unix/config.Y +++ b/sysdep/unix/config.Y @@ -124,6 +124,9 @@ CF_CLI(CONFIGURE CONFIRM,,, [[Confirm last configuration change - deactivate und CF_CLI(CONFIGURE UNDO,,, [[Undo last configuration change]]) { cmd_reconfig_undo(); } ; +CF_CLI(CONFIGURE STATUS,,, [[Show configuration status]]) +{ cmd_reconfig_status(); } ; + CF_CLI(CONFIGURE CHECK, cfg_name, [\"<file>\"], [[Parse configuration and check its validity]]) { cmd_check_config($3); } ; diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 921115b1..73f5d4f1 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -339,6 +339,13 @@ cmd_reconfig_undo(void) cmd_reconfig_msg(r); } +void +cmd_reconfig_status(void) +{ + int r = config_status(); + cmd_reconfig_msg(r); +} + /* * Command-Line Interface */ diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h index 0e1e98c0..d5ce8ff9 100644 --- a/sysdep/unix/unix.h +++ b/sysdep/unix/unix.h @@ -26,6 +26,7 @@ void cmd_check_config(char *name); void cmd_reconfig(char *name, int type, uint timeout); void cmd_reconfig_confirm(void); void cmd_reconfig_undo(void); +void cmd_reconfig_status(void); void cmd_shutdown(void); #define UNIX_DEFAULT_CONFIGURE_TIMEOUT 300 -- 2.21.0
