summaryrefslogtreecommitdiff
path: root/libbb/print_file.c
diff options
context:
space:
mode:
authorEric Andersen2001-05-15 17:48:09 +0000
committerEric Andersen2001-05-15 17:48:09 +0000
commit55f9872616f0c42f3fb712cfb7f9d0bb52c8afcb (patch)
tree4dc106a5142e993d2a5e9bad32f2fcd53555047c /libbb/print_file.c
parentc911a4389bbaa5ac85d725c8c05e452dfba8583d (diff)
downloadbusybox-55f9872616f0c42f3fb712cfb7f9d0bb52c8afcb.zip
busybox-55f9872616f0c42f3fb712cfb7f9d0bb52c8afcb.tar.gz
This patch from Adam Heath <doogie@debian.org>, makes print_file
(used by cat, grep, sed, etc) quite a bit faster.
Diffstat (limited to 'libbb/print_file.c')
-rw-r--r--libbb/print_file.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libbb/print_file.c b/libbb/print_file.c
index b477234..bfedc5e 100644
--- a/libbb/print_file.c
+++ b/libbb/print_file.c
@@ -26,12 +26,9 @@
extern void print_file(FILE *file)
{
- int c;
-
- while ((c = getc(file)) != EOF)
- putc(c, stdout);
- fclose(file);
fflush(stdout);
+ copyfd(fileno(file), fileno(stdout));
+ fclose(file);
}
extern int print_file_by_name(char *filename)