summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-11-04 11:59:11 +0100
committerWerner Koch <wk@gnupg.org>2009-11-04 11:59:11 +0100
commitb15dffd9a8b2d954568ba317407c7a93014dcf3d (patch)
tree5632f1a95f2081634cbbb0493cb529eecdd64921 /tools
parentAdjust for assuan_register_command change. (diff)
downloadgnupg2-b15dffd9a8b2d954568ba317407c7a93014dcf3d.tar.xz
gnupg2-b15dffd9a8b2d954568ba317407c7a93014dcf3d.zip
Add hack for the HELP command.
Diffstat (limited to 'tools')
-rw-r--r--tools/ChangeLog5
-rw-r--r--tools/gpg-connect-agent.c20
2 files changed, 17 insertions, 8 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog
index 9e19287d6..7a1407692 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-04 Werner Koch <wk@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@g10code.de>
* gpg-connect-agent.c (getinfo_pid_cb, read_and_print_response)
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index b22911219..a2fb1d136 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -159,7 +159,8 @@ static struct
/*-- 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 @@ main (int argc, char **argv)
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 @@ main (int argc, char **argv)
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 @@ main (int argc, char **argv)
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 @@ handle_inquire (assuan_context_t ctx, char *line)
/* 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 @@ read_and_print_response (assuan_context_t ctx, int *r_goterr)
if (rc)
return rc;
- if (opt.verbose > 1 && *line == '#')
+ if ((withhash || opt.verbose > 1) && *line == '#')
{
fwrite (line, linelen, 1, stdout);
putchar ('\n');