1
0
Fork 0

bug 1084: Allow '+' and '*' in names in option manager

ELinks already allowed '+' and '*' in the names of options when
reading a configuration file.  The option manager however didn't
let the user add such options.  Allow the characters there too.

These characters are needed especially in the mime.type tree,
where '*' is used as a replacement for '.'.  For example:

set mime.type.audio.prs*sid = "sid"
set mime.type.application.atom+xml = "atom"

This commit changes one gettextised string.
(cherry picked from elinks-0.12 commit 064ff3921d)
This commit is contained in:
Kalle Olavi Niemitalo 2009-08-20 01:01:05 +03:00 committed by Kalle Olavi Niemitalo
parent 58d2fe8eeb
commit 237d30b936
4 changed files with 18 additions and 8 deletions

2
NEWS
View File

@ -112,6 +112,8 @@ To be released as 0.12pre6 or 0.12rc1.
* major bug 764: Correctly initialize options on big-endian 64-bit
systems.
* bug 1084: Allow option names containing '+' and '*' in the option
manager.
Bugs that should be removed from NEWS before the 0.12.0 release:

View File

@ -222,8 +222,8 @@ parse_set_common(struct option *opt_tree, struct conf_parsing_state *state,
/* Option name */
optname_orig = state->pos.look;
while (isident(*state->pos.look) || *state->pos.look == '*'
|| *state->pos.look == '.' || *state->pos.look == '+')
while (is_option_name_char(*state->pos.look)
|| *state->pos.look == '.')
state->pos.look++;
optname_len = state->pos.look - optname_orig;
@ -410,8 +410,8 @@ parse_unset(struct option *opt_tree, struct conf_parsing_state *state,
/* Option name */
optname_orig = state->pos.look;
while (isident(*state->pos.look) || *state->pos.look == '*'
|| *state->pos.look == '.' || *state->pos.look == '+')
while (is_option_name_char(*state->pos.look)
|| *state->pos.look == '.')
state->pos.look++;
optname_len = state->pos.look - optname_orig;

View File

@ -425,13 +425,11 @@ check_option_name(struct dialog_data *dlg_data, struct widget_data *widget_data)
unsigned char *p;
for (p = widget_data->cdata; *p; p++)
/* Not '*' since it is used internally. */
if (!isident(*p)) {
/* FIXME: Encode '.' into '*'? */
if (!is_option_name_char(*p)) {
info_box(dlg_data->win->term, 0,
N_("Bad string"), ALIGN_CENTER,
N_("Option names may only contain alpha-numeric characters\n"
"in addition to '_' and '-'."));
"in addition to '_', '-', '+', and '*'."));
return EVENT_NOT_PROCESSED;
}

View File

@ -330,6 +330,16 @@ extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
unsigned char *, enum option_flags, enum option_type,
long, long, longptr_T, unsigned char *);
/** Check whether the character @a c may be used in the name of an
* option. This does not allow the '.' used in multi-part names like
* "config.comments". If you want to allow that too, check for it
* separately.
*
* If you modify this, please update the error message in
* check_option_name(). */
#define is_option_name_char(c) (isasciialnum(c) || (c) == '_' \
|| (c) == '-' || (c) == '+' || (c) == '*')
/* Hack which permit to disable option descriptions, to reduce elinks binary size.
* It may of some use for people wanting a very small static non-i18n elinks binary,
* at time of writing gain is over 25Kbytes. --Zas */