no interaction in xterm, but it works in a cygwin shell

Igor Pechtchanski pechtcha@cs.nyu.edu
Wed Feb 18 04:19:00 GMT 2004


On Tue, 17 Feb 2004, Andreas Seidl wrote:

> I'm using a Lisp-based computer algebra system called REDUCE. Basically
> it is started by a call of the form:
>
> #!/usr/bin/bash -v
> /cygdrive/c/devred/lisp/psl/win32/psl/bpsl -td 16000000 -f
> 'C:\devred\lisp\psl\win32\red\reduce.img'
>
> The -v option is for printing the executed commands on the screen. The
> second line calls the Lisp (bpsl.exe) with the memory size (16Mb) and an
> image file (reduce.img). The binary bpsl.exe was compiled under Windows.
>
> In a Cygwin shell, i can have an interactive session without problems, e.g.:
>
> ----- start -----
> seidl@Bellarmin /cygdrive/d
> $ reduce
> #!/usr/bin/bash -v
> # Run Windows PSL REDUCE.
> /cygdrive/c/devred/lisp/psl/win32/psl/bpsl -td 16000000 -f
> 'C:\devred\lisp\psl\w
> in32\red\reduce.img'
> Loading image file :C:\devred\lisp\psl\win32\red\reduce.img
>
> REDUCE Development Version, 10-Dec-03 ...
>
> 1: factorial 40;
>
> 815915283247897734345611269596115894272000000000
>
> 2: factorial 50;
>
> 30414093201713378043612608166064768844377641568960512000000000000
>
> 3: quit;
>
> Quitting
>
> seidl@Bellarmin /cygdrive/d
> $
> ------ end -----
>
> Now, if I do the same in an xterm, the following happens: There is no
> output on the screen from REDUCE. But I can enter line by line:
>
> factorial 40;
> factorial 50;
> quit;
>
> As soon as the quit; is entered, all the missing output is flushed to
> the screen, see this screenshot of an xterm session:
>
> ----- start -----
> seidl@Bellarmin ~
> $ reduce
> #!/usr/bin/bash -v
> # Run Windows PSL REDUCE.
> /cygdrive/c/devred/lisp/psl/win32/psl/bpsl -td 16000000 -f 'C:\devred\lisp\psl\win32\red\reduce.img'
> factorial 40;
> factorial 50;
> quit;
> Loading image file :C:\devred\lisp\psl\win32\red\reduce.img
>
> REDUCE Development Version, 10-Dec-03 ...
>
> 1:
> 815915283247897734345611269596115894272000000000
>
> 2:
> 30414093201713378043612608166064768844377641568960512000000000000
>
> 3:
> Quitting
>
> seidl@Bellarmin ~
> $
> ----- end -----
>
> So my question is: Can somebody explain this behaviour, is there a
> solution? (E.g. the command line version of Maple works nicely both in
> xterm and a Cygwin shell.)
>
> Ciao,
> Andreas.

Andreas,

Just a WAG, but could it be that lisp detects that it's running on a
console and uses a different (interactive) input mode?  As far as Windows
programs are concerned, a pty is nothing but a pipe, so you may have to
force interactive mode somehow (via a flag?).

Or it could be a CRLF vs. LF issue (i.e., the program waiting for CRLF to
complete the line, but getting LFs, and then, once it gets the EOF,
parsing the whole input), but I doubt it.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton



More information about the Cygwin-xfree mailing list