comparison src/io.c @ 0:4b915342e2a8

LuaSocket 2.0.2 + CMake build description.
author Eric Wing <ewing . public |-at-| gmail . com>
date Tue, 26 Aug 2008 18:40:01 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4b915342e2a8
1 /*=========================================================================*\
2 * Input/Output abstraction
3 * LuaSocket toolkit
4 *
5 * RCS ID: $Id: io.c,v 1.6 2005/09/29 06:11:41 diego Exp $
6 \*=========================================================================*/
7 #include "io.h"
8
9 /*=========================================================================*\
10 * Exported functions
11 \*=========================================================================*/
12 /*-------------------------------------------------------------------------*\
13 * Initializes C structure
14 \*-------------------------------------------------------------------------*/
15 void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx) {
16 io->send = send;
17 io->recv = recv;
18 io->error = error;
19 io->ctx = ctx;
20 }
21
22 /*-------------------------------------------------------------------------*\
23 * I/O error strings
24 \*-------------------------------------------------------------------------*/
25 const char *io_strerror(int err) {
26 switch (err) {
27 case IO_DONE: return NULL;
28 case IO_CLOSED: return "closed";
29 case IO_TIMEOUT: return "timeout";
30 default: return "unknown error";
31 }
32 }