diff options
author | Marcus Brinkmann <mb@g10code.com> | 2008-05-26 15:43:20 +0200 |
---|---|---|
committer | Marcus Brinkmann <mb@g10code.com> | 2008-05-26 15:43:20 +0200 |
commit | 9c10eb6625afacb997e716d7168dafaecff9aab7 (patch) | |
tree | 5d41b98303210e02bb8f12088c7f69e642a57198 /tools | |
parent | Make --runtime option of gpgconf under W32 work. (diff) | |
download | gnupg2-9c10eb6625afacb997e716d7168dafaecff9aab7.tar.xz gnupg2-9c10eb6625afacb997e716d7168dafaecff9aab7.zip |
doc/
2008-05-26 Marcus Brinkmann <marcus@ulysses.g10code.com>
* tools.texi (Invoking gpgconf): Document --list-dirs.
tools/
2008-05-26 Marcus Brinkmann <marcus@ulysses.g10code.com>
* gpgconf.c (enum cmd_and_opt_values): Add aListDirs.
(opts): Add aListDirs option.
(main): Handle aListDirs.
* gpgconf.h (gc_percent_escape): New declaration.
* gpgconf-comp.c (my_percent_escape): Make non-static and rename
to ...
(gc_percent_escape): ... this. Change all callers.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ChangeLog | 10 | ||||
-rw-r--r-- | tools/gpgconf-comp.c | 32 | ||||
-rw-r--r-- | tools/gpgconf.c | 13 | ||||
-rw-r--r-- | tools/gpgconf.h | 5 |
4 files changed, 43 insertions, 17 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog index 357667415..625e1ab4b 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,13 @@ +2008-05-26 Marcus Brinkmann <marcus@ulysses.g10code.com> + + * gpgconf.c (enum cmd_and_opt_values): Add aListDirs. + (opts): Add aListDirs option. + (main): Handle aListDirs. + * gpgconf.h (gc_percent_escape): New declaration. + * gpgconf-comp.c (my_percent_escape): Make non-static and rename + to ... + (gc_percent_escape): ... this. Change all callers. + 2008-05-26 Werner Koch <wk@g10code.com> * gpgconf-comp.c (gpg_agent_runtime_change) [W32]: Issue diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index 579025eac..44efbd714 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -1097,8 +1097,8 @@ my_dgettext (const char *domain, const char *msgid) /* Percent-Escape special characters. The string is valid until the next invocation of the function. */ -static char * -my_percent_escape (const char *src) +char * +gc_percent_escape (const char *src) { static char *esc_str; static int esc_str_len; @@ -1226,8 +1226,8 @@ gc_component_list_components (FILE *out) desc = gc_component[component].desc; desc = my_dgettext (gc_component[component].desc_domain, desc); fprintf (out, "%s:%s:", - gc_component[component].name, my_percent_escape (desc)); - fprintf (out, "%s\n", my_percent_escape (pgmname)); + gc_component[component].name, gc_percent_escape (desc)); + fprintf (out, "%s\n", gc_percent_escape (pgmname)); } } } @@ -1430,20 +1430,20 @@ gc_component_check_options (int component, FILE *out, const char *conf_file) desc = gc_component[component].desc; desc = my_dgettext (gc_component[component].desc_domain, desc); fprintf (out, "%s:%s:", - gc_component[component].name, my_percent_escape (desc)); - fputs (my_percent_escape (pgmname), out); + gc_component[component].name, gc_percent_escape (desc)); + fputs (gc_percent_escape (pgmname), out); fprintf (out, ":%d:%d:", !(result & 1), !(result & 2)); for (errptr = errlines; errptr; errptr = errptr->next) { if (errptr != errlines) fputs ("\n:::::", out); /* Continuation line. */ if (errptr->fname) - fputs (my_percent_escape (errptr->fname), out); + fputs (gc_percent_escape (errptr->fname), out); putc (':', out); if (errptr->fname) fprintf (out, "%u", errptr->lineno); putc (':', out); - fputs (my_percent_escape (errptr->errtext), out); + fputs (gc_percent_escape (errptr->errtext), out); putc (':', out); } putc ('\n', out); @@ -1559,7 +1559,7 @@ list_one_option (const gc_option_t *option, FILE *out) fprintf (out, " %s", gc_level[option->level].name); /* The description field. */ - fprintf (out, ":%s", desc ? my_percent_escape (desc) : ""); + fprintf (out, ":%s", desc ? gc_percent_escape (desc) : ""); /* The type field. */ fprintf (out, ":%u", option->arg_type); @@ -1573,7 +1573,7 @@ list_one_option (const gc_option_t *option, FILE *out) gc_arg_type[gc_arg_type[option->arg_type].fallback].name); /* The argument name field. */ - fprintf (out, ":%s", arg_name ? my_percent_escape (arg_name) : ""); + fprintf (out, ":%s", arg_name ? gc_percent_escape (arg_name) : ""); if (arg_name) xfree (arg_name); @@ -1892,7 +1892,7 @@ retrieve_options_from_program (gc_component_t component, gc_backend_t backend) } else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_STRING) - opt_value = xasprintf ("\"%s", my_percent_escape (value)); + opt_value = xasprintf ("\"%s", gc_percent_escape (value)); else { /* FIXME: Verify that the number is sane. */ @@ -1983,12 +1983,12 @@ retrieve_options_from_file (gc_component_t component, gc_backend_t backend) really append. */ if (list) { - new_list = xasprintf ("%s,\"%s", list, my_percent_escape (start)); + new_list = xasprintf ("%s,\"%s", list, gc_percent_escape (start)); xfree (list); list = new_list; } else - list = xasprintf ("\"%s", my_percent_escape (start)); + list = xasprintf ("\"%s", gc_percent_escape (start)); } if (length < 0 || ferror (list_file)) gc_error (1, errno, "can not read list file %s", list_pathname); @@ -3448,8 +3448,8 @@ gc_process_gpgconf_conf (const char *fname_arg, int update, int defaults, *p = 0; /* We better strip any extra stuff. */ } - fprintf (listfp, "k:%s:", my_percent_escape (key)); - fprintf (listfp, "%s\n", group? my_percent_escape (group):""); + fprintf (listfp, "k:%s:", gc_percent_escape (key)); + fprintf (listfp, "%s\n", group? gc_percent_escape (group):""); } /* All other lines are rule records. */ @@ -3458,7 +3458,7 @@ gc_process_gpgconf_conf (const char *fname_arg, int update, int defaults, option_info->name? option_info->name : "", flags? flags : ""); if (value != empty) - fprintf (listfp, "\"%s", my_percent_escape (value)); + fprintf (listfp, "\"%s", gc_percent_escape (value)); putc ('\n', listfp); } diff --git a/tools/gpgconf.c b/tools/gpgconf.c index 8813d545b..bf9767146 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -46,7 +46,8 @@ enum cmd_and_opt_values aCheckOptions, aApplyDefaults, aListConfig, - aCheckConfig + aCheckConfig, + aListDirs }; @@ -63,6 +64,8 @@ static ARGPARSE_OPTS opts[] = { aCheckOptions, "check-options", 256, N_("|COMPONENT|check options") }, { aApplyDefaults, "apply-defaults", 256, N_("apply global default values") }, + { aListDirs, "list-dirs", 256, + N_("get the configuration directories for gpgconf") }, { aListConfig, "list-config", 256, N_("list global configuration file") }, { aCheckConfig, "check-config", 256, @@ -165,6 +168,7 @@ main (int argc, char **argv) case oVerbose: opt.verbose++; break; case oNoVerbose: opt.verbose = 0; break; + case aListDirs: case aListComponents: case aCheckPrograms: case aListOptions: @@ -253,6 +257,13 @@ main (int argc, char **argv) if (gc_process_gpgconf_conf (NULL, 1, 1, NULL)) exit (1); break; + + case aListDirs: + /* Show the system configuration directory for gpgconf. */ + get_outfp (&outfp); + fprintf (outfp, "sysconfdir:%s\n", + gc_percent_escape (gnupg_sysconfdir ())); + break; } if (outfp && outfp != stdout) diff --git a/tools/gpgconf.h b/tools/gpgconf.h index 0a27dd9c3..39d2d097b 100644 --- a/tools/gpgconf.h +++ b/tools/gpgconf.h @@ -37,6 +37,11 @@ struct /*-- gpgconf-comp.c --*/ +/* Percent-Escape special characters. The string is valid until the + next invocation of the function. */ +char *gc_percent_escape (const char *src); + + void gc_error (int status, int errnum, const char *fmt, ...); /* List all components that are available. */ |