summaryrefslogtreecommitdiff
path: root/coreutils/cat.c
diff options
context:
space:
mode:
authorErik Andersen2000-02-08 19:58:47 +0000
committerErik Andersen2000-02-08 19:58:47 +0000
commite49d5ecbbe51718fa925b6890a735e5937cc2aa2 (patch)
treec90bda10731ad9333ce3b404f993354c9fc104b8 /coreutils/cat.c
parentc0bf817bbc5c7867fbe8fb76d5c39f8ee802692f (diff)
downloadbusybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.zip
busybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.tar.gz
Some formatting updates (ran the code through indent)
-Erik
Diffstat (limited to 'coreutils/cat.c')
-rw-r--r--coreutils/cat.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 0d32efe..86f85fe 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/*
* Mini Cat implementation for busybox
*
@@ -24,36 +25,37 @@
#include <stdio.h>
-static void print_file( FILE *file)
+static void print_file(FILE * file)
{
- int c;
- while ((c = getc(file)) != EOF)
- putc(c, stdout);
- fclose(file);
- fflush(stdout);
+ int c;
+
+ while ((c = getc(file)) != EOF)
+ putc(c, stdout);
+ fclose(file);
+ fflush(stdout);
}
extern int cat_main(int argc, char **argv)
{
- FILE *file;
-
- if (argc==1) {
- print_file( stdin);
- exit( TRUE);
- }
-
- if ( **(argv+1) == '-' ) {
- usage ("cat [file ...]\n");
- }
- argc--;
-
- while (argc-- > 0 && *(argv++) != '\0' && strlen(*argv) ) {
- file = fopen(*argv, "r");
- if (file == NULL) {
- perror(*argv);
- exit(FALSE);
+ FILE *file;
+
+ if (argc == 1) {
+ print_file(stdin);
+ exit(TRUE);
+ }
+
+ if (**(argv + 1) == '-') {
+ usage("cat [file ...]\n");
+ }
+ argc--;
+
+ while (argc-- > 0 && *(argv++) != '\0' && strlen(*argv)) {
+ file = fopen(*argv, "r");
+ if (file == NULL) {
+ perror(*argv);
+ exit(FALSE);
+ }
+ print_file(file);
}
- print_file( file);
- }
- exit(TRUE);
+ exit(TRUE);
}