From e77c85577d1bdd77ad3b81907145fd68f2653c01 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 2 Mar 2016 14:14:33 +0100 Subject: 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 --- sm/server.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'sm') diff --git a/sm/server.c b/sm/server.c index e21c6a4f5..a43ff3472 100644 --- a/sm/server.c +++ b/sm/server.c @@ -30,6 +30,7 @@ #include "gpgsm.h" #include #include "sysutils.h" +#include "server-help.h" #define set_error(e,t) assuan_set_error (ctx, gpg_error (e), (t)) @@ -95,38 +96,6 @@ strcpy_escaped_plus (char *d, const char *s) } -/* Skip over options. - Blanks after the options are also removed. */ -static char * -skip_options (const char *line) -{ - while (spacep (line)) - line++; - while ( *line == '-' && line[1] == '-' ) - { - while (*line && !spacep (line)) - line++; - while (spacep (line)) - line++; - } - return (char*)line; -} - - -/* Check whether the option NAME appears in LINE */ -static int -has_option (const char *line, const char *name) -{ - const char *s; - int n = strlen (name); - - s = strstr (line, name); - if (s && s >= skip_options (line)) - return 0; - return (s && (s == line || spacep (s-1)) && (!s[n] || spacep (s+n))); -} - - /* A write handler used by es_fopencookie to write assuan data lines. */ static gpgrt_ssize_t -- cgit v1.2.3