1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00
2007-06-18  Marcus Brinkmann  <marcus@g10code.de>

	* stringhelp.h (percent_escape): New prototype.
	* stringhelp.c (percent_escape): New function.

agent/
2007-06-18  Marcus Brinkmann  <marcus@g10code.de>

	* gpg-agent.c (main): Percent escape pathname in --gpgconf-list
	output.

g10/
2007-06-18  Marcus Brinkmann  <marcus@g10code.de>

	* gpg.c (gpgconf_list): Percent escape output of --gpgconf-list.

scdaemon/
2007-06-18  Marcus Brinkmann  <marcus@g10code.de>

	* scdaemon.c (main): Percent escape output of --gpgconf-list.

sm/
2007-06-18  Marcus Brinkmann  <marcus@g10code.de>

	* gpgsm.c (main): Percent escape output of --gpgconf-list.
This commit is contained in:
Marcus Brinkmann 2007-06-18 20:15:01 +00:00
parent b1b471dcc8
commit e47321829d
11 changed files with 89 additions and 14 deletions

View file

@ -1,6 +1,6 @@
/* stringhelp.c - standard string helper functions
* Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005,
* 2006 Free Software Foundation, Inc.
* 2006, 2007 Free Software Foundation, Inc.
*
* This file is part of JNLIB.
*
@ -825,3 +825,37 @@ memrchr (const void *buffer, int c, size_t n)
return NULL;
}
#endif /*HAVE_MEMRCHR*/
/* Percent-escape the string STR by replacing colons with '%3a'. */
char *
percent_escape (const char *str)
{
int i = 0;
int j = 0;
char *ptr;
if (!str)
return NULL;
while (str[i])
if (str[i++] == ':')
j++;
ptr = jnlib_xmalloc (i + 2 * j + 1);
i = 0;
while (*str)
{
if (*str == ':')
{
ptr[i++] = '%';
ptr[i++] = '3';
ptr[i++] = 'a';
}
else
ptr[i++] = *str;
str++;
}
ptr[i] = '\0';
return ptr;
}