diff options
| author | Kozlov Dmitry <dima@server> | 2010-12-28 13:57:36 +0300 |
|---|---|---|
| committer | Kozlov Dmitry <dima@server> | 2010-12-28 13:57:36 +0300 |
| commit | e299571805aabb898b1297fd699b98f66e398876 (patch) | |
| tree | c7df8cf57810cddd2619de65109c697c0852ca04 /accel-pptpd/cli/cli.c | |
| parent | 7ab0dd10cbb94ea8246237246fb67d08922bd2d4 (diff) | |
| download | accel-ppp-e299571805aabb898b1297fd699b98f66e398876.tar.gz accel-ppp-e299571805aabb898b1297fd699b98f66e398876.zip | |
cli: inform that daemon is in shutdown mode
Diffstat (limited to 'accel-pptpd/cli/cli.c')
| -rw-r--r-- | accel-pptpd/cli/cli.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/accel-pptpd/cli/cli.c b/accel-pptpd/cli/cli.c index b8f82c8..048809c 100644 --- a/accel-pptpd/cli/cli.c +++ b/accel-pptpd/cli/cli.c @@ -8,6 +8,7 @@ #include "cli.h" #include "cli_p.h" #include "log.h" +#include "events.h" #include "memdebug.h" @@ -17,7 +18,8 @@ #define MSG_UNKNOWN_CMD "command unknown\r\n" char *conf_cli_passwd; -const char *conf_cli_prompt = "accel-pptp# "; +static const char *def_cli_prompt = "accel-pptp"; +char *conf_cli_prompt; static LIST_HEAD(simple_cmd_list); static LIST_HEAD(regexp_cmd_list); @@ -196,12 +198,30 @@ int cli_process_cmd(struct cli_client_t *cln) return 0; } -static void __init init(void) +static void load_config(void) { const char *opt; - - conf_cli_passwd = conf_get_opt("cli", "passwd"); + + if (conf_cli_passwd) + _free(conf_cli_passwd); + opt = conf_get_opt("cli", "password"); + if (opt) + conf_cli_passwd = _strdup(conf_cli_passwd); + else + conf_cli_passwd = NULL; + + if (conf_cli_prompt && conf_cli_prompt != def_cli_prompt) + _free(conf_cli_prompt); opt = conf_get_opt("cli", "prompt"); if (opt) conf_cli_prompt = _strdup(opt); + else + conf_cli_prompt = (char *)def_cli_prompt; +} + +static void __init init(void) +{ + load_config(); + + triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); } |
