diff --git a/mycat.c b/mycat.c deleted file mode 100644 index 6a78e9d..0000000 --- a/mycat.c +++ /dev/null @@ -1,55 +0,0 @@ -#define __LIBRARY__ -#include -#include -#include -#include -#include -#include -#include -FILE __stdout; -#define O_RDONLY 00 -#define MSG_LEN 256 -#define MAX_NUMBER_BYTES 1024 -_syscall3(int,open,const char *,filename,int, flag,int, mode) -_syscall3(int,write,int ,fd,const char *, buf, off_t ,count) -_syscall3(int,read,int ,fildes,char *, buf, off_t ,count) -_syscall0(int,sync) -_syscall1(int,close,int,fildes) -_syscall3(int ,vsprintf1,char *, buf, const char *, fmt, va_list ,args) - -static char printbuf[1024]; -int printf(const char *fmt,...) -{ - write(2,fmt,strlen(fmt)); -} -int main(int argc, char **argv) -{ - int num, fd; - char msg[MSG_LEN+1]; - - if (argc == 1) - return EXIT_FAILURE; - - /* open the file */ - if ((fd=open(argv[1], O_RDONLY, 0)) < 0) - return EXIT_FAILURE; - do{ - /* read the file */ - if ((num = read(fd, msg, MSG_LEN)) < 0) { - close(fd); - return EXIT_FAILURE; - } else if (num == 0) { - break; - } - /* display on screen */ - msg[num] = '\0'; - printf( msg); - }while(1); - printf("\n"); - - /* exit */ - close(fd); - sync(); - - return EXIT_SUCCESS; -}