mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-09 12:54: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,5 +1,8 @@
|
|||||||
2004-02-26 Marcus Brinkmann <marcus@g10code.de>
|
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.
|
* README.gpgconf: Fix description of arguments.
|
||||||
* gpgconf-comp.c (option_check_validity): Rewritten to properly
|
* gpgconf-comp.c (option_check_validity): Rewritten to properly
|
||||||
support optional arguments in lists.
|
support optional arguments in lists.
|
||||||
|
@ -412,3 +412,11 @@ TODO
|
|||||||
* Extend the backend interface to include gettext domain and
|
* Extend the backend interface to include gettext domain and
|
||||||
description, if available, to avoid repeating this information in
|
description, if available, to avoid repeating this information in
|
||||||
gpgconf.
|
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,22 +1474,74 @@ change_options_program (gc_component_t component, gc_backend_t backend,
|
|||||||
option = gc_component[component].options;
|
option = gc_component[component].options;
|
||||||
while (option->name)
|
while (option->name)
|
||||||
{
|
{
|
||||||
/* FIXME: Add support for lists and default arg (new_value eq ""). */
|
|
||||||
if (!(option->flags & GC_OPT_FLAG_GROUP)
|
if (!(option->flags & GC_OPT_FLAG_GROUP)
|
||||||
&& option->backend == backend
|
&& option->backend == backend
|
||||||
&& option->new_value
|
&& option->new_value)
|
||||||
&& *option->new_value)
|
{
|
||||||
|
char *arg = option->new_value;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (*arg == '\0' || *arg == ',')
|
||||||
{
|
{
|
||||||
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);
|
fprintf (src_file, "%s\n", option->name);
|
||||||
else
|
|
||||||
fprintf (src_file, "%s %s\n", option->name, option->new_value);
|
|
||||||
if (ferror (src_file))
|
if (ferror (src_file))
|
||||||
goto change_one_err;
|
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++;
|
option++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1692,6 +1744,7 @@ gc_component_change_options (int component, FILE *in)
|
|||||||
|
|
||||||
option++;
|
option++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user