scsh-users
[Top] [All Lists]

Re: Problem with tty-info records

To: scsh@martigny.ai.mit.edu
Subject: Re: Problem with tty-info records
From: shivers@ai.mit.edu (Olin Shivers)
Date: 28 Mar 1996 23:58:51 -0500
Organization: Artificial Intelligence Lab, MIT
Reply-to: shivers@ai.mit.edu
   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 don't think I'd write 
      (apply exec-path `("telnet" ,address ,port))
This is perhaps a little clearer:
      (exec-path "telnet" address port)
And why force f-t-s to dump its multiple return values into a list?

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

Well, if f-t-s returned f-p-s's multiple values directly, you could write
        (call-with-values (fork-telnet-session address port)
                          make-telnet-session)

   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))

This BIT-SET proc must be something you wrote, I gather. It's not standard
scsh.

   ;; 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.

Works for me. What Unix are you using? NeXTSTEP?
        -Olin

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