X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fwhom.c;h=ef0b684d2a011817a34dd01cc7c86ba3b26190a6;hp=64ec7c973e0a3659a69618e588bd3274b5086eb4;hb=431604647f89d5aac7b199a7883e98e56e4ccf9e;hpb=6e4f8128fe078a3e54f5c92d27c31acc7b8f9fd8 diff --git a/uip/whom.c b/uip/whom.c index 64ec7c9..ef0b684 100644 --- a/uip/whom.c +++ b/uip/whom.c @@ -76,11 +76,15 @@ static void printone(struct mailname *); int main(int argc, char **argv) { - int filep=0, naddrs=0, n; + int naddrs=0, n; char *cp; char buf[BUFSIZ], **argp; - char **arguments, *files[NFILES]; + char **arguments; + char *folder = NULL; FILE *in; + struct msgs_array msgs = {0}; + struct msgs_array files = {0}; + size_t filep; setlocale(LC_ALL, ""); invo_name = mhbasename(argv[0]); @@ -140,22 +144,27 @@ main(int argc, char **argv) continue; } } - if (filep > NFILES) { - adios(EX_USAGE, NULL, "too many files (more than %d)", - NFILES); + if (*cp == '+' || *cp == '@') { + if (folder) { + adios(EX_USAGE, NULL, "only one folder at a time!"); + } else { + folder = mh_xstrdup(expandfol(cp)); + } } else { - files[filep++] = cp; + app_msgarg(&msgs, cp); } } - files[filep] = NULL; - if (!filep) { + if (!msgs.size) { adios(EX_USAGE, NULL, "usage: %s [switches] file ...", invo_name); } if (!toccsw && !dccsw && !bccsw) { adios(EX_USAGE, NULL, "use at least one of: -tocc -dcc -bcc"); } - for (filep=0; files[filep]; filep++) { - process(files[filep]); + if (parse_msgs(&msgs, folder, &files) < 0) { + exit(EX_IOERR); + } + for (filep = 0; filep < files.size; filep++) { + process(files.msgs[filep]); } cmd = add("ali -list", NULL);