int main(int argc, char **argv, char **envp) { init(); welcomeScreen(); shellPrompt(); while (TRUE) { userInput = getchar(); switch (userInput) { case '\n': shellPrompt(); break; default: getTextLine(); handleUserCommand(); shellPrompt(); break; } } printf("\n"); return 0; }
int main(int argc, char **argv, char **envp) { init(); welcomeScreen(); shellPrompt(); // prints the prompt while (TRUE) { userInput = getchar(); switch (userInput) { case '\n': // if the user hits the enter key shellPrompt(); // nothing happens break; default: getTextLine(); // store user input in buffer handleUserCommand(); // execute user command shellPrompt(); // print the prompt break; } } printf("\n"); return 0; }