1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

config: Reduce the interface offered to exmode.

This commit is contained in:
Kalle Olavi Niemitalo 2008-02-03 00:20:07 +02:00 committed by Kalle Olavi Niemitalo
parent 912cff7975
commit 63e82e68e4
3 changed files with 16 additions and 9 deletions

View File

@ -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, parse_config_command(struct option *options, unsigned char **file, int *line,
struct string *mirror, int is_system_conf) 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; 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 void
parse_config_file(struct option *options, unsigned char *name, parse_config_file(struct option *options, unsigned char *name,
unsigned char *file, struct string *mirror, unsigned char *file, struct string *mirror,
int is_system_conf) int is_system_conf)
{ {
int line = 1; struct conf_parsing_pos pos = { 0 };
int error_occurred = 0; int error_occurred = 0;
enum parse_error err = 0; enum parse_error err = 0;
enum verbose_level verbose = get_cmd_opt_int("verbose"); enum verbose_level verbose = get_cmd_opt_int("verbose");

View File

@ -14,10 +14,9 @@ enum parse_error {
}; };
void load_config(void); void load_config(void);
enum parse_error parse_config_command(struct option *options, #ifdef CONFIG_EXMODE
unsigned char **file, int *line, enum parse_error parse_config_exmode_command(unsigned char *cmd);
struct string *mirror, #endif
int is_system_conf);
void parse_config_file(struct option *options, unsigned char *name, void parse_config_file(struct option *options, unsigned char *name,
unsigned char *file, struct string *mirror, unsigned char *file, struct string *mirror,
int is_system_conf); int is_system_conf);

View File

@ -63,7 +63,6 @@ static int
exmode_confcmd_handler(struct session *ses, unsigned char *command, exmode_confcmd_handler(struct session *ses, unsigned char *command,
unsigned char *args) unsigned char *args)
{ {
int dummyline = 0;
enum parse_error err; enum parse_error err;
assert(ses && command && args); assert(ses && command && args);
@ -74,8 +73,7 @@ exmode_confcmd_handler(struct session *ses, unsigned char *command,
/* Undo the arguments separation. */ /* Undo the arguments separation. */
if (*args) *(--args) = ' '; if (*args) *(--args) = ' ';
err = parse_config_command(config_options, &command, &dummyline, NULL, err = parse_config_exmode_command(command);
0);
return err; return err;
} }