summaryrefslogtreecommitdiff
path: root/src/l_rawio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/l_rawio.c')
-rw-r--r--src/l_rawio.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/l_rawio.c b/src/l_rawio.c
index 779d6ae..3ba2851 100644
--- a/src/l_rawio.c
+++ b/src/l_rawio.c
@@ -1,15 +1,15 @@
/*
* gcsd
*
- * gcsd the generic command sequencer daemon can be used to serialize
+ * gcsd the generic command sequencer daemon can be used to serialize
* commands sent over various paralell communication channels to a
* single command output. It can be seen as a multiplexer for any
* kind of communication between a single resource and various clients
* which want to submit commands to it or query information from it.
- * gcsd is written in C and Lua. The goal is to provide an easy to
+ * gcsd is written in C and Lua. The goal is to provide an easy to
* understand high level API based on Lua which can be used to
* implement the business logic of the so formed multiplexer daemon.
- *
+ *
*
* Copyright (C) 2009-2010 Markus Grueneis <gimpf@spreadspace.org>
* Christian Pointner <equinox@spreadspace.org>
@@ -53,7 +53,7 @@ static int l_rawio_open(lua_State *L)
if(strstr(mode_str, "O_RDONLY")) mode |= O_RDONLY;
if(strstr(mode_str, "O_WRONLY")) mode |= O_WRONLY;
- if(strstr(mode_str, "O_RDWR")) mode |= O_RDWR;
+ if(strstr(mode_str, "O_RDWR")) mode |= O_RDWR;
int fd = open(filename, mode);
lua_pushinteger(L, fd);
@@ -62,7 +62,7 @@ static int l_rawio_open(lua_State *L)
static int l_rawio_setnonblock(lua_State *L)
{
- int fd = luaL_checkint(L,1);
+ int fd = luaL_checkint(L,1);
int ret = fcntl(fd, F_SETFL, O_NONBLOCK);
if(ret == -1) {
@@ -80,9 +80,9 @@ static int l_rawio_write(lua_State *L)
int fd = luaL_checkint(L,1);
size_t len = 0;
const char* data = luaL_checklstring(L, 2, &len);
-
+
int ret = write(fd, data, len);
-
+
if(ret == -1) {
lua_pushnil(L);
// FIXXXXXME: strerror is not threadsafe!!!
@@ -103,9 +103,9 @@ static int l_rawio_read(lua_State *L)
lua_pushstring(L, "bad alloc");
return 2;
}
-
+
int ret = read(fd, data, len);
-
+
if(ret == -1) {
lua_pushnil(L);
// FIXXXXXME: strerror is not threadsafe!!!
@@ -134,7 +134,7 @@ static const struct luaL_reg rawio_funcs [] = {
};
-LUALIB_API int luaopen_rawio(lua_State *L)
+LUALIB_API int luaopen_rawio(lua_State *L)
{
luaL_register(L, LUA_RAWIOLIBNAME, rawio_funcs);
return 1;