summaryrefslogtreecommitdiff
path: root/tests/readline.c
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2016-12-09 15:54:33 -0600
committerepoch <epoch@hacking.allowed.org>2016-12-09 15:54:33 -0600
commitb4dddad64122649d9da6340032275d1756930e74 (patch)
treeafcfff52545fce1c7713f24e7a28904230fa8671 /tests/readline.c
parentfa1b447ef684e5eadda27d8870de6a6e09292a18 (diff)
downloadhackvr-b4dddad64122649d9da6340032275d1756930e74.tar.gz
hackvr-b4dddad64122649d9da6340032275d1756930e74.zip
LOTS OF SHIT
Diffstat (limited to 'tests/readline.c')
-rw-r--r--tests/readline.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/readline.c b/tests/readline.c
new file mode 100644
index 0000000..76d6a2d
--- /dev/null
+++ b/tests/readline.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+char *read_line_hack(FILE *fp,int len) {
+ short in;
+ char *t;
+ if((in=fgetc(fp)) == '\n') {
+ t=malloc(len+1);
+ t[len]=0;
+ return t;
+ }
+ t=read_line_hack(fp,len+1);
+ t[len]=in;
+ return t;
+}
+
+int main() {
+ char *t=read_line_hack(stdin,0);
+ printf("%s\n",t);
+}