From 2a4ba10e2d68c09ddb2e3f5751f5161c00a13bf5 Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Wed, 15 Oct 1997 18:08:37 +0900 Subject: version 1.0-971015 https://cache.ruby-lang.org/pub/ruby/1.0/ruby-1.0-971015.tar.gz Wed Oct 15 18:08:37 1997 Yukihiro Matsumoto * version 1.0-971015 --- sample/cbreak.rb | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 sample/cbreak.rb (limited to 'sample') diff --git a/sample/cbreak.rb b/sample/cbreak.rb deleted file mode 100644 index cbb15d2f41..0000000000 --- a/sample/cbreak.rb +++ /dev/null @@ -1,36 +0,0 @@ -# ioctl example works on Sun - -CBREAK = 0x00000002 -ECHO = 0x00000008 -TIOCGETP = 0x40067408 -TIOCSETP = 0x80067409 - -def cbreak () - set_cbreak(TRUE) -end - -def cooked () - set_cbreak(FALSE) -end - -def set_cbreak (on) - tty = "\0" * 256 - STDIN.ioctl(TIOCGETP, tty) - ttys = tty.unpack("C4 S") - if on - ttys[4] |= CBREAK - ttys[4] &= ~ECHO - else - ttys[4] &= ~CBREAK - ttys[4] |= ECHO - end - tty = ttys.pack("C4 S") - STDIN.ioctl(TIOCSETP, tty) -end -cbreak(); - -print("this is no-echo line: "); -readline().print -cooked(); -print("this is echo line: "); -readline() -- cgit v1.2.3