k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit c03734190924b744f7b615121c97e349dbbd70f8
parent c904af6c61abe43298c9cbc71af38d0b904c1135
Author: qorg11 <qorg@vxempire.xyz>
Date:   Wed, 17 Jun 2020 04:19:06 +0200

Cat prints binary data now

Diffstat:
Msrc/cat.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cat.c b/src/cat.c @@ -6,7 +6,7 @@ int cat(int fd,const char *filename) { - char c; + int c; char buf[8192]; if(fd != 0) fd = open(filename, O_RDONLY); @@ -15,8 +15,8 @@ cat(int fd,const char *filename) fprintf(stderr,"Error opening file\n"); return 1; } - while((c = read(fd,buf,sizeof(buf)) > 0)) - printf("%s",buf); + while((c = read(fd,buf,sizeof(buf))) > 0) + write(1,buf,c); return 0; } int