comparison src/testFS.c @ 52:2de1c2597a60

Modified getFSize so it now returns a value indicating success/failure Also modified the lookup function so it does not load the file into the cache
author Jonathan Pevarnek <pevarnj@gmail.com>
date Sat, 09 Apr 2011 01:28:06 -0400
parents eda059d74100
children 39fcefab46ed
comparison
equal deleted inserted replaced
51:eda059d74100 52:2de1c2597a60
17 malloc_init(__memsize - HEAP_START); 17 malloc_init(__memsize - HEAP_START);
18 char buffer[256]; 18 char buffer[256];
19 if(fsInit(0x100)) goto END; 19 if(fsInit(0x100)) goto END;
20 20
21 while(1) { 21 while(1) {
22
23 //Prints off the name of each file 22 //Prints off the name of each file
24 listFiles(); 23 listFiles();
25 char fname[28]; 24 char fname[28];
26 sPrint("Please enter the file to read: "); 25 sPrint("Please enter the file to read: ");
27 getFname(fname); 26 getFname(fname);
28 u32 fid = lookupFile(fname); 27 u32 fid = lookupFile(fname);
29 if(!fid) continue; //if fid is 0, the file was not found 28 if(!fid) continue; //if fid is 0, the file was not found
30 29 u32 fileSize;
31 u32 fileSize = getFSize(fid); 30 if(getFSize(fid, &fileSize)) continue;
32 char *text = malloc(fileSize); 31 char *text = malloc(fileSize);
33 text = text; 32 if(getFData(fid, text)) continue;
34 getFData(fid, text);
35 dumpText(text, fileSize); 33 dumpText(text, fileSize);
36 free(text); 34 free(text);
37 } 35 }
38 36
39 END: 37 END: