@matheusbsbs / matheus-bagliano / commits / 6f2eacfeb2
Fork 0

mailsplit: allow empty input from stdin

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jan 7, 2006 at 21:26 UTC 6f2eacfeb2c67a7e05f98df2288d7893d3368c8e
1 file changed +4 -1
mailsplit.c
+4 -1
@@ -169,8 +169,11 @@ int main(int argc, const char **argv)
169 if ( !f )
170 die ("cannot open mbox %s", file);
171
172 - if (fgets(buf, sizeof(buf), f) == NULL)
172 + if (fgets(buf, sizeof(buf), f) == NULL) {
173 + if (f == stdin)
174 + break; /* empty stdin is OK */
175 die("cannot read mbox %s", file);
176 + }
177
178 while (!file_done) {
179 sprintf(name, "%s/%0*d", dir, nr_prec, ++nr);