exec in newlisp 10.7.1/Windows

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

exec in newlisp 10.7.1/Windows

Post by Cyril »

Seems like exec in newlisp 10.7.1/Windows opens it's second argument in text (as opposed to binary) mode. Test:

Code: Select all

(exec "od -b" "hello\r\nworld\r\n")
Output with newlisp 10.6.2

Code: Select all

0000000 150 145 154 154 157 015 012 167 157 162 154 144 015 012
Output with newlisp 10.7.1

Code: Select all

0000000 150 145 154 154 157 015 015 012 167 157 162 154 144 015 015 012
I suppose this is a side effect of the change to a newer MinGW. But still confusing - "binary mode everywhere" policy was consistent so far.
With newLISP you can grow your lists from the right side!

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: exec in newlisp 10.7.1/Windows

Post by Lutz »

The translation from “\n” to “\r\n” happens in the newer MINGW development system call popen() or _popen(). Both do the same text translation in current MINGW versions used.

In newLISP popen() is used only in the exec function and when writing CGI output in newLISP builtin web server (nl-web.c).

When using text just use the UNIX “\n” line-feed format as input on both UNIX and Windows. When you need strictly binary format on Windows then convert data to a binary file first then use exec on that:

Code: Select all

> (write-file "binfile" "\n\n\n")
3
> (exec "od -b binfile")
("0000000   012 012 012" "0000003")
> 
and it will not do the Windows linefeed text translation.

Locked