diff options
Diffstat (limited to 'src/serial.c')
-rw-r--r-- | src/serial.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/serial.c b/src/serial.c index 583d4e5..dedbeb5 100644 --- a/src/serial.c +++ b/src/serial.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Serial stream | 2 | * Serial stream |
3 | * LuaSocket toolkit | 3 | * LuaSocket toolkit |
4 | \*=========================================================================*/ | 4 | \*=========================================================================*/ |
5 | #include <string.h> | 5 | #include <string.h> |
6 | 6 | ||
7 | #include "lua.h" | 7 | #include "lua.h" |
8 | #include "lauxlib.h" | 8 | #include "lauxlib.h" |
@@ -11,7 +11,7 @@ | |||
11 | #include "socket.h" | 11 | #include "socket.h" |
12 | #include "options.h" | 12 | #include "options.h" |
13 | #include "unix.h" | 13 | #include "unix.h" |
14 | #include <sys/un.h> | 14 | #include <sys/un.h> |
15 | 15 | ||
16 | /* | 16 | /* |
17 | Reuses userdata definition from unix.h, since it is useful for all | 17 | Reuses userdata definition from unix.h, since it is useful for all |
@@ -55,7 +55,7 @@ static luaL_Reg serial_methods[] = { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | /* our socket creation function */ | 57 | /* our socket creation function */ |
58 | /* this is an ad-hoc module that returns a single function | 58 | /* this is an ad-hoc module that returns a single function |
59 | * as such, do not include other functions in this array. */ | 59 | * as such, do not include other functions in this array. */ |
60 | static luaL_Reg func[] = { | 60 | static luaL_Reg func[] = { |
61 | {"serial", global_create}, | 61 | {"serial", global_create}, |
@@ -120,7 +120,7 @@ static int meth_getfd(lua_State *L) { | |||
120 | /* this is very dangerous, but can be handy for those that are brave enough */ | 120 | /* this is very dangerous, but can be handy for those that are brave enough */ |
121 | static int meth_setfd(lua_State *L) { | 121 | static int meth_setfd(lua_State *L) { |
122 | p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); | 122 | p_unix un = (p_unix) auxiliar_checkgroup(L, "serial{any}", 1); |
123 | un->sock = (t_socket) luaL_checknumber(L, 2); | 123 | un->sock = (t_socket) luaL_checknumber(L, 2); |
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
@@ -131,7 +131,7 @@ static int meth_dirty(lua_State *L) { | |||
131 | } | 131 | } |
132 | 132 | ||
133 | /*-------------------------------------------------------------------------*\ | 133 | /*-------------------------------------------------------------------------*\ |
134 | * Closes socket used by object | 134 | * Closes socket used by object |
135 | \*-------------------------------------------------------------------------*/ | 135 | \*-------------------------------------------------------------------------*/ |
136 | static int meth_close(lua_State *L) | 136 | static int meth_close(lua_State *L) |
137 | { | 137 | { |
@@ -156,7 +156,7 @@ static int meth_settimeout(lua_State *L) { | |||
156 | 156 | ||
157 | 157 | ||
158 | /*-------------------------------------------------------------------------*\ | 158 | /*-------------------------------------------------------------------------*\ |
159 | * Creates a serial object | 159 | * Creates a serial object |
160 | \*-------------------------------------------------------------------------*/ | 160 | \*-------------------------------------------------------------------------*/ |
161 | static int global_create(lua_State *L) { | 161 | static int global_create(lua_State *L) { |
162 | const char* path = luaL_checkstring(L, 1); | 162 | const char* path = luaL_checkstring(L, 1); |
@@ -180,7 +180,7 @@ static int global_create(lua_State *L) { | |||
180 | /* initialize remaining structure fields */ | 180 | /* initialize remaining structure fields */ |
181 | socket_setnonblocking(&sock); | 181 | socket_setnonblocking(&sock); |
182 | un->sock = sock; | 182 | un->sock = sock; |
183 | io_init(&un->io, (p_send) socket_write, (p_recv) socket_read, | 183 | io_init(&un->io, (p_send) socket_write, (p_recv) socket_read, |
184 | (p_error) socket_ioerror, &un->sock); | 184 | (p_error) socket_ioerror, &un->sock); |
185 | timeout_init(&un->tm, -1, -1); | 185 | timeout_init(&un->tm, -1, -1); |
186 | buffer_init(&un->buf, &un->io, &un->tm); | 186 | buffer_init(&un->buf, &un->io, &un->tm); |