Commits

Levi D  committed a263bf9

no message

  • Participants
  • Parent commits 0c56d02

Comments (0)

Files changed (1)

 #include <editline/readline.h>
 #include <editline/history.h>
 
-/* Declare a static buffer for user input of maximum size 2048 */
-static char input[2048];
 
 int main(int argc, char** argv)
 {
 	while (1) {
 
 		/* Output our prompt */
-		fputs("lispy> ", stdout);
+		char* input = readline("lispy> ");
 
-		/* read a line of user input of maximum size 2048 */
-		fgets(input, 2048, stdin);
+		/* Add input to history */
+		add_history(input);
 
 		/* Echo input back to user */
 		printf("No you're a %s\n", input);
+
+		/* Free retrived input */
+		free(input);
+		
 	}
 
 	return 0;