From e865e81d34efb96417c549e9c326fb1c46dafbc7 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 21 Dec 2006 13:24:58 +0000 Subject: less: stop dying on bad regexps, quietly pipe data w/o user interaction if stdout is not a tty. size optimizations --- coreutils/cat.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'coreutils/cat.c') diff --git a/coreutils/cat.c b/coreutils/cat.c index db4d33dc5..d828b86ec 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c @@ -14,9 +14,12 @@ int bb_cat(char **argv) { + static char *const argv_dash[] = { "-", NULL }; FILE *f; int retval = EXIT_SUCCESS; + if (!*argv) argv = (char**) &argv_dash; + do { f = fopen_or_warn_stdin(*argv); if (f) { @@ -35,11 +38,6 @@ int bb_cat(char **argv) int cat_main(int argc, char **argv) { getopt32(argc, argv, "u"); - argv += optind; - if (!*argv) { - *--argv = "-"; - } - return bb_cat(argv); } -- cgit v1.2.3