split: handle - as "use stdin". +13 bytes. Closes bug 741.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-11-26 05:43:16 +01:00
parent fa1e7177fb
commit 5b6fe34cee
2 changed files with 7 additions and 3 deletions

View File

@ -79,9 +79,13 @@ int split_main(int argc UNUSED_PARAM, char **argv)
argv += optind;
if (argv[0]) {
int fd;
if (argv[1])
sfx = argv[1];
xmove_fd(xopen(argv[0], O_RDONLY), 0);
fd = open_or_warn_stdin(argv[0]);
if (fd == -1)
return EXIT_FAILURE;
xmove_fd(fd, STDIN_FILENO);
} else {
argv[0] = (char *) bb_msg_standard_input;
}