retroforth/interfaces/io/gopher.forth
crc c74f8b4e0d io_ prefix removed from filenames
FossilOrigin-Name: 0a0333f7d045045b323e2b3ef22cfa68c147fe4e7da822198edad3471bfbb6d7
2019-03-27 19:12:44 +00:00

27 lines
407 B
Forth

# Gopher
RETRO has Gopher support via `gopher:get`.
Takes:
destination
server name
port
selector
Returns:
number of characters read
~~~
{{
'io:Gopher var
:identify
@io:Gopher n:zero? [
#5 io:scan-for dup n:negative?
[ drop 'IO_DEVICE_TYPE_0005_NOT_FOUND s:put nl ]
[ !io:Gopher ] choose ] if ;
---reveal---
:gopher:get identify #0 @io:Gopher io:invoke ;
}}
~~~