From ee6bb32a8bf9adb3d0a48b0d527cda594e49355a Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Wed, 24 Apr 2002 21:52:47 +0000 Subject: 2002-04-24 Marcus Brinkmann * configure.ac: Check for locale.h. agent/ 2002-04-24 Marcus Brinkmann * 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 * 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. --- agent/command.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'agent/command.c') diff --git a/agent/command.c b/agent/command.c index e617d684f..b405ec61c 100644 --- a/agent/command.c +++ b/agent/command.c @@ -494,6 +494,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 @@ -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; } -- cgit