|
|
@ -1,7 +1,33 @@ |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
|
|
|
|
/* If we are on Windows compile these functions */ |
|
|
|
#ifdef _WIN32 |
|
|
|
#include <string.h> |
|
|
|
#include <assert.h> |
|
|
|
|
|
|
|
static char buffer[2048]; |
|
|
|
|
|
|
|
/* Fake readline function */ |
|
|
|
char* readline(char* prompt) { |
|
|
|
fputs(prompt, stdout); |
|
|
|
fgets(buffer, 2048, stdin); |
|
|
|
char* cpy = malloc(strlen(buffer)+1); |
|
|
|
assert(cpy != NULL) |
|
|
|
strcpy(cpy, buffer); |
|
|
|
cpy[strlen(cpy)-1] = '\0'; |
|
|
|
return cpy; |
|
|
|
} |
|
|
|
|
|
|
|
/* Fake add_history function */ |
|
|
|
void add_history(char* unused) {} |
|
|
|
|
|
|
|
/* Otherwise include the editline headers |
|
|
|
could use __APPLE__ for detection of OSX */ |
|
|
|
#else |
|
|
|
#include <editline/readline.h> |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char const *argv[]) |
|
|
|