Subversion Repositories shark

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 *
 *
 *
 */


#include <ll/i386/cons.h>
#include <drivers/keyb.h>

#include <stdio.h>
#include <string.h>

int main(int argc,char *argv[])
{
  char buffer[256];
  FILE *fin;
  int res;
  int c;

  /*
  temp_device=bdev_scan_devices(choose_temp_callback);
  if (temp_device<0) {
    cprintf("can't find a filesystem to mount on /TEMP!!!\n");
    return -1;
  }
 
  res=mount(temp_device,FS_MSDOS,"/TEMP",NULL);
  if (res!=0) {
    cprintf("can't mount XXX on /TEMP (errno: %i)\n",errno);
    sys_end();
    return -1;
  }
  */

 
  /*
   *
   */


  fin=NULL;
 
  cprintf("opening...\n");
  fin=fopen("/TEMP/ALFA1.TXT","r");
  cprintf("opened!\n");

  cprintf("res=%p\n",fin);

  if (fin!=NULL) {
   
    while (!feof(fin)) {

      memset(buffer,'@',sizeof(buffer));
     
      cprintf("reading...\n");
      res=fread(buffer,1,sizeof(buffer)-1,fin);
      cprintf("read!\n");

      cprintf("res=%i\n",res);
      buffer[res<sizeof(buffer)-1?res:sizeof(buffer)-1]='\0';
      cprintf("'%s'\n",buffer);
             
    }
   
    cprintf("closing...\n");
    fclose(fin);
    cprintf("closed!\n");
  }
 
  cprintf("[press 'x' to exit]\n");
  while ((c = keyb_getch(BLOCK)) != 'x') ;

  return 0;
}