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-w32-bf66fbc8e2380717c1fab860cfc60c78582839dd.tar.gz
busybox-w32-bf66fbc8e2380717c1fab860cfc60c78582839dd.tar.bz2
busybox-w32-bf66fbc8e2380717c1fab860cfc60c78582839dd.zip
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 @@
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
12 12
13#include "busybox.h" 13#include "busybox.h"
14#include <unistd.h>
15 14
16int cat_main(int argc, char **argv) 15int bb_cat(char **argv)
17{ 16{
18 FILE *f; 17 FILE *f;
19 int retval = EXIT_SUCCESS; 18 int retval = EXIT_SUCCESS;
20 19
21 getopt32(argc, argv, "u");
22
23 argv += optind;
24 if (!*argv) {
25 *--argv = "-";
26 }
27
28 do { 20 do {
29 f = fopen_or_warn_stdin(*argv); 21 f = fopen_or_warn_stdin(*argv);
30 if (f) { 22 if (f) {
@@ -39,3 +31,15 @@ int cat_main(int argc, char **argv)
39 31
40 return retval; 32 return retval;
41} 33}
34
35int cat_main(int argc, char **argv)
36{
37 getopt32(argc, argv, "u");
38
39 argv += optind;
40 if (!*argv) {
41 *--argv = "-";
42 }
43
44 return bb_cat(argv);
45}