mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgconf: Do not list ignored options and mark forced options as r/o.
* tools/gpgconf-comp.c (list_one_option): Skip ignored options and set the no_change flag for forced options. (retrieve_options_from_program): Put the attributes into the option table. --
This commit is contained in:
parent
85db1b1a3b
commit
42785d7c8a
@ -1468,6 +1468,10 @@ list_one_option (gc_component_id_t component,
|
||||
unsigned long flags;
|
||||
const char *desc_domain = gc_component[component].desc_domain;
|
||||
|
||||
/* Don't show options with the ignore attribute. */
|
||||
if (option->attr_ignore && !option->attr_force)
|
||||
return;
|
||||
|
||||
if (option->desc)
|
||||
{
|
||||
desc = my_dgettext (desc_domain, option->desc);
|
||||
@ -1504,6 +1508,7 @@ list_one_option (gc_component_id_t component,
|
||||
if (option->def_in_desc) flags |= GC_OPT_FLAG_DEF_DESC;
|
||||
if (option->no_arg_desc) flags |= GC_OPT_FLAG_NO_ARG_DESC;
|
||||
if (option->no_change) flags |= GC_OPT_FLAG_NO_CHANGE;
|
||||
if (option->attr_force) flags |= GC_OPT_FLAG_NO_CHANGE;
|
||||
es_fprintf (out, ":%lu", flags);
|
||||
if (opt.verbose)
|
||||
{
|
||||
@ -2058,11 +2063,6 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
||||
{
|
||||
char *opt_value;
|
||||
|
||||
if (pargs.r_type & ARGPARSE_OPT_IGNORE)
|
||||
{
|
||||
/* log_debug ("ignored\n"); */
|
||||
continue;
|
||||
}
|
||||
if (pargs.r_opt == ARGPARSE_CONFFILE)
|
||||
{
|
||||
/* log_debug ("current conffile='%s'\n", */
|
||||
@ -2084,8 +2084,18 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed)
|
||||
if (!option)
|
||||
continue; /* We don't want to handle this option. */
|
||||
|
||||
option->attr_ignore = !!(pargs.r_type & ARGPARSE_ATTR_IGNORE);
|
||||
option->attr_force = !!(pargs.r_type & ARGPARSE_ATTR_FORCE);
|
||||
/* Set the force and ignore attributes. The idea is that there
|
||||
* is no way to clear them again, thus we set them when first
|
||||
* encountered. */
|
||||
if ((pargs.r_type & ARGPARSE_ATTR_FORCE))
|
||||
option->attr_force = 1;
|
||||
if ((pargs.r_type & ARGPARSE_ATTR_IGNORE))
|
||||
option->attr_ignore = 1;
|
||||
|
||||
/* If an option has been ignored, there is no need to return
|
||||
* that option with gpgconf --list-options. */
|
||||
if (option->attr_ignore)
|
||||
continue;
|
||||
|
||||
switch ((pargs.r_type & ARGPARSE_TYPE_MASK))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user