Commit 35ae733d 35ae733daab73282b969003796781063ac4ddd15 by Sergey Poznyakoff

(mh_usedraft): New function.

1 parent c67dfff6
...@@ -576,3 +576,57 @@ mh_disposition (const char *filename) ...@@ -576,3 +576,57 @@ mh_disposition (const char *filename)
576 wh.prompt = _("Disposition?"); 576 wh.prompt = _("Disposition?");
577 return _whatnow (&wh, disp_tab); 577 return _whatnow (&wh, disp_tab);
578 } 578 }
579
580 /* Use draft shell */
581
582 /* Help table for ``use draft'' shell */
583 static struct helpdata usedraft_helptab[] = {
584 { "no", N_("Don't use the draft.") },
585 { "yes", N_("Use the draft.") },
586 { "list", N_("List the draft on the terminal.") },
587 { NULL },
588 };
589
590 static int
591 usedraft_help (struct mh_whatnow_env *wh, int argc, char **argv, int *status)
592 {
593 return _help (usedraft_helptab, argv[0]);
594 }
595
596 static int
597 yes (struct mh_whatnow_env *wh, int argc, char **argv, int *status)
598 {
599 *status = 1;
600 return 1;
601 }
602
603 static int
604 no (struct mh_whatnow_env *wh, int argc, char **argv, int *status)
605 {
606 *status = 0;
607 return 1;
608 }
609
610 static struct action_tab usedraft_tab[] = {
611 { "help", usedraft_help },
612 { "?", usedraft_help },
613 { "yes", yes },
614 { "no", no },
615 { "list", list },
616 { NULL }
617 };
618
619 int
620 mh_usedraft (const char *filename)
621 {
622 struct mh_whatnow_env wh;
623 int rc;
624
625 memset (&wh, 0, sizeof (wh));
626 wh.file = filename;
627 asprintf (&wh.prompt, _("Use \"%s\"?"), filename);
628 rc = _whatnow (&wh, usedraft_tab);
629 free (wh.prompt);
630 return rc;
631 }
632
......