aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cat/cat.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-04-22 08:55:35 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-04-22 08:55:35 -0700
commit5d3642b8ef920316693031d2ea34b9def0b1abc5 (patch)
tree8100890ed5b2e4ecdbde09615e0820346ccc3f41 /sys/cmd/cat/cat.c
parente30f8b22069bec1a3fb68f089a9a7198671eb09a (diff)
chore: rm unfinished projects
Diffstat (limited to 'sys/cmd/cat/cat.c')
-rw-r--r--sys/cmd/cat/cat.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/sys/cmd/cat/cat.c b/sys/cmd/cat/cat.c
deleted file mode 100644
index a82cfe4..0000000
--- a/sys/cmd/cat/cat.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <u.h>
-#include <libn.h>
-
-static
-void
-cat(Stream *f, byte *name)
-{
- long n;
- static byte buf[8192];
-
- while(n = io·read(f, 1, arrlen(buf), buf), n > 0) {
- if (io·write(stdout, 1, n, buf) != n) {
- panicf("failed to write while copying stream '%s'", name);
- }
- }
-
- if (n < 0) {
- panicf("failed to read from buffer '%s'", name);
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- int i;
- Stream *f;
-
- if (argc == 1) {
- f = stdin;
- cat(f, "<stdin>");
- } else for (i = 1; i < argc; i++) {
- if (f = io·open(argv[i], "r"), f == nil)
- panicf("can't open %s", argv[i]);
- cat(f, argv[i]);
- io·close(f);
- }
-
- exit(0);
-}