00001 #ifdef TEST
00002
00003 #include "headers.h"
00004
00005
00006 FileHandleCommandProcessor::FileHandleCommandProcessor() {
00007 m_input = stdin;
00008 m_output = stdout;
00009 m_prompt = PROMPT;
00010 }
00011
00012
00013 void
00014 FileHandleCommandProcessor::init() {
00015 fprintf(m_output, "Peekabooty (Version %s)\n", PEEK_A_BOOTY_VERSION);
00016 }
00017
00018
00019 void
00020 FileHandleCommandProcessor::readCommand(string* input) {
00021 fprintf(m_output, "\n");
00022 fprintf(m_output, m_prompt.c_str());
00023 fflush(m_output);
00024
00025 const int bufsize = 4096;
00026 char buffer[bufsize];
00027
00028 if (fgets(buffer, bufsize, m_input) == NULL) {
00029 *input = "";
00030 return;
00031 }
00032
00033 *input = buffer;
00034 }
00035
00036
00037 void
00038 FileHandleCommandProcessor::displayResponse(string* output) {
00039 fprintf(m_output, output->c_str());
00040 }
00041
00042 #endif
00043