diff options
author | proski <proski@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-07-17 20:18:42 +0000 |
---|---|---|
committer | proski <proski@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-07-17 20:18:42 +0000 |
commit | 9602aae15181429b0b99af5561c731932b6e57ed (patch) | |
tree | 98490b8eadc4e44b46c073fa2d21de403a2b61d4 /cat.c | |
parent | c56c347d6d5e93e518d5f72fa7310d9e4279dcfb (diff) | |
download | busybox-w32-9602aae15181429b0b99af5561c731932b6e57ed.tar.gz busybox-w32-9602aae15181429b0b99af5561c731932b6e57ed.tar.bz2 busybox-w32-9602aae15181429b0b99af5561c731932b6e57ed.zip |
Moved functions used by "lsmod" from cat.c to utility.c
Adjusted to make lsmod and sh compilable as standalone apps.
Comment fixes
git-svn-id: svn://busybox.net/trunk/busybox@870 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'cat.c')
-rw-r--r-- | cat.c | 16 |
1 files changed, 1 insertions, 15 deletions
@@ -24,20 +24,8 @@ | |||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | 26 | ||
27 | static 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 | |||
37 | extern int cat_main(int argc, char **argv) | 27 | extern 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 | } |