aboutsummaryrefslogtreecommitdiff
path: root/samples/eol.lua
diff options
context:
space:
mode:
Diffstat (limited to 'samples/eol.lua')
-rw-r--r--samples/eol.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/samples/eol.lua b/samples/eol.lua
new file mode 100644
index 0000000..eeaf0ce
--- /dev/null
+++ b/samples/eol.lua
@@ -0,0 +1,13 @@
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)