Commit fd397a44 fd397a445c6f7fb88cef1af99eca8d348c7156a9 by Sergey Poznyakoff

(mh_interactive_mode_p, mh_getyn_interactive)

(mh_vgetyn): New functions.
(mh_real_install): Use mh_getyn_interactive().
1 parent b6edf724
...@@ -239,12 +239,20 @@ mh_check_folder (char *pathname, int confirm) ...@@ -239,12 +239,20 @@ mh_check_folder (char *pathname, int confirm)
239 } 239 }
240 240
241 int 241 int
242 mh_getyn (const char *fmt, ...) 242 mh_interactive_mode_p ()
243 {
244 static int interactive = -1;
245
246 if (interactive < 0)
247 interactive = isatty (fileno (stdin)) ? 1 : 0;
248 return interactive;
249 }
250
251 int
252 mh_vgetyn (const char *fmt, va_list ap)
243 { 253 {
244 va_list ap;
245 char repl[64]; 254 char repl[64];
246 255
247 va_start (ap, fmt);
248 while (1) 256 while (1)
249 { 257 {
250 char *p; 258 char *p;
...@@ -277,6 +285,34 @@ mh_getyn (const char *fmt, ...) ...@@ -277,6 +285,34 @@ mh_getyn (const char *fmt, ...)
277 return 0; /* to pacify gcc */ 285 return 0; /* to pacify gcc */
278 } 286 }
279 287
288 int
289 mh_getyn (const char *fmt, ...)
290 {
291 va_list ap;
292 char repl[64];
293 int rc;
294
295 if (mh_interactive_mode_p ())
296 return 1;
297 va_start (ap, fmt);
298 rc = mh_vgetyn (fmt, ap);
299 va_end (ap);
300 return rc;
301 }
302
303 int
304 mh_getyn_interactive (const char *fmt, ...)
305 {
306 va_list ap;
307 char repl[64];
308 int rc;
309
310 va_start (ap, fmt);
311 rc = mh_vgetyn (fmt, ap);
312 va_end (ap);
313 return rc;
314 }
315
280 FILE * 316 FILE *
281 mh_audit_open (char *name, mailbox_t mbox) 317 mh_audit_open (char *name, mailbox_t mbox)
282 { 318 {
......