exec in newlisp 10.7.1/Windows

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?

exec in newlisp 10.7.1/Windows

Postby Cyril » Fri Feb 17, 2017 6:29 pm

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!
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia

Re: exec in newlisp 10.7.1/Windows

Postby Lutz » Mon Feb 20, 2017 12:05 am

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")
> (exec "od -b binfile")
("0000000   012 012 012" "0000003")

and it will not do the Windows linefeed text translation.
Posts: 5276
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Return to newLISP and the O.S.

Who is online

Users browsing this forum: No registered users and 1 guest