diff options
Diffstat (limited to '')
-rw-r--r-- | agent/command.c | 53 |
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; } |