diff options
author | Justus Winter <[email protected]> | 2016-03-02 13:14:33 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-03-02 13:14:33 +0000 |
commit | e77c85577d1bdd77ad3b81907145fd68f2653c01 (patch) | |
tree | 4c6fc3f74de8d0f052bdbd3ec0de407958be2821 /scd/command.c | |
parent | dirmngr: Add missing CFLAGS. (diff) | |
download | gnupg-e77c85577d1bdd77ad3b81907145fd68f2653c01.tar.gz gnupg-e77c85577d1bdd77ad3b81907145fd68f2653c01.zip |
common: Consolidate Assuan server argument handling.
* common/Makefile.am (common_sources): Add new files.
* common/server-help.c: New file.
* common/server-help.h: Likewise.
* agent/command.c: Drop argument handling primitives in favor of using
the consolidated ones.
* dirmngr/server.c: Likewise.
* g10/server.c: Likewise.
* g13/server.c: Likewise.
* scd/command.c: Likewise.
* sm/server.c: Likewise.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'scd/command.c')
-rw-r--r-- | scd/command.c | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/scd/command.c b/scd/command.c index ba830dec8..4e80d76b4 100644 --- a/scd/command.c +++ b/scd/command.c @@ -42,6 +42,7 @@ #include "ccid-driver.h" #endif #include "asshelp.h" +#include "server-help.h" /* Maximum length allowed as a PIN; used for INQUIRE NEEDPIN */ #define MAXLEN_PIN 100 @@ -219,53 +220,6 @@ update_card_removed (int vrdr, int value) } -/* Check whether the option NAME appears in LINE. Returns 1 or 0. */ -static int -has_option (const char *line, const char *name) -{ - const char *s; - int n = strlen (name); - - s = strstr (line, name); - return (s && (s == line || spacep (s-1)) && (!s[n] || spacep (s+n))); -} - -/* Same as has_option but does only test for the name of the option - and ignores an argument, i.e. with NAME being "--hash" it would - return a pointer for "--hash" as well as for "--hash=foo". If - there is no such option NULL is returned. The pointer returned - points right behind the option name, this may be an equal sign, Nul - or a space. */ -static const char * -has_option_name (const char *line, const char *name) -{ - const char *s; - int n = strlen (name); - - s = strstr (line, name); - return (s && (s == line || spacep (s-1)) - && (!s[n] || spacep (s+n) || s[n] == '=')) ? (s+n) : NULL; -} - - -/* Skip over options. It is assumed that leading spaces have been - removed (this is the case for lines passed to a handler from - assuan). Blanks after the options are also removed. */ -static char * -skip_options (char *line) -{ - while ( *line == '-' && line[1] == '-' ) - { - while (*line && !spacep (line)) - line++; - while (spacep (line)) - line++; - } - return line; -} - - - /* Convert the STRING into a newly allocated buffer while translating the hex numbers. Stops at the first invalid character. Blanks and colons are allowed to separate the hex digits. Returns NULL on |