#ifndef READLINE_FALLBACK_H
#define READLINE_FALLBACK_H

#include <stdio.h>
#include <string.h>

char* readline(const char * prompt) {
    char *result = malloc(1024);
    printf("%s", prompt);
    fgets(result, 1023, stdin);
    result[strlen(result)-1] = 0;
    return result;
}

#endif /* READLINE_FALLBACK_H */

#ifndef READLINE_FALLBACK_H
#define READLINE_FALLBACK_H

#include <stdio.h>
#include <string.h>

char* readline(const char * prompt) {
    char *result = malloc(1);
    size_t n = 0;
    printf("%s", prompt);
    getline(&result, &n, stdin);
    result[strlen(result)-1] = 0;
    return result;
}

#endif /* READLINE_FALLBACK_H */

--- 
+++ 
@@ -5,10 +5,9 @@
 #include <string.h>
 
 char* readline(const char * prompt) {
-    char *result = malloc(1);
-    size_t n = 0;
+    char *result = malloc(1024);
     printf("%s", prompt);
-    getline(&result, &n, stdin);
+    fgets(result, 1023, stdin);
     result[strlen(result)-1] = 0;
     return result;
 }
Use fgets(3) instead of getline(3) because whilst getline(3) is POSIX, it is not in the C89 or later standards
