[svn] assuan - r335 - trunk/src
svn author wk
cvs at cvs.gnupg.org
Mon Dec 14 13:16:30 CET 2009
Author: wk
Date: 2009-12-14 13:16:30 +0100 (Mon, 14 Dec 2009)
New Revision: 335
Modified:
trunk/src/ChangeLog
trunk/src/assuan.h
trunk/src/client.c
Log:
Return and parse comment lines with the assuan_client_ functions.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2009-12-08 20:56:11 UTC (rev 334)
+++ trunk/src/ChangeLog 2009-12-14 12:16:30 UTC (rev 335)
@@ -1,3 +1,10 @@
+2009-12-14 Werner Koch <wk at g10code.com>
+
+ * assuan.h (ASSUAN_RESPONSE_COMMENT): New.
+ * client.c (assuan_client_read_response): Return comment lines.
+ (assuan_client_parse_response): Return ASSUAN_RESPONSE_COMMENT.
+ (_assuan_read_from_server): Skip comment lines.
+
2009-12-08 Marcus Brinkmann <marcus at g10code.de>
* assuan.h (struct assuan_system_hooks): Don't use "namespace" as
Modified: trunk/src/assuan.h
===================================================================
--- trunk/src/assuan.h 2009-12-08 20:56:11 UTC (rev 334)
+++ trunk/src/assuan.h 2009-12-14 12:16:30 UTC (rev 335)
@@ -431,6 +431,7 @@
#define ASSUAN_RESPONSE_INQUIRE 3
#define ASSUAN_RESPONSE_STATUS 4
#define ASSUAN_RESPONSE_END 5
+#define ASSUAN_RESPONSE_COMMENT 6
typedef int assuan_response_t;
/* This already de-escapes data lines. */
Modified: trunk/src/client.c
===================================================================
--- trunk/src/client.c 2009-12-08 20:56:11 UTC (rev 334)
+++ trunk/src/client.c 2009-12-14 12:16:30 UTC (rev 335)
@@ -91,7 +91,7 @@
line = ctx->inbound.line;
linelen = ctx->inbound.linelen;
}
- while (*line == '#' || !linelen);
+ while (!linelen);
/* For data lines, we deescape immediately. The user will never
have to worry about it. */
@@ -181,6 +181,11 @@
*response = ASSUAN_RESPONSE_END;
*off = 3;
}
+ else if (linelen >= 1 && line[0] == '#')
+ {
+ *response = ASSUAN_RESPONSE_COMMENT;
+ *off = 1;
+ }
else
return _assuan_error (ctx, GPG_ERR_ASS_INV_RESPONSE);
@@ -196,11 +201,16 @@
char *line;
int linelen;
- *response = ASSUAN_RESPONSE_ERROR;
- *off = 0;
- rc = assuan_client_read_response (ctx, &line, &linelen);
- if (!rc)
- rc = assuan_client_parse_response (ctx, line, linelen, response, off);
+ do
+ {
+ *response = ASSUAN_RESPONSE_ERROR;
+ *off = 0;
+ rc = assuan_client_read_response (ctx, &line, &linelen);
+ if (!rc)
+ rc = assuan_client_parse_response (ctx, line, linelen, response, off);
+ }
+ while (!rc && *response == ASSUAN_RESPONSE_COMMENT);
+
return rc;
}
More information about the Gnupg-commits
mailing list