use editline to read a line of input

This commit is contained in:
josh committed 2015-12-09 15:40:24 -05:00
1 parent f63f789c5d
commit 55c748944d
2 files changed
+17 -4

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
TARGET := main
CFLAGS := -Wall
LIBS := -leditline
OBJECTS := \
main.o
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) -o $@ $(OBJECTS) $(LIBS)
+7 -4
View File
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
char input[2048];
#include <editline.h>
int main(int argc, char * argv[])
{
@@ -9,9 +10,11 @@ int main(int argc, char * argv[])
while (1)
{
printf("jlispy> ");
fflush(stdout);
fgets(input, sizeof(input), stdin);
char * input = readline("jlispy> ");
add_history(input);
printf("no you're a %s\n", input);
free(input);
}
return 0;
}