mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
config: Negate the value in redir_rd too.
So if ELinks is rewriting a configuration file that contains a "set" command for a negated alias, then it properly writes the value of the alias, rather than the value of the underlying option.
This commit is contained in:
parent
2dbe6ec34f
commit
c47d3798a3
@ -90,19 +90,6 @@ exec_cmd(struct option *o, unsigned char ***argv, int *argc)
|
|||||||
* possibly changing ptr to structure containing target name and pointer to
|
* possibly changing ptr to structure containing target name and pointer to
|
||||||
* options list? --pasky */
|
* options list? --pasky */
|
||||||
|
|
||||||
#define wrap_or_(name_, call_, ret_) \
|
|
||||||
{ \
|
|
||||||
struct option *real = get_opt_rec(config_options, opt->value.string); \
|
|
||||||
\
|
|
||||||
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string); \
|
|
||||||
if_assert_failed { return ret_; } \
|
|
||||||
\
|
|
||||||
if (option_types[real->type].name_) \
|
|
||||||
return option_types[real->type].call_; \
|
|
||||||
\
|
|
||||||
return ret_; \
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned char *
|
static unsigned char *
|
||||||
redir_cmd(struct option *opt, unsigned char ***argv, int *argc)
|
redir_cmd(struct option *opt, unsigned char ***argv, int *argc)
|
||||||
{
|
{
|
||||||
@ -124,7 +111,22 @@ redir_cmd(struct option *opt, unsigned char ***argv, int *argc)
|
|||||||
|
|
||||||
static unsigned char *
|
static unsigned char *
|
||||||
redir_rd(struct option *opt, unsigned char **file, int *line)
|
redir_rd(struct option *opt, unsigned char **file, int *line)
|
||||||
wrap_or_(read, read(real, file, line), NULL);
|
{
|
||||||
|
struct option *real = get_opt_rec(config_options, opt->value.string);
|
||||||
|
unsigned char *ret = NULL;
|
||||||
|
|
||||||
|
assertm(real != NULL, "%s aliased to unknown option %s!", opt->name, opt->value.string);
|
||||||
|
if_assert_failed { return ret; }
|
||||||
|
|
||||||
|
if (option_types[real->type].read) {
|
||||||
|
ret = option_types[real->type].read(real, file, line);
|
||||||
|
if (ret && (opt->flags & OPT_ALIAS_NEGATE) && real->type == OPT_BOOL) {
|
||||||
|
*(long *) ret = !*(long *) ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
redir_wr(struct option *opt, struct string *string)
|
redir_wr(struct option *opt, struct string *string)
|
||||||
|
Loading…
Reference in New Issue
Block a user