Mercurial > sos > sos
view src/testFS.c @ 51:eda059d74100
Started to librarize (is that a word) the filesystem
author | Jonathan Pevarnek <pevarnj@gmail.com> |
---|---|
date | Fri, 08 Apr 2011 13:41:58 -0400 |
parents | a6be89bc4b04 |
children | 2de1c2597a60 |
line wrap: on
line source
#include <std.h> #include <fs.h> void dumpText(char *text, int size) { do { putline(text, (size > CON_LEN)?CON_LEN:size); size -= CON_LEN; text += CON_LEN; } while(size > 0); } void start(u64 __memsize) { init_io_int(); init_console(); malloc_init(__memsize - HEAP_START); char buffer[256]; if(fsInit(0x100)) goto END; while(1) { //Prints off the name of each file listFiles(); char fname[28]; sPrint("Please enter the file to read: "); getFname(fname); u32 fid = lookupFile(fname); if(!fid) continue; //if fid is 0, the file was not found u32 fileSize = getFSize(fid); char *text = malloc(fileSize); text = text; getFData(fid, text); dumpText(text, fileSize); free(text); } END: sPrint("DONE\n"); for(;;) { sGet(buffer, 0); } }