{ NULL, 0 }
};
+char *version=VERSION;
#define NFILES 32
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]);
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);
for (compnum=1, state=FLD2;; compnum++) {
switch (state = m_getfld2(state, &f, in)) {
case LENERR2:
- advise(NULL, "field %d contains a to long line", f.name);
state = FLD2;
/* FALL */
case FLD2:
break;
case FMTERR2:
+ advise(NULL, "message format error in component #%d", compnum);
+ continue;
+
case IOERR2:
adios(EX_DATAERR, NULL, "message format error in component #%d",
compnum);