diff options
Diffstat (limited to 'src/user/lib/libc/std/readline.c')
-rw-r--r-- | src/user/lib/libc/std/readline.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/user/lib/libc/std/readline.c b/src/user/lib/libc/std/readline.c index 4177bf6..5dfd442 100644 --- a/src/user/lib/libc/std/readline.c +++ b/src/user/lib/libc/std/readline.c @@ -1,44 +1,6 @@ #include <readline.h> #include <stdlib.h> -char* freadln(FILE *f) { - int i; - - char *p = (char*)malloc(256); - char *b = p; - - while (1) { - int l = fread(b, 255, 1, f); - if (l < 0) { - free(b); - return 0; - } - - for (i = 0; i < l; i++) { - if (b[i] == '\n') { - b[i+1] = 0; - return p; - } else if (b[i] == 27) { // ignore escape sequences - b[i] = 0; - l = i; - } - } - - int d = b - p + l; - - char* newp = (char*)malloc(d + 256); - memcpy(newp, p, d); - free(p); - p = newp; - b = p + d; - } -} - -char* readln() { - return freadln(&term); -} - - // ** READLINE char *freadline(FILE *f, readline_history *h) { |