• Home
  • Raw
  • Download

Lines Matching +full:write +full:- +full:host

5 # Usage: gopher [ [selector] host [port] ]
12 # Default selector, host and port
36 # Oft-used characters and strings
40 # Open a TCP connection to a given host and port
41 def open_socket(host, port): argument
47 s.connect((host, port))
50 # Send a selector to a given host and port, return a file with the reply
51 def send_request(selector, host, port): argument
52 s = open_socket(host, port)
58 def get_menu(selector, host, port): argument
59 f = send_request(selector, host, port)
66 if line[-2:] == CRLF:
67 line = line[:-2]
68 elif line[-1:] in CRLF:
69 line = line[:-1]
88 def get_textfile(selector, host, port): argument
90 get_alt_textfile(selector, host, port, list.append)
94 def get_alt_textfile(selector, host, port, func): argument
95 f = send_request(selector, host, port)
101 if line[-2:] == CRLF:
102 line = line[:-2]
103 elif line[-1:] in CRLF:
104 line = line[:-1]
113 def get_binary(selector, host, port): argument
114 f = send_request(selector, host, port)
120 def get_alt_binary(selector, host, port, func, blocksize): argument
121 f = send_request(selector, host, port)
133 host = DEF_HOST
139 host = args[1]
145 browse_menu(selector, host, port)
153 def browse_menu(selector, host, port): argument
154 list = get_menu(selector, host, port)
156 print '----- MENU -----'
158 print 'Host:', host, ' Port:', port
186 item = list[choice-1]
199 def browse_textfile(selector, host, port): argument
202 p = os.popen('${PAGER-more}', 'w')
204 get_alt_textfile(selector, host, port, x.writeln)
214 get_alt_textfile(selector, host, port, x.writeln)
221 def browse_search(selector, host, port): argument
223 print '----- SEARCH -----'
225 print 'Host:', host, ' Port:', port
238 browse_menu(selector + TAB + query, host, port)
240 # "Browse" telnet-based information, i.e. open a telnet session
241 def browse_telnet(selector, host, port): argument
246 sts = os.system('set -x; exec telnet ' + host + ' ' + port)
251 def browse_binary(selector, host, port): argument
256 get_alt_binary(selector, host, port, x.write, 8*1024)
260 def browse_sound(selector, host, port): argument
261 browse_binary(selector, host, port)
274 self.f.write(line + '\n')
284 def write(self, data): member in SaveWithProgress
285 sys.stdout.write('#')
287 self.f.write(data)
327 print 'usage: gopher [ [selector] host [port] ]'
335 host = sys.argv[1]
338 host = sys.argv[2]
340 browser(selector, host, port)