Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199508.adf » !Internet » StarterPak/!Newsbase/Transports/ka9q/sethost

StarterPak/!Newsbase/Transports/ka9q/sethost

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199508.adf » !Internet
Filename: StarterPak/!Newsbase/Transports/ka9q/sethost
Read OK:
File size: 04F6 bytes
Load address: 0000
Exec address: 0000
File contents
   10DIM buf% 1024
   20ON ERROR PRINTREPORT$;" at ";ERL:END
   30d1$="<TCPIP$Dir>"
   40in%=0
   50SYS"XOS_File",17,d1$TOt%;F%
   60IFt%=0OR(F%AND1)<>0 PROCexit("!TCPIP not found")
   70host$="":dom$="":ip$=""
   80C%=OPENIN(d1$+".autoexec")
   90IFC%<>0THEN
  100  REPEATa$=GET$#C%
  110  a$=FNlower(a$)
  120  IFhost$=""ANDLEFT$(a$,8)="hostname" host$=FNend(a$)
  130  IFip$=""ANDLEFT$(a$,2)="ip"ANDINSTR(a$,"addr")>0 THEN
  140    l%=INSTR(a$,"["):l2%=INSTR(a$,"]",l%)
  150    IFl%>0ANDl2%>l%THENip$=MID$(a$,l%+1,l2%-l%-1)
  160  ENDIF
  170  IFdom$=""ANDLEFT$(a$,6)="domain"ANDINSTR(a$,"suffix")>0 dom$=FNend(a$)
  180  UNTILEOF#C%:CLOSE#C%
  190ENDIF
  200C%=OPENIN(d1$+".config")
  210IFC%<>0THEN
  220  REPEATa$=GET$#C%
  230  a$=FNlower(a$)
  240  IFhost$=""ANDLEFT$(a$,8)="hostname" host$=FNend(a$)
  250  IFip$=""ANDLEFT$(a$,2)="ip"ANDINSTR(a$,"addr")>0 THEN
  260    l%=INSTR(a$,"["):l2%=INSTR(a$,"]",l%)
  270    IFl%>0ANDl2%>l%THENip$=MID$(a$,l%+1,l2%-l%-1)
  280  ENDIF
  290  IFdom$=""ANDLEFT$(a$,6)="domain"ANDINSTR(a$,"suffix")>0 dom$=FNend(a$)
  300  UNTILEOF#C%:CLOSE#C%
  310ENDIF
  320h$=ip$
  330IFhost$>""THEN
  340  h$=host$:IFINSTR(h$,".")=0THENh$=host$+"."+dom$
  350ENDIF
  360SYS"OS_CLI","set NewsBase$ReturnInfo "+h$
  370SYS"OS_CLI","set NewsBase$ReturnCode 0"
  380END
  390
  400DEFFNend(a$)
  410l%=LENa$
  420REPEATl%=l%-1:UNTILMID$(a$,l%,1)=" "ORl%<=1
  430=MID$(a$,l%+1)
  440
  450DEFFNlower(A$)
  460LOCALB$,L%,C%:B$=""
  470FORL%=1TOLENA$:C%=ASC(MID$(A$,L%,1))
  480IFC%>64ANDC%<91 THENC%=C%+32
  490B$+=CHR$C%
  500NEXT:=B$
  510
  520DEFPROCexit(n%,a$)
  530OSCLI("set NewsBase$ReturnCode "+STR$n%)
  540OSCLI("set NewsBase$ReturnInfo "+a$)
  550END
  560

� buf% 1024
� � �$;" at ";�:�
d1$="<TCPIP$Dir>"
(	in%=0
2ș"XOS_File",17,d1$�t%;F%
<-�t%=0�(F%�1)<>0 �exit("!TCPIP not found")
Fhost$="":dom$="":ip$=""
PC%=�(d1$+".autoexec")
Z�C%<>0�
d  �a$=�#C%
n  a$=�lower(a$)
x0  �host$=""��a$,8)="hostname" host$=�end(a$)
�)  �ip$=""��a$,2)="ip"��a$,"addr")>0 �
�#    l%=�a$,"["):l2%=�a$,"]",l%)
�+    �l%>0�l2%>l%�ip$=�a$,l%+1,l2%-l%-1)
�  �
�<  �dom$=""��a$,6)="domain"��a$,"suffix")>0 dom$=�end(a$)
�  ��#C%:�#C%
��
�C%=�(d1$+".config")
��C%<>0�
�  �a$=�#C%
�  a$=�lower(a$)
�0  �host$=""��a$,8)="hostname" host$=�end(a$)
�)  �ip$=""��a$,2)="ip"��a$,"addr")>0 �
#    l%=�a$,"["):l2%=�a$,"]",l%)
+    �l%>0�l2%>l%�ip$=�a$,l%+1,l2%-l%-1)
  �
"<  �dom$=""��a$,6)="domain"��a$,"suffix")>0 dom$=�end(a$)
,  ��#C%:�#C%
6�
@
h$=ip$
J�host$>""�
T,  h$=host$:�h$,".")=0�h$=host$+"."+dom$
^�
h,ș"OS_CLI","set NewsBase$ReturnInfo "+h$
r*ș"OS_CLI","set NewsBase$ReturnCode 0"
|�
�
�
ݤend(a$)
�
l%=�a$
�!�l%=l%-1:��a$,l%,1)=" "�l%<=1
�=�a$,l%+1)
�
�ݤlower(A$)
��B$,L%,C%:B$=""
��L%=1��A$:C%=�(�A$,L%,1))
��C%>64�C%<91 �C%=C%+32
�B$+=�C%
�	�:=B$
�
��exit(n%,a$)
%�("set NewsBase$ReturnCode "+�n%)
$�("set NewsBase$ReturnInfo "+a$)
&�
0
�
00000000  0d 00 0a 0f de 20 62 75  66 25 20 31 30 32 34 0d  |..... buf% 1024.|
00000010  00 14 16 ee 20 85 20 f1  f6 24 3b 22 20 61 74 20  |.... . ..$;" at |
00000020  22 3b 9e 3a e0 0d 00 1e  15 64 31 24 3d 22 3c 54  |";.:.....d1$="<T|
00000030  43 50 49 50 24 44 69 72  3e 22 0d 00 28 09 69 6e  |CPIP$Dir>"..(.in|
00000040  25 3d 30 0d 00 32 1d c8  99 22 58 4f 53 5f 46 69  |%=0..2..."XOS_Fi|
00000050  6c 65 22 2c 31 37 2c 64  31 24 b8 74 25 3b 46 25  |le",17,d1$.t%;F%|
00000060  0d 00 3c 2d e7 74 25 3d  30 84 28 46 25 80 31 29  |..<-.t%=0.(F%.1)|
00000070  3c 3e 30 20 f2 65 78 69  74 28 22 21 54 43 50 49  |<>0 .exit("!TCPI|
00000080  50 20 6e 6f 74 20 66 6f  75 6e 64 22 29 0d 00 46  |P not found")..F|
00000090  1b 68 6f 73 74 24 3d 22  22 3a 64 6f 6d 24 3d 22  |.host$="":dom$="|
000000a0  22 3a 69 70 24 3d 22 22  0d 00 50 19 43 25 3d 8e  |":ip$=""..P.C%=.|
000000b0  28 64 31 24 2b 22 2e 61  75 74 6f 65 78 65 63 22  |(d1$+".autoexec"|
000000c0  29 0d 00 5a 0b e7 43 25  3c 3e 30 8c 0d 00 64 0e  |)..Z..C%<>0...d.|
000000d0  20 20 f5 61 24 3d be 23  43 25 0d 00 6e 13 20 20  |  .a$=.#C%..n.  |
000000e0  61 24 3d a4 6c 6f 77 65  72 28 61 24 29 0d 00 78  |a$=.lower(a$)..x|
000000f0  30 20 20 e7 68 6f 73 74  24 3d 22 22 80 c0 61 24  |0  .host$=""..a$|
00000100  2c 38 29 3d 22 68 6f 73  74 6e 61 6d 65 22 20 68  |,8)="hostname" h|
00000110  6f 73 74 24 3d a4 65 6e  64 28 61 24 29 0d 00 82  |ost$=.end(a$)...|
00000120  29 20 20 e7 69 70 24 3d  22 22 80 c0 61 24 2c 32  |)  .ip$=""..a$,2|
00000130  29 3d 22 69 70 22 80 a7  61 24 2c 22 61 64 64 72  |)="ip"..a$,"addr|
00000140  22 29 3e 30 20 8c 0d 00  8c 23 20 20 20 20 6c 25  |")>0 ....#    l%|
00000150  3d a7 61 24 2c 22 5b 22  29 3a 6c 32 25 3d a7 61  |=.a$,"["):l2%=.a|
00000160  24 2c 22 5d 22 2c 6c 25  29 0d 00 96 2b 20 20 20  |$,"]",l%)...+   |
00000170  20 e7 6c 25 3e 30 80 6c  32 25 3e 6c 25 8c 69 70  | .l%>0.l2%>l%.ip|
00000180  24 3d c1 61 24 2c 6c 25  2b 31 2c 6c 32 25 2d 6c  |$=.a$,l%+1,l2%-l|
00000190  25 2d 31 29 0d 00 a0 07  20 20 cd 0d 00 aa 3c 20  |%-1)....  ....< |
000001a0  20 e7 64 6f 6d 24 3d 22  22 80 c0 61 24 2c 36 29  | .dom$=""..a$,6)|
000001b0  3d 22 64 6f 6d 61 69 6e  22 80 a7 61 24 2c 22 73  |="domain"..a$,"s|
000001c0  75 66 66 69 78 22 29 3e  30 20 64 6f 6d 24 3d a4  |uffix")>0 dom$=.|
000001d0  65 6e 64 28 61 24 29 0d  00 b4 10 20 20 fd c5 23  |end(a$)....  ..#|
000001e0  43 25 3a d9 23 43 25 0d  00 be 05 cd 0d 00 c8 17  |C%:.#C%.........|
000001f0  43 25 3d 8e 28 64 31 24  2b 22 2e 63 6f 6e 66 69  |C%=.(d1$+".confi|
00000200  67 22 29 0d 00 d2 0b e7  43 25 3c 3e 30 8c 0d 00  |g").....C%<>0...|
00000210  dc 0e 20 20 f5 61 24 3d  be 23 43 25 0d 00 e6 13  |..  .a$=.#C%....|
00000220  20 20 61 24 3d a4 6c 6f  77 65 72 28 61 24 29 0d  |  a$=.lower(a$).|
00000230  00 f0 30 20 20 e7 68 6f  73 74 24 3d 22 22 80 c0  |..0  .host$=""..|
00000240  61 24 2c 38 29 3d 22 68  6f 73 74 6e 61 6d 65 22  |a$,8)="hostname"|
00000250  20 68 6f 73 74 24 3d a4  65 6e 64 28 61 24 29 0d  | host$=.end(a$).|
00000260  00 fa 29 20 20 e7 69 70  24 3d 22 22 80 c0 61 24  |..)  .ip$=""..a$|
00000270  2c 32 29 3d 22 69 70 22  80 a7 61 24 2c 22 61 64  |,2)="ip"..a$,"ad|
00000280  64 72 22 29 3e 30 20 8c  0d 01 04 23 20 20 20 20  |dr")>0 ....#    |
00000290  6c 25 3d a7 61 24 2c 22  5b 22 29 3a 6c 32 25 3d  |l%=.a$,"["):l2%=|
000002a0  a7 61 24 2c 22 5d 22 2c  6c 25 29 0d 01 0e 2b 20  |.a$,"]",l%)...+ |
000002b0  20 20 20 e7 6c 25 3e 30  80 6c 32 25 3e 6c 25 8c  |   .l%>0.l2%>l%.|
000002c0  69 70 24 3d c1 61 24 2c  6c 25 2b 31 2c 6c 32 25  |ip$=.a$,l%+1,l2%|
000002d0  2d 6c 25 2d 31 29 0d 01  18 07 20 20 cd 0d 01 22  |-l%-1)....  ..."|
000002e0  3c 20 20 e7 64 6f 6d 24  3d 22 22 80 c0 61 24 2c  |<  .dom$=""..a$,|
000002f0  36 29 3d 22 64 6f 6d 61  69 6e 22 80 a7 61 24 2c  |6)="domain"..a$,|
00000300  22 73 75 66 66 69 78 22  29 3e 30 20 64 6f 6d 24  |"suffix")>0 dom$|
00000310  3d a4 65 6e 64 28 61 24  29 0d 01 2c 10 20 20 fd  |=.end(a$)..,.  .|
00000320  c5 23 43 25 3a d9 23 43  25 0d 01 36 05 cd 0d 01  |.#C%:.#C%..6....|
00000330  40 0a 68 24 3d 69 70 24  0d 01 4a 0e e7 68 6f 73  |@.h$=ip$..J..hos|
00000340  74 24 3e 22 22 8c 0d 01  54 2c 20 20 68 24 3d 68  |t$>""...T,  h$=h|
00000350  6f 73 74 24 3a e7 a7 68  24 2c 22 2e 22 29 3d 30  |ost$:..h$,".")=0|
00000360  8c 68 24 3d 68 6f 73 74  24 2b 22 2e 22 2b 64 6f  |.h$=host$+"."+do|
00000370  6d 24 0d 01 5e 05 cd 0d  01 68 2c c8 99 22 4f 53  |m$..^....h,.."OS|
00000380  5f 43 4c 49 22 2c 22 73  65 74 20 4e 65 77 73 42  |_CLI","set NewsB|
00000390  61 73 65 24 52 65 74 75  72 6e 49 6e 66 6f 20 22  |ase$ReturnInfo "|
000003a0  2b 68 24 0d 01 72 2a c8  99 22 4f 53 5f 43 4c 49  |+h$..r*.."OS_CLI|
000003b0  22 2c 22 73 65 74 20 4e  65 77 73 42 61 73 65 24  |","set NewsBase$|
000003c0  52 65 74 75 72 6e 43 6f  64 65 20 30 22 0d 01 7c  |ReturnCode 0"..||
000003d0  05 e0 0d 01 86 04 0d 01  90 0d dd a4 65 6e 64 28  |............end(|
000003e0  61 24 29 0d 01 9a 0a 6c  25 3d a9 61 24 0d 01 a4  |a$)....l%=.a$...|
000003f0  21 f5 6c 25 3d 6c 25 2d  31 3a fd c1 61 24 2c 6c  |!.l%=l%-1:..a$,l|
00000400  25 2c 31 29 3d 22 20 22  84 6c 25 3c 3d 31 0d 01  |%,1)=" ".l%<=1..|
00000410  ae 0e 3d c1 61 24 2c 6c  25 2b 31 29 0d 01 b8 04  |..=.a$,l%+1)....|
00000420  0d 01 c2 0f dd a4 6c 6f  77 65 72 28 41 24 29 0d  |......lower(A$).|
00000430  01 cc 13 ea 42 24 2c 4c  25 2c 43 25 3a 42 24 3d  |....B$,L%,C%:B$=|
00000440  22 22 0d 01 d6 1d e3 4c  25 3d 31 b8 a9 41 24 3a  |"".....L%=1..A$:|
00000450  43 25 3d 97 28 c1 41 24  2c 4c 25 2c 31 29 29 0d  |C%=.(.A$,L%,1)).|
00000460  01 e0 1a e7 43 25 3e 36  34 80 43 25 3c 39 31 20  |....C%>64.C%<91 |
00000470  8c 43 25 3d 43 25 2b 33  32 0d 01 ea 0b 42 24 2b  |.C%=C%+32....B$+|
00000480  3d bd 43 25 0d 01 f4 09  ed 3a 3d 42 24 0d 01 fe  |=.C%.....:=B$...|
00000490  04 0d 02 08 11 dd f2 65  78 69 74 28 6e 25 2c 61  |.......exit(n%,a|
000004a0  24 29 0d 02 12 25 ff 28  22 73 65 74 20 4e 65 77  |$)...%.("set New|
000004b0  73 42 61 73 65 24 52 65  74 75 72 6e 43 6f 64 65  |sBase$ReturnCode|
000004c0  20 22 2b c3 6e 25 29 0d  02 1c 24 ff 28 22 73 65  | "+.n%)...$.("se|
000004d0  74 20 4e 65 77 73 42 61  73 65 24 52 65 74 75 72  |t NewsBase$Retur|
000004e0  6e 49 6e 66 6f 20 22 2b  61 24 29 0d 02 26 05 e0  |nInfo "+a$)..&..|
000004f0  0d 02 30 04 0d ff                                 |..0...|
000004f6