diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-12 08:13:34 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-12 08:13:34 +0000 |
commit | 16d58d75ee11f3b50550fbef7da12a4adbab66d4 (patch) | |
tree | a452b04f9486c41bea5180ff113c302e830c57f7 /coreutils | |
parent | cc5e090f12fb4e3834fb1a55bc91d7618af8ce78 (diff) | |
download | busybox-16d58d75ee11f3b50550fbef7da12a4adbab66d4.tar.gz |
catv: was abusing xopen, should not die on err, but warn only.
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/catv.c | 21 |
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) #define CATV_OPT_t (1<<1) #define CATV_OPT_v (1<<2) flags ^= CATV_OPT_v; - argv += optind; + + /* Read from stdin if there's nothing else to do. */ + fd = 0; + if (!argv[0]) + goto jump_in; do { - /* Read from stdin if there's nothing else to do. */ - fd = 0; - if (*argv && 0 > (fd = xopen(*argv, O_RDONLY))) + fd = open_or_warn(*argv, O_RDONLY); + if (fd < 0) { retval = EXIT_FAILURE; - else for (;;) { + continue; + } + jump_in: + for (;;) { int i, res; #define read_buf bb_common_bufsiz1 @@ -46,10 +52,9 @@ int catv_main(int argc, char **argv) if (c == 127) { printf("^?"); continue; - } else { - printf("M-"); - c -= 128; } + printf("M-"); + c -= 128; } if (c < 32) { if (c == 10) { |