diff options
author | David Shaw <[email protected]> | 2004-07-28 15:36:23 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-07-28 15:36:23 +0000 |
commit | 0d7aca863de34e1441fe4e24cc1d67a8a9773346 (patch) | |
tree | 8e5f7c26a384e07f614db16b66d7280c9d85c03a | |
parent | * misc.c (optsep): Add the ability to understand keyword="quoted arg with (diff) | |
download | gnupg-0d7aca863de34e1441fe4e24cc1d67a8a9773346.tar.gz gnupg-0d7aca863de34e1441fe4e24cc1d67a8a9773346.zip |
* misc.c (argsplit): Properly split quoted args from the keyword and trim
whitespace afterwards.
Diffstat (limited to '')
-rw-r--r-- | g10/ChangeLog | 5 | ||||
-rw-r--r-- | g10/misc.c | 29 |
2 files changed, 25 insertions, 9 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 5d623f83a..0bbf97c03 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,8 @@ +2004-07-28 David Shaw <[email protected]> + + * misc.c (argsplit): Properly split quoted args from the keyword + and trim whitespace afterwards. + 2004-07-27 David Shaw <[email protected]> * misc.c (optsep): Add the ability to understand keyword="quoted 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; |