summaryrefslogtreecommitdiff
path: root/coreutils/cat.c
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2000-07-17 20:18:42 +0000
committerPavel Roskin <proski@gnu.org>2000-07-17 20:18:42 +0000
commitcc8a66b113dbdf04082b6f7c9b0b58984d433028 (patch)
tree98490b8eadc4e44b46c073fa2d21de403a2b61d4 /coreutils/cat.c
parent97562bd9d7fe18bdc4f63e6e80bdce980416a915 (diff)
downloadbusybox-w32-cc8a66b113dbdf04082b6f7c9b0b58984d433028.tar.gz
busybox-w32-cc8a66b113dbdf04082b6f7c9b0b58984d433028.tar.bz2
busybox-w32-cc8a66b113dbdf04082b6f7c9b0b58984d433028.zip
Moved functions used by "lsmod" from cat.c to utility.c
Adjusted to make lsmod and sh compilable as standalone apps. Comment fixes
Diffstat (limited to 'coreutils/cat.c')
-rw-r--r--coreutils/cat.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c
index c27f07e82..6a9204fe7 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -24,20 +24,8 @@
24#include "internal.h" 24#include "internal.h"
25#include <stdio.h> 25#include <stdio.h>
26 26
27static void print_file(FILE * file)
28{
29 int c;
30
31 while ((c = getc(file)) != EOF)
32 putc(c, stdout);
33 fclose(file);
34 fflush(stdout);
35}
36
37extern int cat_main(int argc, char **argv) 27extern int cat_main(int argc, char **argv)
38{ 28{
39 FILE *file;
40
41 if (argc == 1) { 29 if (argc == 1) {
42 print_file(stdin); 30 print_file(stdin);
43 exit(TRUE); 31 exit(TRUE);
@@ -47,12 +35,10 @@ extern int cat_main(int argc, char **argv)
47 usage(cat_usage); 35 usage(cat_usage);
48 36
49 while (--argc > 0) { 37 while (--argc > 0) {
50 file = fopen(*++argv, "r"); 38 if (print_file_by_name(*++argv) == FALSE) {
51 if (file == NULL) {
52 perror(*argv); 39 perror(*argv);
53 exit(FALSE); 40 exit(FALSE);
54 } 41 }
55 print_file(file);
56 } 42 }
57 return(TRUE); 43 return(TRUE);
58} 44}