//! read command void cmd_read() { //! get pathname char path[32]; DebugPrintf("\n\rex: \"file.txt\", \"a:\\file.txt\", \"a:\\folder\\file.txt\"\n\rFilename> "); console.GetCommand(path, 30); //! open file FILE file = volOpenFile(path); //! test for invalid file if (file.flags == FS_INVALID) { DebugPrintf("\n\rUnable to open file"); return; } //! cant display directories if ((file.flags & FS_DIRECTORY) == FS_DIRECTORY) { DebugPrintf("\n\rUnable to display contents of directory."); return; } //! top line DebugPrintf("\n\n\r-------[%s]-------\n\r", file.name); //! display file contents while (file.eof != 1) { //! read cluster unsigned char buf[512]; volReadFile(&file, buf, 512); //! display file for (int i = 0; i<512; i++) DebugPutc(buf[i]); //! wait for input to continue if not EOF if (file.eof != 1) { DebugPrintf("\n\r------[Press a key to continue]------"); console.GetChar(); DebugPrintf("\r"); //clear last line } } //! done :) DebugPrintf("\n\n\r--------[EOF]--------"); }
// proc (process) command void cmd_proc() { int ret = 0; char name[32]; DebugPrintf("\n\rProgram file: "); console.GetCommand(name, 30); Process* pProcess = ProcessManager::GetInstance()->CreateProcess(name, PROCESS_USER); if (pProcess == 0) { DebugPrintf("\n\rError creating process"); } else ProcessManager::GetInstance()->ExecuteProcess(pProcess); }