diff options
Diffstat (limited to 'etc/eol.lua')
| -rw-r--r-- | etc/eol.lua | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/etc/eol.lua b/etc/eol.lua index 6b2a8a9..aa43596 100644 --- a/etc/eol.lua +++ b/etc/eol.lua | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | marker = {['-u'] = '\10', ['-d'] = '\13\10'} | 1 | local marker = '\n' |
| 2 | arg = arg or {'-u'} | 2 | if arg and arg[1] == '-d' then marker = '\r\n' end |
| 3 | marker = marker[arg[1]] or marker['-u'] | 3 | local filter = mime.normalize(marker) |
| 4 | local convert = socket.mime.normalize(marker) | 4 | local source = ltn12.source.chain(ltn12.source.file(io.stdin), filter) |
| 5 | while 1 do | 5 | local sink = ltn12.sink.file(io.stdout) |
| 6 | local chunk = io.read(1) | 6 | ltn12.pump(source, sink) |
| 7 | io.write(convert(chunk)) | ||
| 8 | if not chunk then break end | ||
| 9 | end | ||
