aboutsummaryrefslogtreecommitdiff
path: root/coreutils/cat.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-21 13:23:14 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-21 13:23:14 +0000
commitbf66fbc8e2380717c1fab860cfc60c78582839dd (patch)
tree3ab3dd4df901851ff7f4345708592118766ba4aa /coreutils/cat.c
parent6910741067913d131d931b1e6424d3b8ed43e64f (diff)
downloadbusybox-bf66fbc8e2380717c1fab860cfc60c78582839dd.tar.gz
introduce LONE_CHAR (optimized strcmp with one-char string)
Diffstat (limited to 'coreutils/cat.c')
-rw-r--r--coreutils/cat.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c
index a95980552..db4d33dc5 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -11,20 +11,12 @@
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
#include "busybox.h"
-#include <unistd.h>
-int cat_main(int argc, char **argv)
+int bb_cat(char **argv)
{
FILE *f;
int retval = EXIT_SUCCESS;
- getopt32(argc, argv, "u");
-
- argv += optind;
- if (!*argv) {
- *--argv = "-";
- }
-
do {
f = fopen_or_warn_stdin(*argv);
if (f) {
@@ -39,3 +31,15 @@ int cat_main(int argc, char **argv)
return retval;
}
+
+int cat_main(int argc, char **argv)
+{
+ getopt32(argc, argv, "u");
+
+ argv += optind;
+ if (!*argv) {
+ *--argv = "-";
+ }
+
+ return bb_cat(argv);
+}