[git commit master] split: handle - as "use stdin". +13 bytes. Closes bug 741.
Denys Vlasenko
vda.linux at googlemail.com
Thu Nov 26 04:43:16 UTC 2009
commit: http://git.busybox.net/busybox/commit/?id=5b6fe34cee9ccb70e813a1c3844c8d35fb708cbe
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
coreutils/cksum.c | 4 ++--
coreutils/split.c | 6 +++++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 3a77c75..8e65b1c 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -4,8 +4,8 @@
*
* Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms
*
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */
-
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
#include "libbb.h"
int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/coreutils/split.c b/coreutils/split.c
index 2191f30..c2f3885 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -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;
}
--
1.6.3.3
More information about the busybox-cvs
mailing list