Commit 2e819503 2e8195037be7f8a211b6cd10c65aae602326f306 by Sergey Poznyakoff

Use ml_readline(). Check for `!interactive' and

force appropriate settings _after_ sourcing mail.rc files.
Force `set quiet' if in non-interactive mode.
1 parent ce88b414
...@@ -146,7 +146,7 @@ mail_cmdline(void *closure, int cont) ...@@ -146,7 +146,7 @@ mail_cmdline(void *closure, int cont)
146 if (interactive) 146 if (interactive)
147 prompt = pev->set && pev->value != NULL ? pev->value : (char *)"? "; 147 prompt = pev->set && pev->value != NULL ? pev->value : (char *)"? ";
148 148
149 rc = readline (prompt); 149 rc = ml_readline (prompt);
150 150
151 if (ml_got_interrupt()) 151 if (ml_got_interrupt())
152 { 152 {
...@@ -223,16 +223,8 @@ main (int argc, char **argv) ...@@ -223,16 +223,8 @@ main (int argc, char **argv)
223 /* set defaults for execution */ 223 /* set defaults for execution */
224 util_do_command ("set noallnet"); 224 util_do_command ("set noallnet");
225 util_do_command ("set noappend"); 225 util_do_command ("set noappend");
226 if (interactive)
227 {
228 util_do_command ("set asksub"); 226 util_do_command ("set asksub");
229 util_do_command ("set crt"); 227 util_do_command ("set crt");
230 }
231 else
232 {
233 util_do_command ("set noasksub");
234 util_do_command ("set nocrt");
235 }
236 util_do_command ("set noaskbcc"); 228 util_do_command ("set noaskbcc");
237 util_do_command ("set askcc"); 229 util_do_command ("set askcc");
238 util_do_command ("set noautoprint"); 230 util_do_command ("set noautoprint");
...@@ -293,6 +285,14 @@ main (int argc, char **argv) ...@@ -293,6 +285,14 @@ main (int argc, char **argv)
293 if ((util_find_env ("rc"))->set) 285 if ((util_find_env ("rc"))->set)
294 util_do_command ("source %s", SITE_MAIL_RC); 286 util_do_command ("source %s", SITE_MAIL_RC);
295 util_do_command ("source %s", getenv ("MAILRC")); 287 util_do_command ("source %s", getenv ("MAILRC"));
288 if (!interactive)
289 {
290 util_do_command ("set nocrt");
291 util_do_command ("set noasksub");
292 util_do_command ("set noaskcc");
293 util_do_command ("set noaskbcc");
294 util_do_command ("set quiet");
295 }
296 296
297 /* how should we be running? */ 297 /* how should we be running? */
298 if ((mode = util_find_env ("mode")) == NULL || mode->set == 0) 298 if ((mode = util_find_env ("mode")) == NULL || mode->set == 0)
......