summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Kendrick (humdrum) <rjek@rjek.com>2013-11-06 10:44:13 +0000
committerRob Kendrick (humdrum) <rjek@rjek.com>2013-11-06 10:44:13 +0000
commit9d4daca7830c0de62404c62b05592409c7a2636b (patch)
tree4d955febf8410e9fd27f419e1ba25edabff3ec94
parent3f5ac6036aab342dcfe3719d8c6740b01179a94d (diff)
downloadluxio-9d4daca7830c0de62404c62b05592409c7a2636b.tar.gz
Some indentation sanity
-rw-r--r--luxio/simple.lua106
1 files changed, 53 insertions, 53 deletions
diff --git a/luxio/simple.lua b/luxio/simple.lua
index 0fa5124..f8cb1ad 100644
--- a/luxio/simple.lua
+++ b/luxio/simple.lua
@@ -448,7 +448,7 @@ local function close(o)
o.fd = nil
o.closed = true
-
+
return true
end
@@ -463,7 +463,7 @@ local function nonblocking(o, b)
local fd = o.fd
local flags, errno = l_fcntl(fd, l.F_GETFL)
-
+
if flags == -1 then
return err("fcntl", errno)
end
@@ -514,37 +514,37 @@ local function read(o, ...)
local res = { }
for idx, patt in ipairs { ... } do
if patt == "*a" then
- local c = { }
- repeat
- local r, errno = l_read(o.fd, l.BUFSIZ)
- if r == -1 then
- return err("read", errno)
- end
- c[#c + 1] = r
- until #r == 0
- res[#res + 1] = table.concat(c)
+ local c = { }
+ repeat
+ local r, errno = l_read(o.fd, l.BUFSIZ)
+ if r == -1 then
+ return err("read", errno)
+ end
+ c[#c + 1] = r
+ until #r == 0
+ res[#res + 1] = table.concat(c)
elseif patt == "*l" then
- local c = { }
- repeat
- local r, errno = l_read(o.fd, 1)
- if r == -1 then
- return err("read", errno)
- end
- if r == '\n' then
- break
- else
- c[#c + 1] = r
- end
- until #r == 0
- res[#res + 1] = table.concat(c)
+ local c = { }
+ repeat
+ local r, errno = l_read(o.fd, 1)
+ if r == -1 then
+ return err("read", errno)
+ end
+ if r == '\n' then
+ break
+ else
+ c[#c + 1] = r
+ end
+ until #r == 0
+ res[#res + 1] = table.concat(c)
elseif type(patt) == "number" then
- local r, errno = l_read(o.fd, patt)
- if r == -1 then
- return err("read", errno)
- end
- res[#res + 1] = r
+ local r, errno = l_read(o.fd, patt)
+ if r == -1 then
+ return err("read", errno)
+ end
+ res[#res + 1] = r
else
- error(("unknown pattern specification '%s' at #%d"):format(patt, idx))
+ error(("unknown pattern specification '%s' at #%d"):format(patt, idx))
end
end
@@ -574,7 +574,7 @@ end
local function fstat(o)
sio_check_mt(o)
local r, e = l_fstat(o.fd)
-
+
if r < 0 then
return err("fstat", e)
end
@@ -670,7 +670,7 @@ local function fchmod(o, mode)
return err("fchmod", errno)
end
- return r
+ return r
end
local function umask(mask)
@@ -679,7 +679,7 @@ end
local function link(existing, new)
local r, errno = l_link(existing, new)
-
+
if r ~= 0 then
return err("link", errno)
end
@@ -700,11 +700,11 @@ end
local function unlink(pathname)
local r, errno = l_unlink(pathname)
-
+
if r ~= 0 then
return err("unlink", errno)
end
-
+
return true
end
@@ -804,8 +804,8 @@ local function connect(host, serv)
r = sio_wrap_mt(sock, false, sockname)
r.sock = {
family = addr.ai_family,
- type = addr.ai_socktype,
- addr = addr.ai_addr
+ type = addr.ai_socktype,
+ addr = addr.ai_addr
}
return r
@@ -861,8 +861,8 @@ local function bind(host, serv, backlog)
r = sio_wrap_mt(sock, false, sockname)
r.sock = {
family = addr.ai_family,
- type = addr.ai_socktype,
- addr = addr.ai_addr
+ type = addr.ai_socktype,
+ addr = addr.ai_addr
}
return r
@@ -884,8 +884,8 @@ local function accept(o)
r = sio_wrap_mt(r, false, sockname)
r.sock = {
family = addr.family,
- type = l.SOCK_STREAM,
- addr = addr
+ type = l.SOCK_STREAM,
+ addr = addr
}
return r, addr
@@ -899,7 +899,7 @@ local function msetsockopt(o, level, option, value)
if r == 0 then
return true
end
-
+
return err("setsockopt", errno)
end
@@ -931,7 +931,7 @@ local function mbind(o, address, port)
o.sock.family == l.AF_INET and "ipv4" or "ipv6",
o.sock.type == l.SOCK_STREAM and "tcp" or "udp",
sockaddr.address, sockaddr.port)
-
+
return true
end
@@ -992,7 +992,7 @@ descriptor_mt = {
return ("file descriptor: %s (%s)"):format(
tostring(x.fd or "closed"), x.name or "<unknown>")
end,
-
+
__gc = sio_meta_gc,
}
@@ -1015,7 +1015,7 @@ local dirent_check_mt
local dirent_mt = {
next = function(o)
dirent_check_mt(o)
-
+
local r, t = lreaddir(o.dir)
if r == 0 then
@@ -1080,7 +1080,7 @@ end
local lopendir = l.opendir
local function opendir(path)
local r, errno = lopendir(path)
-
+
if r == nil then
return err("opendir", errno)
end
@@ -1093,7 +1093,7 @@ end
local lmkdir = l.mkdir
local function mkdir(path, mode)
mode = sio_mode_flags(mode or "0755")
-
+
if path == "" or path == "/" then
return true
end
@@ -1110,7 +1110,7 @@ end
local lfork = l.fork
local function fork()
local r, errno = lfork()
-
+
if r == -1 then
return err("fork", errno)
end
@@ -1121,14 +1121,14 @@ end
local lexec = l.exec
local function exec(...)
local r, errno = lexec(...)
-
+
return err("exec", errno)
end
local lexecp = l.execp
local function execp(...)
local r, errno = lexec(...)
-
+
return err("exec", errno)
end
@@ -1137,7 +1137,7 @@ local function waitpid(pid, options)
pid = pid or -1
options = options or 0
local r, errno = waitpid(pid, options)
-
+
if r == -1 then
return err("waitpid", errno)
end
@@ -1167,7 +1167,7 @@ local function setenv(key, value, overwrite)
if r == -1 then
return err("setenv", errno)
end
-
+
return r
end
@@ -1246,4 +1246,4 @@ return {
_VERSION = "Luxio Simple Interface " .. tostring(l._RELEASE),
_COPYRIGHT = "Copyright 2012 Rob Kendrick <rjek+luxio@rjek.com>",
_RELEASE = l._RELEASE
-} \ No newline at end of file
+}