summaryrefslogtreecommitdiff
path: root/ThirdParty/luasocket/etc/eol.lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-20 13:40:34 +0800
committerchai <chaifix@163.com>2021-10-20 13:40:34 +0800
commitff0f488c97fe8b554b909a0057cebc4c860eac8f (patch)
tree4e47262b52ffce7e9cfeaaeeab46371243bcaa78 /ThirdParty/luasocket/etc/eol.lua
parentdde719dd575090b36aaa3ad85bb3cabf33f36c5a (diff)
+luasocket src
Diffstat (limited to 'ThirdParty/luasocket/etc/eol.lua')
-rw-r--r--ThirdParty/luasocket/etc/eol.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/ThirdParty/luasocket/etc/eol.lua b/ThirdParty/luasocket/etc/eol.lua
new file mode 100644
index 0000000..eeaf0ce
--- /dev/null
+++ b/ThirdParty/luasocket/etc/eol.lua
@@ -0,0 +1,13 @@
+-----------------------------------------------------------------------------
+-- Little program to adjust end of line markers.
+-- LuaSocket sample files
+-- Author: Diego Nehab
+-----------------------------------------------------------------------------
+local mime = require("mime")
+local ltn12 = require("ltn12")
+local marker = '\n'
+if arg and arg[1] == '-d' then marker = '\r\n' end
+local filter = mime.normalize(marker)
+local source = ltn12.source.chain(ltn12.source.file(io.stdin), filter)
+local sink = ltn12.sink.file(io.stdout)
+ltn12.pump.all(source, sink)