aboutsummaryrefslogtreecommitdiffstats
path: root/g10/misc.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g10/misc.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/g10/misc.c b/g10/misc.c
index 51c0e6757..c2dfe3515 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -715,23 +715,34 @@ argsplit(char *string)
equals=strchr(string,'=');
if(equals)
{
- char *space;
+ char *quote,*space;
- space=strchr(string,' ');
- if(space)
+ *equals='\0';
+ arg=equals+1;
+
+ /* Quoted arg? */
+ quote=strchr(arg,'"');
+ if(quote)
{
- *space='\0';
- arg=space+1;
+ arg=quote+1;
+
+ quote=strchr(arg,'"');
+ if(quote)
+ *quote='\0';
}
else
{
- *equals='\0';
- arg=equals+1;
+ size_t spaces;
+
+ /* 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)
- arg=space+1;
+ *space='\0';
}
return arg;