diff options
Diffstat (limited to 'tests/langbench/cat.l')
-rw-r--r-- | tests/langbench/cat.l | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/langbench/cat.l b/tests/langbench/cat.l new file mode 100644 index 0000000..ca6ca1c --- /dev/null +++ b/tests/langbench/cat.l @@ -0,0 +1,18 @@ +void +main(int ac, string av[]) +{ + string buf; + FILE f; + int i; + + fconfigure("stdout", buffering:"full", translation:"binary"); + for (i = 1; i < ac; ++i) { + unless (f = open(av[i], "rb")) continue; + while (gets(f, &buf) >= 0) { + // roughly 40% slower than puts + // printf("%s\n", buf); + puts(buf); + } + close(f); + } +} |