source.c

Go to the documentation of this file.
00001 /*
00002  * put filename  addr 
00003  */
00004 
00005 int cmd_source(int argc,char **argv)
00006 {
00007         unsigned long download_addr;
00008         struct stat statbuf;
00009         char *buf;
00010         int fd;
00011         if(stat(argv[1],&statbuf)!=0)
00012         {
00013                 printf("error read file %s\n",argv[1]);
00014                 exit(-1);
00015         }
00016 printf("open file %s,size %d\n",argv[1],statbuf.st_size);
00017 buf=malloc(statbuf.st_size);
00018 if(!buf)printf("error allocate memory\n");
00019 fd=open(argv[1],O_RDONLY);
00020 read(fd,(buf),statbuf.st_size);
00021 close(fd);
00022 _do_cmd(buf,0);
00023 free(buf);
00024 
00025     return 0;
00026 }
00027 
00028 mycmd_init(source,cmd_source,"source","source filename");

Generated on Fri Nov 5 07:24:46 2010 for ejtag debug tools for loongson 232 cpu by  doxygen 1.5.6