2004-02-26 Marcus Brinkmann <marcus@g10code.de>

* gpgconf-comp.c (gc_component_list_options): Do not print empty
	groups.
This commit is contained in:
Marcus Brinkmann 2004-02-26 22:45:19 +00:00
parent 91a514f2a1
commit 4a038d65af
2 changed files with 124 additions and 99 deletions

View File

@ -1,5 +1,8 @@
2004-02-26 Marcus Brinkmann <marcus@g10code.de>
* gpgconf-comp.c (gc_component_list_options): Do not print empty
groups.
* gpgconf-comp.c (option_check_validity): Check if option is
active.
(change_options_file): Implement.

View File

@ -736,25 +736,13 @@ gc_component_find (const char *name)
}
/* List all options of the component COMPONENT. */
void
gc_component_list_options (int component, FILE *out)
{
const gc_option_t *option = gc_component[component].options;
while (option->name)
/* List the option OPTION. */
static void
list_one_option (const gc_option_t *option, FILE *out)
{
const char *desc = NULL;
char *arg_name = NULL;
/* Do not output unknown or internal options. */
if (!(option->flags & GC_OPT_FLAG_GROUP)
&& (!option->active || option->level == GC_LEVEL_INTERNAL))
{
option++;
continue;
}
if (option->desc)
{
desc = my_dgettext (option->desc_domain, option->desc);
@ -774,9 +762,10 @@ gc_component_list_options (int component, FILE *out)
}
}
/* YOU MUST NOT REORDER THE FIELDS IN THIS OUTPUT, AS THEIR
ORDER IS PART OF THE EXTERNAL INTERFACE. YOU MUST NOT REMOVE
ANY FIELDS. */
/* YOU MUST NOT REORDER THE FIELDS IN THIS OUTPUT, AS THEIR ORDER IS
PART OF THE EXTERNAL INTERFACE. YOU MUST NOT REMOVE ANY
FIELDS. */
/* The name field. */
fprintf (out, "%s", option->name);
@ -854,6 +843,39 @@ gc_component_list_options (int component, FILE *out)
/* ADD NEW FIELDS HERE. */
putc ('\n', out);
}
/* List all options of the component COMPONENT. */
void
gc_component_list_options (int component, FILE *out)
{
const gc_option_t *option = gc_component[component].options;
const gc_option_t *group_option = NULL;
while (option->name)
{
/* Do not output unknown or internal options. */
if (!(option->flags & GC_OPT_FLAG_GROUP)
&& (!option->active || option->level == GC_LEVEL_INTERNAL))
{
option++;
continue;
}
if (option->flags & GC_OPT_FLAG_GROUP)
group_option = option;
else
{
if (group_option)
{
list_one_option (group_option, out);
group_option = NULL;
}
list_one_option (option, out);
}
option++;
}
}