From 0e055dbfe12551d11b63e1d32a85d72c9b1bdcc6 Mon Sep 17 00:00:00 2001 From: qorg11 Date: Mon, 1 Jun 2020 21:25:45 +0200 Subject: [PATCH] Initial commit --- LICENSE | 12 ++++++++++++ src/cat.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 LICENSE create mode 100644 src/cat.c diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9f6f785 --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +VIRAL PUBLIC LICENSE +Copyleft (ɔ) All Rights Reversed + +This WORK is hereby relinquished of all associated ownership, attribution and copy +rights, and redistribution or use of any kind, with or without modification, is +permitted without restriction subject to the following conditions: + +1. Redistributions of this WORK, or ANY work that makes use of ANY of the + contents of this WORK by ANY kind of copying, dependency, linkage, or ANY + other possible form of DERIVATION or COMBINATION, must retain the ENTIRETY + of this license. +2. No further restrictions of ANY kind may be applied. diff --git a/src/cat.c b/src/cat.c new file mode 100644 index 0000000..52b2ea0 --- /dev/null +++ b/src/cat.c @@ -0,0 +1,48 @@ +#include +#include +#include + +int +cat(int fd, char *string) +{ + char buf[256]; + long lines; + + while((lines=read(fd, buf, (long)sizeof(buf)))>0) + { + if(write(1,buf,lines)!=lines) + { + fprintf(stderr,"Error copying. %s",string); + return 1; + } + if (lines < 0) + { + fprintf(stderr,"Error reading %s",string); + return 1; + } + } + return 0; +} + +int +main(int argc, char *argv[]) +{ + int fd, i; + + if(argc == 1) + { + cat(0,""); + } + else for(i=1;i