summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/getc.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/getc.c')
-rw-r--r--apps/plugins/lua/getc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/plugins/lua/getc.c b/apps/plugins/lua/getc.c
new file mode 100644
index 0000000..84a280e
--- /dev/null
+++ b/apps/plugins/lua/getc.c
@@ -0,0 +1,10 @@
+#include "rocklibc.h"
+
+int PREFIX(getc)(int fd)
+{
+ unsigned char c;
+ if (rb->read(fd, &c, 1))
+ return c;
+ else
+ return EOF;
+}