diff options
author | bloodstalker <thabogre@gmail.com> | 2017-05-20 17:02:46 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2017-05-20 17:02:46 +0000 |
commit | 29658f6b828f996ae963d31c8d1f90dac78ef31e (patch) | |
tree | f38d364e3c8d1c79ad9c4f54bd7a64a7f93396bb /bruiser | |
parent | added the mutagen option to action1 (diff) | |
download | mutator-29658f6b828f996ae963d31c8d1f90dac78ef31e.tar.gz mutator-29658f6b828f996ae963d31c8d1f90dac78ef31e.zip |
nothing much
Diffstat (limited to 'bruiser')
-rw-r--r-- | bruiser/bruiser.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp index c3731ff..ed884c8 100644 --- a/bruiser/bruiser.cpp +++ b/bruiser/bruiser.cpp @@ -943,27 +943,33 @@ int main(int argc, const char **argv) if (command[0] == '!') { /*FIXME*/ -#if 0 - int command_number; std::string cut_string; - //std::cout << CYAN << command << "\n" << NORMAL; - //std::cout << GREEN << dummy_string << "\n" << NORMAL; - - //assert(dummy_st == 130); - + unsigned int command_number; cut_string = dummy_string.substr(1, dummy_string.length()); - //std::cout << GREEN << cut_string << "\n" << NORMAL; command_number = std::stoi(cut_string, 0, 10); - if (command_number > SHELL_HISTORY_SIZE) + if (command_number > SHELL_HISTORY_SIZE - 1) { - std::cout << RED << "the command number provided is bigger than SHELL_HISTORY_SIZE." << NORMAL << "\n"; + PRINT_WITH_COLOR_LB(RED, "the command number provided is bigger than SHELL_HISTORY_SIZE"); } else { - std::cout << CYAN << shHistory.History[command_number] << NORMAL; + std::ifstream historyfile; + historyfile.open(SHELL_HISTORY_FILE); + std::string tempstring; + unsigned int tempint = 0; + + while(std::getline(historyfile, tempstring)) + { + if (tempint == command_number) + { + PRINT_WITH_COLOR_LB(NORMAL, tempstring.c_str()); + break; + } + + tempint++; + } } -#endif continue; } |