diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-03-07 16:40:18 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-03-07 16:40:18 (GMT) |
commit | 3b0a5cdb233c7b1ada69e39556b12c59ea389d1d (patch) | |
tree | 4825b2dd54e4426c7feaab95932c544619b261e2 /Mac/Lib | |
parent | 6c4f003202bade83791c754cd94e28c1c2fb10fa (diff) | |
download | cpython-3b0a5cdb233c7b1ada69e39556b12c59ea389d1d.zip cpython-3b0a5cdb233c7b1ada69e39556b12c59ea389d1d.tar.gz cpython-3b0a5cdb233c7b1ada69e39556b12c59ea389d1d.tar.bz2 |
Initial revision
Diffstat (limited to 'Mac/Lib')
-rw-r--r-- | Mac/Lib/test/ctbtest.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Mac/Lib/test/ctbtest.py b/Mac/Lib/test/ctbtest.py new file mode 100644 index 0000000..d6847d3 --- /dev/null +++ b/Mac/Lib/test/ctbtest.py @@ -0,0 +1,41 @@ +# +# Simple test program for ctb module: emulate a terminal. +# +import ctb +import macconsole +import sys + +def cb(err): + print 'Done, err=', err + +def main(): + if not ctb.available(): + print 'Communications Toolbox not available' + sys.exit(1) +# c = macconsole.copen('Terminal window') + print 'Minimal terminal emulator V1.0' + print '(type @ to exit)' + print + c = macconsole.fopen(sys.stdin) + f = sys.stdin + c.setmode(macconsole.C_RAW) + + l = ctb.CMNew('Serial Tool', None) + l.Open(0) + + while 1: + l.Idle() + d = f.read(1) + if d == '@': + break + if d: + l.Write(d, ctb.cmData, -1, 0) + l.Idle() + d, dummy = l.Read(1000, ctb.cmData, 0) + if d: + f.write(d) + f.flush() + l.Close(-1, 1) + del l + +main()
\ No newline at end of file |