- sprintf(name, "%0*d", nr_prec, ++nr);
- switch (split_one(mbox, name)) {
- case 0:
- break;
- case 1:
- printf("%d\n", nr);
- return 0;
- default:
- exit(1);
+ if ( !f )
+ die ("cannot open mbox %s", file);
+
+ if (fgets(buf, sizeof(buf), f) == NULL)
+ die("cannot read mbox %s", file);
+
+ while (!file_done) {
+ sprintf(name, "%s/%0*d", dir, nr_prec, ++nr);
+ file_done = split_one(f, name, allow_bare);