X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/cff8de7654cf393a494b01a587bd4d503d15a5e3..e9cc3bfbaa08c7621ece35211ce669e60ef5f7c7:/uip/packf.c diff --git a/uip/packf.c b/uip/packf.c index cd003dd7..d8e037db 100644 --- a/uip/packf.c +++ b/uip/packf.c @@ -11,21 +11,21 @@ #include #include #include -#include - -static struct swit switches[] = { -#define FILESW 0 - { "file name", 0 }, -#define MBOXSW 1 - { "mbox", 0 }, -#define MMDFSW 2 - { "mmdf", 0 }, -#define VERSIONSW 3 - { "version", 0 }, -#define HELPSW 4 - { "help", 0 }, - { NULL, 0 } -}; + +#define PACKF_SWITCHES \ + X("file name", 0, FILESW) \ + X("mbox", 0, MBOXSW) \ + X("mmdf", 0, MMDFSW) \ + X("version", 0, VERSIONSW) \ + X("help", 0, HELPSW) \ + +#define X(sw, minchars, id) id, +DEFINE_SWITCH_ENUM(PACKF); +#undef X + +#define X(sw, minchars, id) { sw, minchars, id }, +DEFINE_SWITCH_ARRAY(PACKF, switches); +#undef X static int md = NOTOK; static int mbx_style = MBOX_FORMAT; @@ -46,15 +46,9 @@ main (int argc, char **argv) struct msgs *mp; struct stat st; - done=mbxclose_done; - -#ifdef LOCALE - setlocale(LC_ALL, ""); -#endif - invo_name = r1bindex (argv[0], '/'); + if (nmh_init(argv[0], 1)) { return 1; } - /* read user profile/context */ - context_read(); + done=mbxclose_done; arguments = getarguments (invo_name, argc, argv, 1); argp = arguments; @@ -117,7 +111,7 @@ main (int argc, char **argv) if (errno != ENOENT) adios (file, "error on file"); cp = concat ("Create file \"", file, "\"? ", NULL); - if (!getanswer (cp)) + if (!read_yes_or_no_if_tty (cp)) done (1); free (cp); } @@ -137,7 +131,7 @@ main (int argc, char **argv) adios (maildir, "unable to change directory to "); /* read folder and create message structure */ - if (!(mp = folder_read (folder))) + if (!(mp = folder_read (folder, 1))) adios (NULL, "unable to read folder %s", folder); /* check for empty folder */