mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
2004-02-26 Marcus Brinkmann <marcus@g10code.de>
* gpgconf-comp.c (change_options_program): Support all types of options, including list types.
This commit is contained in:
parent
255d2cea04
commit
aa7a4c1aec
@ -1,9 +1,12 @@
|
||||
2004-02-26 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgconf-comp.c (change_options_program): Support all types of
|
||||
options, including list types.
|
||||
|
||||
* README.gpgconf: Fix description of arguments.
|
||||
* gpgconf-comp.c (option_check_validity): Rewritten to properly
|
||||
support optional arguments in lists.
|
||||
|
||||
|
||||
* README.gpgconf: Add info about optional arg and arg type 0.
|
||||
* gpgconf-comp.c (gc_component_change_options): Parse list of
|
||||
arg type 0 options.
|
||||
|
@ -412,3 +412,11 @@ TODO
|
||||
* Extend the backend interface to include gettext domain and
|
||||
description, if available, to avoid repeating this information in
|
||||
gpgconf.
|
||||
|
||||
* Left out string arguments (optional) are written out exactly as
|
||||
empty string arguments. Should we do quoting?
|
||||
|
||||
* More string argument trouble: Special characters like newlines etc
|
||||
cause trouble. Again, should we do quoting?
|
||||
|
||||
|
||||
|
@ -1474,21 +1474,73 @@ change_options_program (gc_component_t component, gc_backend_t backend,
|
||||
option = gc_component[component].options;
|
||||
while (option->name)
|
||||
{
|
||||
/* FIXME: Add support for lists and default arg (new_value eq ""). */
|
||||
if (!(option->flags & GC_OPT_FLAG_GROUP)
|
||||
&& option->backend == backend
|
||||
&& option->new_value
|
||||
&& *option->new_value)
|
||||
&& option->new_value)
|
||||
{
|
||||
if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_STRING)
|
||||
fprintf (src_file, "%s %s\n", option->name,
|
||||
percent_deescape (&option->new_value[1]));
|
||||
else if (option->arg_type == GC_ARG_TYPE_NONE)
|
||||
fprintf (src_file, "%s\n", option->name);
|
||||
else
|
||||
fprintf (src_file, "%s %s\n", option->name, option->new_value);
|
||||
if (ferror (src_file))
|
||||
goto change_one_err;
|
||||
char *arg = option->new_value;
|
||||
|
||||
do
|
||||
{
|
||||
if (*arg == '\0' || *arg == ',')
|
||||
{
|
||||
fprintf (src_file, "%s\n", option->name);
|
||||
if (ferror (src_file))
|
||||
goto change_one_err;
|
||||
}
|
||||
else if (gc_arg_type[option->arg_type].fallback
|
||||
== GC_ARG_TYPE_NONE)
|
||||
{
|
||||
assert (*arg == '1');
|
||||
fprintf (src_file, "%s\n", option->name);
|
||||
if (ferror (src_file))
|
||||
goto change_one_err;
|
||||
|
||||
arg++;
|
||||
}
|
||||
else if (gc_arg_type[option->arg_type].fallback
|
||||
== GC_ARG_TYPE_STRING)
|
||||
{
|
||||
char *end;
|
||||
|
||||
assert (*arg == '"');
|
||||
arg++;
|
||||
|
||||
end = strchr (arg, ',');
|
||||
if (end)
|
||||
*end = '\0';
|
||||
|
||||
fprintf (src_file, "%s %s\n", option->name,
|
||||
percent_deescape (arg));
|
||||
if (ferror (src_file))
|
||||
goto change_one_err;
|
||||
|
||||
if (end)
|
||||
*end = ',';
|
||||
arg = end;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *end;
|
||||
|
||||
end = strchr (arg, ',');
|
||||
if (end)
|
||||
*end = '\0';
|
||||
|
||||
fprintf (src_file, "%s %s\n", option->name, arg);
|
||||
if (ferror (src_file))
|
||||
goto change_one_err;
|
||||
|
||||
if (end)
|
||||
*end = ',';
|
||||
arg = end;
|
||||
}
|
||||
|
||||
assert (arg == NULL || *arg == '\0' || *arg == ',');
|
||||
if (arg && *arg == ',')
|
||||
arg++;
|
||||
}
|
||||
while (arg && *arg);
|
||||
}
|
||||
option++;
|
||||
}
|
||||
@ -1692,6 +1744,7 @@ gc_component_change_options (int component, FILE *in)
|
||||
|
||||
option++;
|
||||
}
|
||||
|
||||
if (!err)
|
||||
{
|
||||
int i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user