scsh-users
[Top] [All Lists]

Problem with tty-info records

To: scsh@martigny.ai.mit.edu
Subject: Problem with tty-info records
From: Charlie Conklin <charlie_conklin@il.us.swissbank.com>
Date: Thu, 28 Mar 96 10:23:27 GMT
I seem to be having a problem trying to set terminal characteristics
via set-tty-info/now.

I am trying to set up and manipulate a telnet session using scsh.
Things seem to be working fairly well, except that I get carriage
returns in the telnet output. This is not catastrophic, but is a
bit annoying. Wishing to get rid of them, I have been trying to
set the terminal characteristics for the pty session.

When I set the terminal characteristics, I can no longer seem to
communicate with the pty at all! At first I thought that maybe I
was screwing up the terminal because of the flags I was setting,
so I tried fetching the tty-info input-flags, and the leaving them
unchanged, reseting the terminal characteristics using the original
set. This has the same behavior, and I can no longer fetch anything
from the terminal.

The sequence of events looks something like this...

I use this to fork a telnet session...

(define fork-telnet-session
  (lambda (address port)
    (call-with-values
     (lambda ()
       (fork-pty-session (lambda ()
                           (apply exec-path
                                  `("telnet" ,address ,port)))))
     list)))

I then shove the return values into a record (telnet-session) to
keep track of the proc, ports, etc...

If I then do a read on the input port...
    (read-char (telnet-session:inport session))
I will read characters from the telnet session as expected...

If I then do this...

;; Fetch my ttyinfo for the input-port
(define ttyinfo-in (tty-info (telnet-session:inport session)))

;; Get the input-flags
(define input-flags-in (tty-info:input-flags ttyinfo-in))

;; Play with CR stuff...  (commented out for the moment)
;;(define input-flags-in (bit-set input-flags-in ttyin/cr->nl)) 

;; reset the input-flags of our tty-info record
(set-tty-info:input-flags ttyinfo-in input-flags-in)

;; Set the terminal description...
(set-tty-info/now (telnet-session:inport session) ttyinfo-in)

Now fetching input via
    (read-char (telnet-session:inport session))
will just hang forever...

Writing to the output port seems to have no effect (as far as I can tell) 
either.

Anybody have ideas about how to debug/fix this?  Am I doing something
really silly here?

Thanks for any help...

- Charlie Conklin               conklic@swissbank.com

<Prev in Thread] Current Thread [Next in Thread>