mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
* misc.c (argsplit): Properly split quoted args from the keyword and trim
whitespace afterwards.
This commit is contained in:
parent
a2e332cded
commit
0d7aca863d
@ -1,3 +1,8 @@
|
|||||||
|
2004-07-28 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* misc.c (argsplit): Properly split quoted args from the keyword
|
||||||
|
and trim whitespace afterwards.
|
||||||
|
|
||||||
2004-07-27 David Shaw <dshaw@jabberwocky.com>
|
2004-07-27 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* misc.c (optsep): Add the ability to understand keyword="quoted
|
* misc.c (optsep): Add the ability to understand keyword="quoted
|
||||||
|
29
g10/misc.c
29
g10/misc.c
@ -715,23 +715,34 @@ argsplit(char *string)
|
|||||||
equals=strchr(string,'=');
|
equals=strchr(string,'=');
|
||||||
if(equals)
|
if(equals)
|
||||||
{
|
{
|
||||||
char *space;
|
char *quote,*space;
|
||||||
|
|
||||||
space=strchr(string,' ');
|
*equals='\0';
|
||||||
if(space)
|
arg=equals+1;
|
||||||
|
|
||||||
|
/* Quoted arg? */
|
||||||
|
quote=strchr(arg,'"');
|
||||||
|
if(quote)
|
||||||
{
|
{
|
||||||
*space='\0';
|
arg=quote+1;
|
||||||
arg=space+1;
|
|
||||||
|
quote=strchr(arg,'"');
|
||||||
|
if(quote)
|
||||||
|
*quote='\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*equals='\0';
|
size_t spaces;
|
||||||
arg=equals+1;
|
|
||||||
|
/* Trim leading spaces off of the arg */
|
||||||
|
spaces=strspn(arg," ");
|
||||||
|
arg+=spaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
space=strrchr(arg,' ');
|
/* Trim tailing spaces off of the tag */
|
||||||
|
space=strchr(string,' ');
|
||||||
if(space)
|
if(space)
|
||||||
arg=space+1;
|
*space='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user