bool ClacCommandWindow::process_keystroke( int &key_code ) { // If the user hasn't hit Enter, he/she is editing the command. if( key_code != scr::K_RETURN ) return scr::CommandWindow::process_keystroke( key_code ); // Push the command text onto the master stream as a string of Clac command words. StringStream *words = new StringStream( command_text ); global::word_source( ).push( words ); if( process_words( ) == false ) { key_code = scr::K_ESC; return false; } // Prepare the command window for another command line. command_text.erase( ); cursor_offset = 0; return true; }
int main(int nargs, char *args[]) { FILE *fp; /* * buf[] is used to hold the sorted string. We don't use strdup() to * create a copy of the string because we don't need to keep the * sorted string around except when we see a word that doesn't have any * anagrams in the list and we have to create a new group of words. */ fp = parse_input(nargs, args); process_words(fp); sortWordList(); printWordList(); cleanup(fp); return err_status; }