aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-09-27 03:01:40 +0000
committerMatt Kraai <kraai@debian.org>2000-09-27 03:01:40 +0000
commite7c1af1e0dc1440483d7f195f15eb0df5cf70a04 (patch)
tree181768dee00666d560354b921d72a0f2217cb179
parentbbaef66b3f99213f06adf04df6b3e5e61278d75b (diff)
downloadbusybox-w32-e7c1af1e0dc1440483d7f195f15eb0df5cf70a04.tar.gz
busybox-w32-e7c1af1e0dc1440483d7f195f15eb0df5cf70a04.tar.bz2
busybox-w32-e7c1af1e0dc1440483d7f195f15eb0df5cf70a04.zip
Continue concatenating files even if we can't open one.
-rw-r--r--cat.c9
-rw-r--r--coreutils/cat.c9
-rw-r--r--utility.c3
3 files changed, 12 insertions, 9 deletions
diff --git a/cat.c b/cat.c
index 51f1d27a6..151ce4e61 100644
--- a/cat.c
+++ b/cat.c
@@ -26,20 +26,21 @@
26 26
27extern int cat_main(int argc, char **argv) 27extern int cat_main(int argc, char **argv)
28{ 28{
29 int status = EXIT_SUCCESS;
30
29 if (argc == 1) { 31 if (argc == 1) {
30 print_file(stdin); 32 print_file(stdin);
31 exit(TRUE); 33 return status;
32 } 34 }
33 35
34 while (--argc > 0) { 36 while (--argc > 0) {
35 if(!(strcmp(*++argv, "-"))) { 37 if(!(strcmp(*++argv, "-"))) {
36 print_file(stdin); 38 print_file(stdin);
37 } else if (print_file_by_name(*argv) == FALSE) { 39 } else if (print_file_by_name(*argv) == FALSE) {
38 perror(*argv); 40 status = EXIT_FAILURE;
39 exit(FALSE);
40 } 41 }
41 } 42 }
42 return(TRUE); 43 return status;
43} 44}
44 45
45/* 46/*
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 51f1d27a6..151ce4e61 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -26,20 +26,21 @@
26 26
27extern int cat_main(int argc, char **argv) 27extern int cat_main(int argc, char **argv)
28{ 28{
29 int status = EXIT_SUCCESS;
30
29 if (argc == 1) { 31 if (argc == 1) {
30 print_file(stdin); 32 print_file(stdin);
31 exit(TRUE); 33 return status;
32 } 34 }
33 35
34 while (--argc > 0) { 36 while (--argc > 0) {
35 if(!(strcmp(*++argv, "-"))) { 37 if(!(strcmp(*++argv, "-"))) {
36 print_file(stdin); 38 print_file(stdin);
37 } else if (print_file_by_name(*argv) == FALSE) { 39 } else if (print_file_by_name(*argv) == FALSE) {
38 perror(*argv); 40 status = EXIT_FAILURE;
39 exit(FALSE);
40 } 41 }
41 } 42 }
42 return(TRUE); 43 return status;
43} 44}
44 45
45/* 46/*
diff --git a/utility.c b/utility.c
index ae69baf4b..df2515c2b 100644
--- a/utility.c
+++ b/utility.c
@@ -1636,12 +1636,13 @@ extern int print_file_by_name(char *filename)
1636 FILE *file; 1636 FILE *file;
1637 file = fopen(filename, "r"); 1637 file = fopen(filename, "r");
1638 if (file == NULL) { 1638 if (file == NULL) {
1639 errorMsg("%s: %s\n", filename, strerror(errno));
1639 return FALSE; 1640 return FALSE;
1640 } 1641 }
1641 print_file(file); 1642 print_file(file);
1642 return TRUE; 1643 return TRUE;
1643} 1644}
1644#endif /* BB_CAT || BB_LSMOD */ 1645#endif /* BB_CAT */
1645 1646
1646#if defined BB_ECHO || defined BB_TR 1647#if defined BB_ECHO || defined BB_TR
1647char process_escape_sequence(char **ptr) 1648char process_escape_sequence(char **ptr)