summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/luasocket/src/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luasocket/src/io.c')
-rw-r--r--Build/source/texk/web2c/luatexdir/luasocket/src/io.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/io.c b/Build/source/texk/web2c/luatexdir/luasocket/src/io.c
new file mode 100644
index 00000000000..a4230ce82b8
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/luasocket/src/io.c
@@ -0,0 +1,30 @@
+/*=========================================================================*\
+* Input/Output abstraction
+* LuaSocket toolkit
+\*=========================================================================*/
+#include "io.h"
+
+/*=========================================================================*\
+* Exported functions
+\*=========================================================================*/
+/*-------------------------------------------------------------------------*\
+* Initializes C structure
+\*-------------------------------------------------------------------------*/
+void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx) {
+ io->send = send;
+ io->recv = recv;
+ io->error = error;
+ io->ctx = ctx;
+}
+
+/*-------------------------------------------------------------------------*\
+* I/O error strings
+\*-------------------------------------------------------------------------*/
+const char *io_strerror(int err) {
+ switch (err) {
+ case IO_DONE: return NULL;
+ case IO_CLOSED: return "closed";
+ case IO_TIMEOUT: return "timeout";
+ default: return "unknown error";
+ }
+}