Subversion Repositories shark

Rev

Rev 1655 | 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;
  char *s;
  //  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;
  }
  */

 
  /*
   *
   */


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

    while (!feof(fin)) {
      cprintf("getting line...\n");
      s=fgets(buffer,sizeof(buffer),fin);
      cprintf("got!\n");
      if (s==NULL) {
        if (ferror(fin))
          cprintf("error while using fgets()!\n");     
        break;
      }
      cprintf("'%s'\n",buffer);
    }
   
    cprintf("closing...\n");
    fclose(fin);
    cprintf("closed!\n");
  }
 
  cprintf("[press 'x' to exit]\n");
  while ((c = keyb_getchar()) != 'x') ;

  return 0;
}