#include #include #include #include #include /* Simple example of using gnu readline to get lines of input from a user. Needs to be linked with -lreadline -lcurses add_history tells the readline library to add the line to it's internal histiry, so that using up-arrow (or ^p) will allows the user to see/edit previous lines. */ int main(int argc, char **argv) { char *s; while (s=readline("prompt> ")) { add_history(s); /* adds the line to the readline history buffer */ free(s); /* clean up! */ } return(0); }