1-----------------------------------------------------------------------------
2-- Little program to adjust end of line markers.
3-- LuaSocket sample files
4-- Author: Diego Nehab
5-----------------------------------------------------------------------------
6local mime = require("mime")
7local ltn12 = require("ltn12")
8local marker = '\n'
9if arg and arg[1] == '-d' then marker = '\r\n' end
10local filter = mime.normalize(marker)
11local source = ltn12.source.chain(ltn12.source.file(io.stdin), filter)
12local sink = ltn12.sink.file(io.stdout)
13ltn12.pump.all(source, sink)
14