#include #include #include #include #include #define WHITE "\001\e[1;37m\002" #define RESET "\001\e[0m\002" int main(void) { char *prompt; char *line_input; //prompt = WHITE"mybash a very long prompt to test the output in case of a redirection in a file> "RESET; prompt = WHITE"mybash> "RESET; line_input = NULL; while (1) { if (line_input) free(line_input); line_input = readline(prompt); if (line_input) { if (!strncmp(line_input, "echo ", 5)) { write(1, line_input + 5, strlen(line_input) - 5); write(1, "\n", 1); } } if (!line_input) { write(2, "exit\n", 5); exit(0); } } /* prompt = WHITE"mybash a very long prompt to test the output in case of a redirection in a file, style longer than that even> "RESET; write(1, prompt, strlen(prompt)); write(1, "\n", 1); */ return (0); }