Xv6 with picoc & Linkage editor  v1.0
The project delineate mutual cohesion between c library, linkage editor ( linker), interpreter and operating system by porting the same on xv6 kernel
a.c
00001 #include "types.h"
00002 #include "stat.h"
00003 #include "user.h"
00004 
00005 char buf[512];
00006 
00007 void
00008 cat(int fd)
00009 {
00010   int n;
00011 
00012   while((n = read(fd, buf, sizeof(buf))) > 0)
00013     write(1, buf, n);
00014   if(n < 0){
00015     printf("cat: read error\n");
00016     exit(1);
00017   }
00018 }
00019 
00020 int
00021 main(int argc, char *argv[])
00022 {
00023   int fd, i;
00024 
00025   if(argc <= 1){
00026     cat(0);
00027     exit(1);
00028   }
00029 
00030   for(i = 1; i < argc; i++){
00031     if((fd = open(argv[i], 0)) < 0){
00032       printf("cat: cannot open %s\n", argv[i]);
00033       exit(1);
00034     }
00035     cat(fd);
00036     close(fd);
00037   }
00038   exit(1);
00039 }
 All Data Structures