Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
05e8823d
Commit
05e8823d
authored
Nov 01, 1993
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restructured main loop. Etc.
parent
144ffc81
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
161 additions
and
174 deletions
+161
-174
Demo/cwilib/cwilib.py
Demo/cwilib/cwilib.py
+161
-174
No files found.
Demo/cwilib/cwilib.py
View file @
05e8823d
...
...
@@ -15,19 +15,16 @@ def main():
vt
=
vt100win
.
VT100win
()
#
host
=
'biefstuk.cwi.nl'
port
=
0
timeout
=
10.0
tn
=
telnetlib
.
Telnet
(
host
,
port
)
tn
.
set_timeout
(
timeout
)
tn
=
telnetlib
.
Telnet
(
host
,
0
)
#
try
:
vt
.
send
(
tn
.
read_until
(
'login: '
))
vt
.
send
(
tn
.
read_until
(
'login: '
,
10
))
tn
.
write
(
'cwilib
\
r
'
)
#
vt
.
send
(
tn
.
read_until
(
'Hit <RETURN> to continue...'
))
vt
.
send
(
tn
.
read_until
(
'Hit <RETURN> to continue...'
,
10
))
tn
.
write
(
'
\
r
'
)
#
vt
.
send
(
tn
.
read_until
(
'QUIT'
))
vt
.
send
(
tn
.
read_until
(
'QUIT'
,
20
))
except
EOFError
:
sys
.
stderr
.
write
(
'Connection closed prematurely
\
n
'
)
sys
.
exit
(
1
)
...
...
@@ -35,20 +32,26 @@ def main():
define_screens
(
vt
)
matches
=
vt
.
which_screens
()
if
'menu'
not
in
matches
:
sys
.
stderr
.
write
(
'No main menu within %g seconds
\
n
'
%
timeout
)
sys
.
stderr
.
write
(
'Main menu does not appear
\
n
'
)
sys
.
exit
(
1
)
#
tn
.
set_timeout
(
0
)
tn
.
write
(
'
\
r
\
r
'
)
vt
.
open
(
'Progress -- CWI Library'
)
vt
.
set_debuglevel
(
0
)
ui
=
UserInterface
()
#
while
1
:
try
:
data
=
tn
.
read_very_eager
()
except
EOFError
:
stdwin
.
message
(
'Connection closed--goodbye'
)
break
if
data
:
print
'send...'
vt
.
send
(
data
)
print
'send...done'
continue
event
=
stdwin
.
pollevent
()
if
not
event
:
rfd
,
wfd
,
xfd
=
select
.
select
([
stdwin
,
tn
],
[],
[])
if
stdwin
in
rfd
:
event
=
stdwin
.
getevent
()
if
event
:
type
,
window
,
detail
=
event
if
window
==
None
and
type
==
WE_LOST_SEL
:
...
...
@@ -88,24 +91,8 @@ def main():
print
'*** VT100 event:'
,
type
,
detail
else
:
print
'*** Alien event:'
,
type
,
window
,
detail
elif
tn
in
rfd
:
vt
.
window
.
setwincursor
(
'watch'
)
try
:
data
=
tn
.
read_now
()
except
EOFError
:
stdwin
.
message
(
'Connection closed--goodbye'
)
break
print
'send...'
vt
.
send
(
data
)
print
'send...done'
vt
.
window
.
setwincursor
(
'arrow'
)
matches
=
vt
.
which_screens
()
if
'timelimit'
in
matches
:
stdwin
.
message
(
'Time limit--goodbye'
)
break
print
'*** Matches:'
,
matches
else
:
print
'*** Weird return from select:'
,
rfd
,
wfd
,
xfd
continue
rfd
,
wfd
,
xfd
=
select
.
select
([
tn
,
stdwin
],
[],
[])
# Subroutine to define our screen recognition patterns
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment