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
|
00001 #include "types.h" 00002 #include "stat.h" 00003 #include "user.h" 00004 #include "fs.h" 00005 #include "./include/stdio.h" 00006 extern int i; 00007 int main(int argc,char *argv[]){ 00008 /* 00009 // printf(1,"value of a is %d\n",a); 00010 char *src = "dhanesh"; 00011 char *buf = (char *)malloc(sizeof(char) * 16); 00012 // sprintf(buf,"%d %s %x\n",(int)pow(3.4,1.8),"hi",0); 00013 // printf("%d",snprintf(buf,5,"%s","dhanesh arole")); 00014 // buf = memset((void *)buf,'\0',sizeof(char) * 10); 00015 // printf("%s\n",*buf); 00016 // printf("%d\n",strncmp("dhanesh","dhaRR",5)); 00017 printf("%s\n",(char *)memcpy(buf,src,8)); 00018 FILE *fp; 00019 struct stat fileinfo; 00020 int bytesread; 00021 stat(argv[1],&fileinfo); 00022 char *src = (char *)malloc(sizeof(char) *(fileinfo.size + 1)); 00023 fp = fopen(argv[1],"r"); 00024 bytesread = fread(src,1,fileinfo.st_size,fp); 00025 printf("%s\n",src); 00026 // printf("%d\n",fileinfo.st_size); 00027 printf("%d\n",bytesread); 00028 */ 00029 write(1,"hi\n",sizeof("hi\n")); 00030 exit(1); 00031 }