aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-06-12 08:13:34 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-06-12 08:13:34 +0000
commit16d58d75ee11f3b50550fbef7da12a4adbab66d4 (patch)
treea452b04f9486c41bea5180ff113c302e830c57f7
parentcc5e090f12fb4e3834fb1a55bc91d7618af8ce78 (diff)
downloadbusybox-w32-16d58d75ee11f3b50550fbef7da12a4adbab66d4.tar.gz
busybox-w32-16d58d75ee11f3b50550fbef7da12a4adbab66d4.tar.bz2
busybox-w32-16d58d75ee11f3b50550fbef7da12a4adbab66d4.zip
catv: was abusing xopen, should not die on err, but warn only.
-rw-r--r--coreutils/catv.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/coreutils/catv.c b/coreutils/catv.c
index cc61233e1..876b67a2a 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -23,14 +23,20 @@ int catv_main(int argc, char **argv)
23#define CATV_OPT_t (1<<1) 23#define CATV_OPT_t (1<<1)
24#define CATV_OPT_v (1<<2) 24#define CATV_OPT_v (1<<2)
25 flags ^= CATV_OPT_v; 25 flags ^= CATV_OPT_v;
26
27 argv += optind; 26 argv += optind;
27
28 /* Read from stdin if there's nothing else to do. */
29 fd = 0;
30 if (!argv[0])
31 goto jump_in;
28 do { 32 do {
29 /* Read from stdin if there's nothing else to do. */ 33 fd = open_or_warn(*argv, O_RDONLY);
30 fd = 0; 34 if (fd < 0) {
31 if (*argv && 0 > (fd = xopen(*argv, O_RDONLY)))
32 retval = EXIT_FAILURE; 35 retval = EXIT_FAILURE;
33 else for (;;) { 36 continue;
37 }
38 jump_in:
39 for (;;) {
34 int i, res; 40 int i, res;
35 41
36#define read_buf bb_common_bufsiz1 42#define read_buf bb_common_bufsiz1
@@ -46,10 +52,9 @@ int catv_main(int argc, char **argv)
46 if (c == 127) { 52 if (c == 127) {
47 printf("^?"); 53 printf("^?");
48 continue; 54 continue;
49 } else {
50 printf("M-");
51 c -= 128;
52 } 55 }
56 printf("M-");
57 c -= 128;
53 } 58 }
54 if (c < 32) { 59 if (c < 32) {
55 if (c == 10) { 60 if (c == 10) {