From 598da26b5433c3fdc8f4fcd12730fa8416d82c62 Mon Sep 17 00:00:00 2001 From: Guyzmo Date: Mon, 16 Jan 2017 22:29:34 +0100 Subject: [PATCH] Added -B option for batch mode. exiting before any mail sending feature --- main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index fd911907b..735283b16 100644 --- a/main.c +++ b/main.c @@ -89,6 +89,7 @@ static void mutt_usage (void) mutt [] -p\n\ mutt [] -A [...]\n\ mutt [] -Q [...]\n\ + mutt [] -B\n\ mutt [] -D [-S]\n\ mutt -v[v]\n")); @@ -100,7 +101,8 @@ options:\n\ -b
\tspecify a blind carbon-copy (BCC) address\n\ -c
\tspecify a carbon-copy (CC) address\n\ -D\t\tprint the value of all variables to stdout\n\ - -D -S\t\tlike -D, but hide the value of sensitive variables")); + -D -S\t\tlike -D, but hide the value of sensitive variables\n\ + -B\t\trun in batch mode (do not start the ncurses UI)")); #if DEBUG puts (_(" -d \tlog debugging output to ~/.muttdebug0")); #endif @@ -199,6 +201,7 @@ int main (int argc, char **argv, char **environ) int explicit_folder = 0; int dump_variables = 0; int hide_sensitive = 0; + int batch_mode = 0; int edit_infile = 0; extern char *optarg; extern int optind; @@ -264,9 +267,9 @@ int main (int argc, char **argv, char **environ) } #ifdef USE_NNTP - if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:Ee:g:GH:s:i:hm:npQ:RSvxyzZ")) != EOF) + if ((i = getopt (argc, argv, "+A:a:Bb:F:f:c:Dd:Ee:g:GH:s:i:hm:npQ:RSvxyzZ")) != EOF) #else - if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:Ee:H:s:i:hm:npQ:RSvxyzZ")) != EOF) + if ((i = getopt (argc, argv, "+A:a:Bb:F:f:c:Dd:Ee:H:s:i:hm:npQ:RSvxyzZ")) != EOF) #endif switch (i) { @@ -303,6 +306,10 @@ int main (int argc, char **argv, char **environ) dump_variables = 1; break; + case 'B': + batch_mode = 1; + break; + case 'd': #ifdef DEBUG if (mutt_atoi (optarg, &debuglevel) < 0 || debuglevel <= 0) @@ -419,7 +426,7 @@ int main (int argc, char **argv, char **environ) } /* Check for a batch send. */ - if (!isatty (0) || queries || alias_queries || dump_variables) + if (!isatty (0) || queries || alias_queries || dump_variables || batch_mode) { set_option (OPTNOCURSES); sendflags = SENDBATCH; @@ -513,6 +520,9 @@ int main (int argc, char **argv, char **environ) } } + if (batch_mode) + exit(0); + if (sendflags & SENDPOSTPONED) { if (!option (OPTNOCURSES)) -- 2.40.0