aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2002-04-24 21:52:47 +0000
committerMarcus Brinkmann <[email protected]>2002-04-24 21:52:47 +0000
commitee6bb32a8bf9adb3d0a48b0d527cda594e49355a (patch)
treeff9c1c7939f01bd1cc8b0116b87c07235956200f /agent/command.c
parent* certreqgen.c (gpgsm_genkey): Write status output on success. (diff)
downloadgnupg-ee6bb32a8bf9adb3d0a48b0d527cda594e49355a.tar.gz
gnupg-ee6bb32a8bf9adb3d0a48b0d527cda594e49355a.zip
2002-04-24 Marcus Brinkmann <[email protected]>
* configure.ac: Check for locale.h. agent/ 2002-04-24 Marcus Brinkmann <[email protected]> * agent.h (struct opt): Add members display, ttyname, ttytype, lc_ctype, and lc_messages. * gpg-agent.c (enum cmd_and_opt_values): Add oDisplay, oTTYname, oTTYtype, oLCctype, and LCmessages. (main): Handle these options. * command.c (option_handler): New function. (register_commands): Register option handler. * query.c (start_pinentry): Pass the various display and tty options to the pinentry. sm/ 2002-04-24 Marcus Brinkmann <[email protected]> * gpgsm.h (struct opt): New members display, ttyname, ttytype, lc_ctype, lc_messages. * gpgsm.c (enum cmd_and_opt_values): New members oDisplay, oTTYname, oTTYtype, oLCctype, oLCmessages. (opts): New entries for these options. (main): Handle these new options. * call-agent.c (start_agent): Set the various display and tty parameter after resetting.
Diffstat (limited to '')
-rw-r--r--agent/command.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/agent/command.c b/agent/command.c
index e617d684f..b405ec61c 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -495,6 +495,58 @@ cmd_learn (ASSUAN_CONTEXT ctx, char *line)
+static int
+option_handler (ASSUAN_CONTEXT ctx, const char *key, const char *value)
+{
+ CTRL ctrl = assuan_get_pointer (ctx);
+
+ if (!strcmp (key, "display"))
+ {
+ if (opt.display)
+ free (opt.display);
+ opt.display = strdup (value);
+ if (!opt.display)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "ttyname"))
+ {
+ if (opt.ttyname)
+ free (opt.ttyname);
+ opt.ttyname = strdup (value);
+ if (!opt.ttyname)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "ttytype"))
+ {
+ if (opt.ttytype)
+ free (opt.ttytype);
+ opt.ttytype = strdup (value);
+ if (!opt.ttytype)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "lc-ctype"))
+ {
+ if (opt.lc_ctype)
+ free (opt.lc_ctype);
+ opt.lc_ctype = strdup (value);
+ if (!opt.lc_ctype)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "lc-messages"))
+ {
+ if (opt.lc_messages)
+ free (opt.lc_messages);
+ opt.lc_messages = strdup (value);
+ if (!opt.lc_messages)
+ return ASSUAN_Out_Of_Core;
+ }
+ else
+ return ASSUAN_Invalid_Option;
+
+ return 0;
+}
+
+
/* Tell the assuan library about our commands */
static int
register_commands (ASSUAN_CONTEXT ctx)
@@ -533,6 +585,7 @@ register_commands (ASSUAN_CONTEXT ctx)
return rc;
}
assuan_register_reset_notify (ctx, reset_notify);
+ assuan_register_option_handler (ctx, option_handler);
return 0;
}