aboutsummaryrefslogtreecommitdiff
path: root/coreutils/cat.c
diff options
context:
space:
mode:
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}