Streaming IO in Newlisp (fgets) and command intepreters..

Started by newdep, August 22, 2006, 01:49:30 AM

Previous topic - Next topic

newdep

Hi Lutz,



newLISP uses fgets for command IO, now there Is 1 specific problem

on every OS that uses newLISP together with 'process.



When you do a (process "cmd") or (process "sh") there is always a mixup

between the two command intepreters.



The problem is probably the use of 'fgets in all of them together with the

fgets in newlisp.c..



Now I was wondering if newLISP could fix this problem on its side?



I think its a matter of intepreting a "newline" or "eof" in newlisp..

(differenty from how a i.e. "cmd" or "sh" or "bsh" does...) while there is a fgets action in newlisp...



But im not yet sure how this could be fixed.. perhpas you have an idea? If you test the 'process above you will see the behaviour..



Regards, Norman.
-- (define? (Cornflakes))

Lutz

#1
If newLISP starts a process stdout of both processes go to the same window and they share stdin too. You can avoid this by assigning different I/O channels to the process you are starting using the pipe parameters in the 'process' command. See the 'process' command in the manual:

http://newlisp.org/downloads/newlisp_manual.html#process">http://newlisp.org/downloads/newlisp_ma ... ml#process">http://newlisp.org/downloads/newlisp_manual.html#process



The bc calculator example in the manual and pjot's gtk-server are examples of this procedure. Also runtk here:



http://newlisp.org/index.cgi?page=Tk_and_newLISP">http://newlisp.org/index.cgi?page=Tk_and_newLISP



does the same think with the Tcl/Tk shell.



 



Lutz

newdep

#2
yes thats correct... I thought that changing the 'fgets way of intepreting

IO could help ..but I dont think thats a solution..



Thanks!
-- (define? (Cornflakes))