[svn] GnuPG - r5190 - trunk/tools
svn author wk
cvs at cvs.gnupg.org
Wed Nov 4 11:59:11 CET 2009
Author: wk
Date: 2009-11-04 11:59:11 +0100 (Wed, 04 Nov 2009)
New Revision: 5190
Modified:
trunk/tools/ChangeLog
trunk/tools/gpg-connect-agent.c
Log:
Add hack for the HELP command.
Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog 2009-11-04 10:06:38 UTC (rev 5189)
+++ trunk/tools/ChangeLog 2009-11-04 10:59:11 UTC (rev 5190)
@@ -1,3 +1,8 @@
+2009-11-04 Werner Koch <wk at g10code.com>
+
+ * gpg-connect-agent.c (read_and_print_response): Add arg WITHHASH.
+ (main): Pass true for WITHHASH for the HELP command.
+
2009-09-23 Marcus Brinkmann <marcus at g10code.de>
* gpg-connect-agent.c (getinfo_pid_cb, read_and_print_response)
Modified: trunk/tools/gpg-connect-agent.c
===================================================================
--- trunk/tools/gpg-connect-agent.c 2009-11-04 10:06:38 UTC (rev 5189)
+++ trunk/tools/gpg-connect-agent.c 2009-11-04 10:59:11 UTC (rev 5190)
@@ -159,7 +159,8 @@
/*-- local prototypes --*/
static char *substitute_line_copy (const char *buffer);
-static int read_and_print_response (assuan_context_t ctx, int *r_goterr);
+static int read_and_print_response (assuan_context_t ctx, int withhash,
+ int *r_goterr);
static assuan_context_t start_agent (void);
@@ -1232,7 +1233,7 @@
exit (1);
}
- rc = assuan_pipe_connect_ext (ctx, *argv, argv,
+ rc = assuan_pipe_connect_ext (ctx, *argv, (const char **)argv,
no_close, NULL, NULL,
opt.connect_flags);
if (rc)
@@ -1274,7 +1275,7 @@
assuan did not run the initial handshaking). */
if (assuan_pending_line (ctx))
{
- rc = read_and_print_response (ctx, &cmderr);
+ rc = read_and_print_response (ctx, 0, &cmderr);
if (rc)
log_info (_("receiving line failed: %s\n"), gpg_strerror (rc) );
}
@@ -1762,7 +1763,9 @@
if (*line == '#' || !*line)
continue; /* Don't expect a response for a comment line. */
- rc = read_and_print_response (ctx, &cmderr);
+ rc = read_and_print_response (ctx, (!ascii_strncasecmp (line, "HELP", 4)
+ && (spacep (line+4) || !line[4])),
+ &cmderr);
if (rc)
log_info (_("receiving line failed: %s\n"), gpg_strerror (rc) );
if ((rc || cmderr) && script_fp)
@@ -1891,10 +1894,11 @@
/* Read all response lines from server and print them. Returns 0 on
- success or an assuan error code. Set R_GOTERR to true if the
- command did not returned OK. */
+ success or an assuan error code. If WITHHASH istrue, comment lines
+ are printed. Sets R_GOTERR to true if the command did not returned
+ OK. */
static int
-read_and_print_response (assuan_context_t ctx, int *r_goterr)
+read_and_print_response (assuan_context_t ctx, int withhash, int *r_goterr)
{
char *line;
size_t linelen;
@@ -1911,7 +1915,7 @@
if (rc)
return rc;
- if (opt.verbose > 1 && *line == '#')
+ if ((withhash || opt.verbose > 1) && *line == '#')
{
fwrite (line, linelen, 1, stdout);
putchar ('\n');
More information about the Gnupg-commits
mailing list