summaryrefslogtreecommitdiff
path: root/comsat/action.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-12-07 23:03:33 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2010-12-07 23:03:33 +0200
commit2cbe825eb999f224ce756510dbd7123bc76ec924 (patch)
tree2290398d5cbf0a3c048efd225dc991f86399db56 /comsat/action.c
parent04c2931bb963fefd4654ef2de2cf0667cf8a333d (diff)
downloadmailutils-2cbe825eb999f224ce756510dbd7123bc76ec924.tar.gz
mailutils-2cbe825eb999f224ce756510dbd7123bc76ec924.tar.bz2
comsat: add a way to specify alternative biffrc file name; new biffrc statement: tty
* comsat/comsat.c (options): New option --file. (biffrc): New variable. (comsatd_parse_opt): Handle the --file option. (open_tty): New function. (notify_user): Open the tty using open_tty function and a default set of filters. (main): Hanlde --file option. * comsat/action.c (run_user_action): Implement the `tty' statement. * comsat/comsat.h (biffrc): New extern. (open_tty): New function. mu: accept a chain of filters. * mu/filter.c (filter_doc, filter_docstring): Update. (mutool_filter): Accept a filter chain.
Diffstat (limited to 'comsat/action.c')
-rw-r--r--comsat/action.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/comsat/action.c b/comsat/action.c
index dcb256304..46afde5e3 100644
--- a/comsat/action.c
+++ b/comsat/action.c
@@ -331,7 +331,7 @@ run_user_action (mu_stream_t tty, mu_message_t msg)
mu_stream_t input;
int nact = 0;
- input = open_rc (BIFF_RC, tty);
+ input = open_rc (biffrc, tty);
if (input)
{
char *stmt = NULL;
@@ -384,8 +384,23 @@ run_user_action (mu_stream_t tty, mu_message_t msg)
if (!ws.ws_wordv[i])
break;
}
-
- if (strcmp (ws.ws_wordv[0], "echo") == 0)
+
+ if (strcmp (ws.ws_wordv[0], "tty") == 0)
+ {
+ mu_stream_t ntty = open_tty (ws.ws_wordv[1],
+ ws.ws_wordc - 2,
+ ws.ws_wordv + 2);
+ if (!ntty)
+ {
+ mu_stream_printf (tty,
+ _(".biffrc:%d: cannot open tty\n"),
+ locus.mu_line);
+ break;
+ }
+ mu_stream_destroy (&tty);
+ tty = ntty;
+ }
+ else if (strcmp (ws.ws_wordv[0], "echo") == 0)
{
int argc = ws.ws_wordc - 1;
char **argv = ws.ws_wordv + 1;

Return to:

Send suggestions and report system problems to the System administrator.