Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
#lang racket
|
||||
(define-syntax-rule (with-raw body ...)
|
||||
(let ([saved #f])
|
||||
(define (stty x) (system (~a "stty " x)) (void))
|
||||
(dynamic-wind (λ() (set! saved (with-output-to-string (λ() (stty "-g"))))
|
||||
(stty "raw -echo opost"))
|
||||
(λ() body ...)
|
||||
(λ() (stty saved)))))
|
||||
|
||||
(with-raw
|
||||
(printf "Press a key, or not\n")
|
||||
(sleep 2)
|
||||
(if (char-ready?)
|
||||
(printf "You pressed ~a\n" (read-char))
|
||||
(printf "You didn't press a key\n")))
|
||||
Loading…
Add table
Add a link
Reference in a new issue