Add errno.h
[oweals/busybox.git] / cat.c
diff --git a/cat.c b/cat.c
index 6a9204fe7bfe93bbfa7c898eaba3453a616a182f..151ce4e61fa79ede7c05582e1262628a192f8d4d 100644 (file)
--- a/cat.c
+++ b/cat.c
  *
  */
 
-#include "internal.h"
+#include "busybox.h"
 #include <stdio.h>
 
 extern int cat_main(int argc, char **argv)
 {
+       int status = EXIT_SUCCESS;
+
        if (argc == 1) {
                print_file(stdin);
-               exit(TRUE);
+               return status;
        }
 
-       if (**(argv + 1) == '-')
-               usage(cat_usage);
-
        while (--argc > 0) {
-               if (print_file_by_name(*++argv) == FALSE) {
-                       perror(*argv);
-                       exit(FALSE);
+               if(!(strcmp(*++argv, "-"))) {
+                       print_file(stdin);
+               } else if (print_file_by_name(*argv) == FALSE) {
+                       status = EXIT_FAILURE;
                }
        }
-       return(TRUE);
+       return status;
 }
 
 /*