From 63e82e68e40ac7a4732b8e5911ce25ffd7bbc13b Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 3 Feb 2008 00:20:07 +0200 Subject: [PATCH] config: Reduce the interface offered to exmode. --- src/config/conf.c | 14 ++++++++++++-- src/config/conf.h | 7 +++---- src/dialogs/exmode.c | 4 +--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/config/conf.c b/src/config/conf.c index dd9cab7a9..e2d152d5a 100644 --- a/src/config/conf.c +++ b/src/config/conf.c @@ -339,7 +339,7 @@ static const struct parse_handler parse_handlers[] = { }; -enum parse_error +static enum parse_error parse_config_command(struct option *options, unsigned char **file, int *line, struct string *mirror, int is_system_conf) { @@ -376,12 +376,22 @@ parse_config_command(struct option *options, unsigned char **file, int *line, return ERROR_COMMAND; } +#ifdef CONFIG_EXMODE +enum parse_error +parse_config_exmode_command(unsigned char *cmd) +{ + int dummyline = 0; + + return parse_config_command(config_options, &cmd, &dummyline, NULL, 0); +} +#endif /* CONFIG_EXMODE */ + void parse_config_file(struct option *options, unsigned char *name, unsigned char *file, struct string *mirror, int is_system_conf) { - int line = 1; + struct conf_parsing_pos pos = { 0 }; int error_occurred = 0; enum parse_error err = 0; enum verbose_level verbose = get_cmd_opt_int("verbose"); diff --git a/src/config/conf.h b/src/config/conf.h index f55e4e707..2a9a7ffee 100644 --- a/src/config/conf.h +++ b/src/config/conf.h @@ -14,10 +14,9 @@ enum parse_error { }; void load_config(void); -enum parse_error parse_config_command(struct option *options, - unsigned char **file, int *line, - struct string *mirror, - int is_system_conf); +#ifdef CONFIG_EXMODE +enum parse_error parse_config_exmode_command(unsigned char *cmd); +#endif void parse_config_file(struct option *options, unsigned char *name, unsigned char *file, struct string *mirror, int is_system_conf); diff --git a/src/dialogs/exmode.c b/src/dialogs/exmode.c index 75a1bb922..3f08fb13e 100644 --- a/src/dialogs/exmode.c +++ b/src/dialogs/exmode.c @@ -63,7 +63,6 @@ static int exmode_confcmd_handler(struct session *ses, unsigned char *command, unsigned char *args) { - int dummyline = 0; enum parse_error err; assert(ses && command && args); @@ -74,8 +73,7 @@ exmode_confcmd_handler(struct session *ses, unsigned char *command, /* Undo the arguments separation. */ if (*args) *(--args) = ' '; - err = parse_config_command(config_options, &command, &dummyline, NULL, - 0); + err = parse_config_exmode_command(command); return err; }