|
@ -1,8 +1,7 @@ |
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Declare a buffer for user input of size 2048 */ |
|
|
|
|
|
static char input[2048]; |
|
|
|
|
|
|
|
|
#include <editline/readline.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char const *argv[]) |
|
|
int main(int argc, char const *argv[]) |
|
@ -13,14 +12,17 @@ int main(int argc, char const *argv[]) |
|
|
|
|
|
|
|
|
/* In a never ending loop */ |
|
|
/* In a never ending loop */ |
|
|
while (1) { |
|
|
while (1) { |
|
|
/* Output our prompt */ |
|
|
|
|
|
fputs("lispy> ", stdout); |
|
|
|
|
|
|
|
|
/* Output our prompt and get input */ |
|
|
|
|
|
char* input = readline("lispy> "); |
|
|
|
|
|
|
|
|
/* Read a line of user input of max size 2014 */ |
|
|
|
|
|
fgets(input, 2048, stdin); |
|
|
|
|
|
|
|
|
/* Add input to history */ |
|
|
|
|
|
add_history(input); |
|
|
|
|
|
|
|
|
/* Echo input back to user */ |
|
|
/* Echo input back to user */ |
|
|
printf("No you're a %s", input); |
|
|
|
|
|
|
|
|
printf("No you're a %s\n", input); |
|
|
|
|
|
|
|
|
|
|
|
/* Free retrieved input */ |
|
|
|
|
|
free(input); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|