DEVTYPE=scsi_device DRIVER=sr MODALIAS=scsi:t-0x05 6-ˆl—Ðz¾”d i?u8 \¸Ó·uLZ7ÿ�þBg Á7à?Ÿ× ƒh¹ÖÀÔ-MAJOR=4 MINOR=66 DEVNAME=ttyS2 ?÷_s, "\n+", "") local _, __, name, value = string.find(header_s, "([^%s:]-):%s*(.*)") return name, value end function _M.parse_headers(headers_s) local headers_t = _M.split_headers(headers_s) local headers = {} for i = 1, #headers_t do local name, value = _M.parse_header(headers_t[i]) if name then name = string.lower(name) if headers[name] then headers[name] = headers[name] .. ", " .. value else headers[name] = value end end end return headers end function _M.parse_from(from) local _, __, name, address = string.find(from, "^%s*(.-)%s*%<(.-)%>") if not address then _, __, address = string.find(from, "%s*(.+)%s*") end name = name or "" address = address or "" if name == "" then name = address end name = string.gsub(name, '"', "") return name, address end function _M.split_mbox(mbox_s) local mbox = {} mbox_s = string.gsub(mbox_s, "\r\n", "\n") .."\n\nFrom \n" local nj, i, j = 1, 1, 1 while 1 do i, nj = string.find(mbox_s, "\n\nFrom .-\n", j) if not i then break end local message = string.sub(mbox_s, j, i-1) table.insert(mbox, message) j = nj+1 end return mbox end function _M.parse(mbox_s) local mbox = _M.split_mbox(mbox_s) for i = 1, #mbox do mbox[i] = _M.parse_message(mbox[i]) end return mbox end function _M.parse_message(message_s) local message = {} message.headers, message.body = _M.split_message(message_s) message.headers = _M.parse_headers(message.headers) return message end return _M local string = require("string") local table = require("table") local unpack = unpack or table.unpack local base = _G local _M = {} if module then -- heuristic for exporting a global package table ltn12 = _M end module("ltn12") local filter,source,sink,pump = {},{},{},{} _M.filter = filter _M.source = source _M.sink = sink _M.pump = pump local unpack = unpack or table.unpack local select = base.select _M.BLOCKSIZE = 2048 _M._VERSION = "LTN12 1.0.3" function filter.cycle(low, ctx, extra) base.assert(low) return function(chunk) local ret ret, ctx = low(ctx, chunk, extra) return ret end end function filter.chain(...) local arg = {...} local n = base.select('#',...) local top, index = 1, 1 local retry = "" return function(chunk) retry = chunk and retry while true do if index == top then chunk = arg[index](chunk) if chunk == "" or top == n then return chunk elseif chunk then index = index + 1 else top = top+1 index = top end else chunk = arg[index](chunk or "") if chunk == "" then index = index - 1 chunk = retry elseif chunk then if index == n then return chunk else index = index + 1 end else base.error("filter returned inappropriate nil") end end end end end local function empty() return nil end function source.empty() return empty end function source.error(err) return function() return nil, err end end function source.file(handle, io_err) if handle then return function() local chunk = handle:read(_M.BLOCKSIZE) if not chunk then handle:close() end return chunk end else return source.error(io_err or "unable to open file") end end function source.simplify(src) base.assert(src) return function() local chunk, err_or_new = src() src = err_or_new or src if not chunk then return nil, err_or_new else return chunk end end end func