Subversion Repositories shark

Rev

Rev 1655 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1655 giacomo 1
/*
2
 *
3
 *
4
 *
5
 */
6
 
7
#include <string.h>
8
#include "common.c"
9
 
10
int main(int argc,char *argv[])
11
{
12
  int res;
13
  int c;
14
  int h;
15
 
16
  temp_device=bdev_scan_devices(choose_temp_callback);
17
  if (temp_device<0) {
18
    cprintf("can't find a filesystem to mount on /TEMP!!!\n");
19
    return -1;
20
  }
21
 
22
  /* mounting 2nd msdos partition on /TEMP */
23
  res=mount(temp_device,FS_MSDOS,"/TEMP",NULL);
24
  if (res!=0) {
25
    cprintf("can't mount XXX on /TEMP\n");
26
    cprintf("errno: %i '%s'\n",errno,strerror(errno));
27
    //sys_end();
28
    return -1;
29
  }
30
 
31
  /*
32
   *
33
   */
34
 
35
  cprintf("OPENING %s\n",FILENAME);  
36
  h=open(FILENAME,O_RDONLY);
37
  if (h>=0) {
38
    char buffer[128];
39
    int len;
40
    cprintf("OPENED!\n");
41
    cprintf("READING...\n");
42
    len=read(h,buffer,sizeof(buffer));
43
    cprintf("READ %i bytes\n",len);
44
    memset(buffer,'\0',sizeof(buffer));
45
    cprintf("buffer='%s'\n",buffer);
46
  } else
47
    cprintf("FAILED!\n");
48
 
49
  cprintf("Press [x] to exit\n");
50
 
51
  while ((c = keyb_getchar()) != 'x');
52
 
53
  bdev_dump_status();
54
 
55
  sys_end();
56
  return 0;
57
}