[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: Is it possible to output LF without CR under Windows? Lua 5.3
From: Brigham Toskin <brighamtoskin () gmail ! com>
Date: 2015-05-19 18:55:04
Message-ID: CAFxs_oSzpyb4t029dbHGdXkm7DDWJPRS16s=w_M73BWq2FCNZQ () mail ! gmail ! com
[Download RAW message or body]
Oh, I'm stupid. If you're going the unix pipe route, just send it through
dos2unix.[1] It would look like:
> lua whateverscript.lua | dos2unix ... # display, redirect, or pipe to
next util here
[1] http://waterlan.home.xs4all.nl/dos2unix.html
On Mon, May 18, 2015 at 3:28 PM, Brigham Toskin <brighamtoskin@gmail.com>
wrote:
> Or, since it sounds like you're trying to pipe it to a unix util on
> windows (mingw? cygwin?), you could insert sed or maybe something like tr
> into the pipeline right after Lua?
>
> On Mon, May 18, 2015 at 3:25 PM, Brigham Toskin <brighamtoskin@gmail.com>
> wrote:
>
>> If you're in LuaJIT you can maybe use FFI (or similar C function/system
>> call extension under Lua).
>>
>> On Sun, May 17, 2015 at 9:20 PM, 睿 <zrui16@hotmail.com> wrote:
>>
>>> It's CRT (not lua) that does the translation.
>>> In C, one can call _setmode( _fileno( stdout ), _O_BINARY ) to set
>>> output to binary mode.
>>> I don't see how it can be done directly in lua.
>>>
>>> -----Original Message-----
>>> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
>>> On Behalf Of tonyp@acm.org
>>> Sent: Monday, May 18, 2015 3:48 AM
>>> To: Lua mailing list
>>> Subject: Re: Is it possible to output LF without CR under Windows? Lua
>>> 5.3
>>>
>>> No file. I'm interested in stdout as I want to pipe it to another
>>> command.
>>> Can I re-open stdout in binary mode?
>>>
>>> -----Original Message-----
>>> From: Pierre Chapuis
>>> Sent: Sunday, May 17, 2015 10:44 PM
>>> To: Lua mailing list
>>> Subject: Re: Is it possible to output LF without CR under Windows? Lua
>>> 5.3
>>>
>>> > Any ideas how to output LFs only under Windows?
>>>
>>> Open the file in binary mode.
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Brigham Toskin
>>
>
>
>
> --
> Brigham Toskin
>
--
Brigham Toskin
[Attachment #3 (text/html)]
<div dir="ltr">Oh, I'm stupid. If you're going the unix pipe route, just send \
it through dos2unix.[1] It would look like:<div><br></div><div>> lua \
whateverscript.lua | dos2unix ... # display, redirect, or pipe to next util \
here<br><div><br></div><div>[1] <a \
href="http://waterlan.home.xs4all.nl/dos2unix.html">http://waterlan.home.xs4all.nl/dos2unix.html</a></div></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Mon, May 18, 2015 at 3:28 PM, \
Brigham Toskin <span dir="ltr"><<a href="mailto:brighamtoskin@gmail.com" \
target="_blank">brighamtoskin@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Or, since it sounds like you're trying to \
pipe it to a unix util on windows (mingw? cygwin?), you could insert sed or maybe \
something like tr into the pipeline right after Lua?</div><div \
class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Mon, May 18, \
2015 at 3:25 PM, Brigham Toskin <span dir="ltr"><<a \
href="mailto:brighamtoskin@gmail.com" \
target="_blank">brighamtoskin@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">If you're in LuaJIT you can maybe use FFI \
(or similar C function/system call extension under Lua).</div><div \
class="gmail_extra"><div><div><br><div class="gmail_quote">On Sun, May 17, 2015 at \
9:20 PM, 睿 <span dir="ltr"><<a href="mailto:zrui16@hotmail.com" \
target="_blank">zrui16@hotmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">It's CRT (not lua) that does the translation.<br> In C, \
one can call _setmode( _fileno( stdout ), _O_BINARY ) to set output to binary \
mode.<br> I don't see how it can be done directly in lua.<br>
<div><div><br>
-----Original Message-----<br>
From: <a href="mailto:lua-l-bounces@lists.lua.org" \
target="_blank">lua-l-bounces@lists.lua.org</a> [mailto:<a \
href="mailto:lua-l-bounces@lists.lua.org" \
target="_blank">lua-l-bounces@lists.lua.org</a>] On Behalf Of <a \
href="mailto:tonyp@acm.org" target="_blank">tonyp@acm.org</a><br>
Sent: Monday, May 18, 2015 3:48 AM<br>
To: Lua mailing list<br>
Subject: Re: Is it possible to output LF without CR under Windows? Lua 5.3<br>
<br>
No file. I'm interested in stdout as I want to pipe it to another command.<br>
Can I re-open stdout in binary mode?<br>
<br>
-----Original Message-----<br>
From: Pierre Chapuis<br>
Sent: Sunday, May 17, 2015 10:44 PM<br>
To: Lua mailing list<br>
Subject: Re: Is it possible to output LF without CR under Windows? Lua 5.3<br>
<br>
> Any ideas how to output LFs only under Windows?<br>
<br>
Open the file in binary mode.<br>
<br>
<br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br \
clear="all"><div><br></div></div></div><span><font color="#888888">-- \
<br><div>Brigham Toskin</div> </font></span></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span \
class="HOEnZb"><font color="#888888">-- <br><div>Brigham Toskin</div> \
</font></span></div> </blockquote></div><br><br clear="all"><div><br></div>-- \
<br><div class="gmail_signature">Brigham Toskin</div> </div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic