1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Made percent_escape more general.

Added regression tests support to jnlib.
W32 changes.
This commit is contained in:
Werner Koch 2007-06-19 09:11:11 +00:00
parent e47321829d
commit 540f9164c0
18 changed files with 551 additions and 56 deletions

View file

@ -984,7 +984,7 @@ 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 *
percent_escape (const char *src)
my_percent_escape (const char *src)
{
static char *esc_str;
static int esc_str_len;
@ -1083,7 +1083,8 @@ gc_component_list_components (FILE *out)
{
const char *desc = gc_component[idx].desc;
desc = my_dgettext (gc_component[idx].desc_domain, desc);
fprintf (out, "%s:%s\n", gc_component[idx].name, percent_escape (desc));
fprintf (out, "%s:%s\n",
gc_component[idx].name, my_percent_escape (desc));
}
}
@ -1174,7 +1175,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 ? percent_escape (desc) : "");
fprintf (out, ":%s", desc ? my_percent_escape (desc) : "");
/* The type field. */
fprintf (out, ":%u", option->arg_type);
@ -1188,7 +1189,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 ? percent_escape (arg_name) : "");
fprintf (out, ":%s", arg_name ? my_percent_escape (arg_name) : "");
if (arg_name)
xfree (arg_name);
@ -1458,7 +1459,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", percent_escape (value));
opt_value = xasprintf ("\"%s", my_percent_escape (value));
else
{
/* FIXME: Verify that the number is sane. */
@ -1549,12 +1550,12 @@ retrieve_options_from_file (gc_component_t component, gc_backend_t backend)
really append. */
if (list)
{
new_list = xasprintf ("%s,\"%s", list, percent_escape (start));
new_list = xasprintf ("%s,\"%s", list, my_percent_escape (start));
xfree (list);
list = new_list;
}
else
list = xasprintf ("\"%s", percent_escape (start));
list = xasprintf ("\"%s", my_percent_escape (start));
}
if (length < 0 || ferror (list_file))
gc_error (1, errno, "can not read list file %s", list_pathname);