DEFINITIONS
This source file includes following functions.
1 require 'pty'
2
3 if ARGV.size == 0 then
4 ofile = "typescript"
5 else
6 ofile = ARGV[0]
7 end
8
9 logfile = File.open(ofile,"a")
10
11 system "stty -echo raw lnext ^_"
12
13 PTY.spawn("/bin/csh") do
14 |r_pty,w_pty,pid|
15
16 Thread.new do
17 while true
18 w_pty.print STDIN.getc.chr
19 w_pty.flush
20 end
21 end
22
23 begin
24 while true
25 c = r_pty.sysread(512)
26 break if c.nil?
27 print c
28 STDOUT.flush
29 logfile.print c
30 end
31 rescue
32 # print $@,':',$!,"\n"
33 logfile.close
34 end
35 end
36
37 system "stty echo -raw lnext ^v"
38