Home » Archimedes archive » Acorn User » AU 1995-04.adf » !Internet_StarterPak » !DemConfig/CheckIp
!DemConfig/CheckIp
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 » Archimedes archive » Acorn User » AU 1995-04.adf » !Internet_StarterPak |
Filename: | !DemConfig/CheckIp |
Read OK: | ✔ |
File size: | 0176 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM Check if IP address is valid 20DIM buf% 256 30OSCLI "Set DemConfig$IpValid 0" 40SYS "OS_ReadVarVal","DemConfig$IpAddr",buf%,256,0,0 TO ,,len% 50buf%?len%=13: ip$=$buf%+"." 60FOR i%=1 TO 4 70 dot%=INSTR(ip$,"."): IF dot%=0 END 80 num$=LEFT$(ip$,dot%-1): num%=VAL(num$) 90 IF num%<0 OR num%>255 OR STR$(num%)<>num$ END 100 ip$=MID$(ip$,dot%+1) 110NEXT 120IF ip$<>"" END 130OSCLI "Set DemConfig$IpValid 1"
"� Check if IP address is valid � buf% 256 � "Set DemConfig$IpValid 0" (?ș "OS_ReadVarVal","DemConfig$IpAddr",buf%,256,0,0 � ,,len% 2buf%?len%=13: ip$=$buf%+"." <� i%=1 � 4 F dot%=�ip$,"."): � dot%=0 � P% num$=�ip$,dot%-1): num%=�(num$) Z+ � num%<0 � num%>255 � �(num%)<>num$ � d ip$=�ip$,dot%+1) n� x� ip$<>"" � �� "Set DemConfig$IpValid 1" �
00000000 0d 00 0a 22 f4 20 43 68 65 63 6b 20 69 66 20 49 |...". Check if I| 00000010 50 20 61 64 64 72 65 73 73 20 69 73 20 76 61 6c |P address is val| 00000020 69 64 0d 00 14 0e de 20 62 75 66 25 20 32 35 36 |id..... buf% 256| 00000030 0d 00 1e 1f ff 20 22 53 65 74 20 44 65 6d 43 6f |..... "Set DemCo| 00000040 6e 66 69 67 24 49 70 56 61 6c 69 64 20 30 22 0d |nfig$IpValid 0".| 00000050 00 28 3f c8 99 20 22 4f 53 5f 52 65 61 64 56 61 |.(?.. "OS_ReadVa| 00000060 72 56 61 6c 22 2c 22 44 65 6d 43 6f 6e 66 69 67 |rVal","DemConfig| 00000070 24 49 70 41 64 64 72 22 2c 62 75 66 25 2c 32 35 |$IpAddr",buf%,25| 00000080 36 2c 30 2c 30 20 b8 20 2c 2c 6c 65 6e 25 0d 00 |6,0,0 . ,,len%..| 00000090 32 1f 62 75 66 25 3f 6c 65 6e 25 3d 31 33 3a 20 |2.buf%?len%=13: | 000000a0 69 70 24 3d 24 62 75 66 25 2b 22 2e 22 0d 00 3c |ip$=$buf%+"."..<| 000000b0 0e e3 20 69 25 3d 31 20 b8 20 34 0d 00 46 20 20 |.. i%=1 . 4..F | 000000c0 20 64 6f 74 25 3d a7 69 70 24 2c 22 2e 22 29 3a | dot%=.ip$,"."):| 000000d0 20 e7 20 64 6f 74 25 3d 30 20 e0 0d 00 50 25 20 | . dot%=0 ...P% | 000000e0 20 6e 75 6d 24 3d c0 69 70 24 2c 64 6f 74 25 2d | num$=.ip$,dot%-| 000000f0 31 29 3a 20 6e 75 6d 25 3d bb 28 6e 75 6d 24 29 |1): num%=.(num$)| 00000100 0d 00 5a 2b 20 20 e7 20 6e 75 6d 25 3c 30 20 84 |..Z+ . num%<0 .| 00000110 20 6e 75 6d 25 3e 32 35 35 20 84 20 c3 28 6e 75 | num%>255 . .(nu| 00000120 6d 25 29 3c 3e 6e 75 6d 24 20 e0 0d 00 64 16 20 |m%)<>num$ ...d. | 00000130 20 69 70 24 3d c1 69 70 24 2c 64 6f 74 25 2b 31 | ip$=.ip$,dot%+1| 00000140 29 0d 00 6e 05 ed 0d 00 78 0f e7 20 69 70 24 3c |)..n....x.. ip$<| 00000150 3e 22 22 20 e0 0d 00 82 1f ff 20 22 53 65 74 20 |>"" ...... "Set | 00000160 44 65 6d 43 6f 6e 66 69 67 24 49 70 56 61 6c 69 |DemConfig$IpVali| 00000170 64 20 31 22 0d ff |d 1"..| 00000176