#lang scheme
(require
 "terminal.ss")

(let ([settings '("sane")])
  (dynamic-wind
   (λ ()
     (set! settings (stty))
     (stty '("cbreak" "-echo")))
   (λ ()
     (parameterize ([current-input-port (current-terminal-input-port)])
       (let loop ()
         (let ([char (read-char)])
           (unless (eof-object? char)
             (printf "char: ~s~%" char)
             (loop))))))
   (λ ()
     (stty settings))))
