10
20 MODE7:VDU23;2,53;0;0;0;23,1;0;0;0;0:*EXEC
30 *FX15
40 DIM name$(20),dir$(20),disk$(20)
50 DIM ctrl%40,data%600,drive$(10),dname$(10):X%=ctrl%:Y%=X%DIV256
60 title%=TRUE:ONERROR title%=FALSE
70 IFtitle%:IFFNfile("!Title",5)=1:IFX%!10<&401:OSCLI"LOAD !Title FFFF7C00" ELSE title%=FALSE
80 ON ERROR IFFNerr END ELSE VDU26,12
90 exit$="":dir%=FNfile("!DirInfo",5)=1:
100 IFdir%:P$="PROGRAMS":p$="program":i$="!DirInfo" ELSE P$="DIRECTORIES":p$="directory":i$="!DiskInfo":*DIR$
110 PROCFindDisks:IFtitle%:FORd%=0 TO disks%:PRINTTAB(8,11+d%*2);d%;": ";dname$(d%);:NEXT:VDU30:IFGET=13:VDU28,4,22,36,21,12:posn%=0:PROClogon
120 CLS:!X%=8:PROCosw(&13,X%):station%=X%?1
130 ii%=5:PRINTCHR$132CHR$157:IFFNfs=5 PRINTCHR$132CHR$157CHR$131"This is ECONET Station ";station%:ii%=6
140 FORd%=1TO2:PRINTCHR$132CHR$157CHR$131CHR$141"The"P$"available are :-":NEXT:PROCReadInfo
150 PRINTCHR$132CHR$157'CHR$132CHR$157TAB(5)CHR$129CHR$157TAB(33)CHR$132CHR$157
160 PROCsort
170 FOR d%=0 TO total%-1:PRINTCHR$132CHR$157CHR$135TAB(5)CHR$129CHR$157CHR$131name$(d%)TAB(33)CHR$132CHR$157:NEXT d%
180 PRINTCHR$132CHR$157TAB(5)CHR$129CHR$157TAB(33)CHR$132CHR$157
190 PRINTCHR$132CHR$157:posn%=total%+10
200 IFtotal%+disks%<10 ANDNOTdir%:PRINTCHR$132CHR$157CHR$135;" The disks on line are:":FOR d%=0 TO disks%:PRINTCHR$132CHR$157CHR$135;" ";d%;": ";dname$(d%):NEXT:PRINTCHR$132CHR$157CHR$135:posn%=posn%+disks%+3
210 PRINTCHR$130CHR$157CHR$132"Select the "p$" you want with":PRINTCHR$130CHR$157CHR$132"the cursor keys, then press SPACE"
220 item%=0:ONERROR IFFNerr2 OSCLI"FX4":END
230 *FX4,1
240 REPEAT:VDU31,0,item%+ii%,130,157,132,9,9,132,157
250 PRINTSTRING$(26,CHR$9);:VDU130,157,13,9,9,9
260 Z$=GET$
270 IF Z$=CHR$138 OR Z$=CHR$139 VDU31,0,item%+ii%,132,157,135,9,9,129,157:PRINTSTRING$(26,CHR$9);:VDU132,157:item%=item%+(Z$=CHR$139)-(Z$=CHR$138):item%=item%AND(item%>0)AND(item%<total%)OR(total%-1AND(item%=total%))
280 IF Z$="*" PROClogon
290 UNTILZ$=" " OR Z$=CHR$13 OR Z$=CHR$135:A$=CHR$(65+item%):*FX4
300 VDU31,0,item%+ii%,132,157,135,9,9,129,157:PRINTSTRING$(26,CHR$9);:VDU132,157
310 PRINTTAB(4,ii%+item%)CHR$136CHR$130CHR$157CHR$132;TAB(33,ii%+item%)CHR$131CHR$157CHR$136CHR$129"<<<"TAB(7,ii%+item%);
320 H$="Hello":dd$=dir$(item%)
330 IFINSTR(dd$,"/")=0 h%=INSTR(dd$,"."):IF h%<>0 REPEAT:H$=MID$(dd$,h%+1):h%=INSTR(dd$,".",h%+1):UNTILh%=0:dd$=LEFT$(dd$,LENdd$-LENH$-1)
340 IFINSTR(dd$,"/") h%=INSTR(dd$,"/"):H$=MID$(dd$,h%+1):dd$=LEFT$(dd$,h%-1)
350 IFdir%:IFINSTR(dir$(item%),".")+INSTR(dir$(item%),"/")=0:H$=dd$:dd$=""
360 IFNOTdir%:dd$=":"+disk$(item%)+"."+dd$
370 IFdd$<>"":OSCLI "DIR "+dd$
380 ON ERROR VDU31,0,posn%:PRINT"No "H$" program":END
390 IFH$="":RUN ELSE CHAINH$
400 :
410 DEFPROClogon:*FX4
420 PRINTTAB(0,23);:INPUTTAB(0,posn%);"User name: "U$:PRINT"Password:";CHR$152;:INPUT""P$
430 ONERRORREPORT:PRINT:END
440 OSCLI"I AM "+U$+" "+P$
450 PRINT:END
460 :
470 DEFPROCsort
480 LOCAL i%,j%,temp$,dist%,i1%
490 IFtotal%<2 ENDPROC
500 l%=total%-1:f%=0:dist%=(l%-f%+1)DIV2
510 REPEAT:FOR j%=f%+dist% TO l%
520 FOR i%=j%-dist% TO f% STEP -dist%
530 i1%=i%+dist%
540 IF name$(i%)>name$(i1%) tmp$=name$(i%):name$(i%)=name$(i1%):name$(i1%)=tmp$:tmp$=disk$(i%):disk$(i%)=disk$(i1%):disk$(i1%)=tmp$:tmp$=dir$(i%):dir$(i%)=dir$(i1%):dir$(i1%)=tmp$
550 NEXT i%,j%:dist%=dist% DIV2
560 UNTIL dist%=0:ENDPROC
570 :
580 DEFFNfile(A$,A%):$data%=A$:?X%=data%:X%?1=data%DIV256:=(USR&FFDD)AND&FF
590 :
600 DEFPROCosw(A%,X%):LOCALY%:Y%=X%DIV256:CALL&FFF1:ENDPROC
610 DEFFNfs:LOCALA%,E%,Y%:=USR&FFDA AND&FF
620 :
630 DEFPROCFindDisks:disks%=0:total%=0:IFdir%:ENDPROC
640 IFFNfs=5:PROCReadNFS ELSE IFFNfs>5:PROCReadHADFS ELSE PROCReadDFS
650 disks%=(disks%-1)AND(disks%>0)
660 ENDPROC
670 :
680 DEFPROCReadNFS:A%=&14:
690 REPEAT:!X%=&E000900:X%!4=0:X%?7=disks%:X%?8=1:CALL &FFF1
700 IFX%?4:X%?22=13:Disk$=$(X%+6):drive$(disks%)=LEFT$(Disk$,INSTR(Disk$," ")-1):dname$(disks%)=drive$(disks%):disks%=disks%+1
710 UNTILX%?4=0:ENDPROC
720 :
730 DEFPROCReadHADFS:FORn%=0 TO 7:
740 IFFNfile(":"+STR$n%,5)=2:drive$(disks%)=STR$n%:OSCLI"DIR :"+STR$n%:dname$(disks%)=FNname:disks%=disks%+1
750 NEXT:ENDPROC
760 :
770 DEFPROCreadDFS:ENDPROC
780 :
790 DEFFNname:X%!1=data%:A%=5:CALL&FFD1:?(data%+1+?data%)=13:=$(data%+1)
800 :
810 DEFPROCReadInfo:FORd%=0TOdisks%:
820 inf$=i$:IFNOTdir%:inf$=":"+drive$(d%)+"."+i$
830 IFFNfile(inf$,5)<>1:name$(total%)=dname$(d%):dir$(total%)="$":disk$(total%)=drive$(d%):total%=total%+1:ENDPROC
840 $data%=STRING$(255,CHR$13):OSCLI"LOAD "+inf$+" "+STR$~data%
850 IF?data%=ASC"$":exit$=$data%:ptr%=data%+1+LEN$data% ELSE ptr%=data%
860 REPEAT:IF?ptr%<32 REPEAT:ptr%=ptr%+1:UNTIL?ptr%>31
870 disk$(total%)=drive$(d%):D$=$ptr%
880 dir$(total%)=LEFT$(D$,INSTR(D$+",",",")-1)
890 name$(total%)=LEFT$(MID$(D$,INSTR(D$+",",",")+1),25)
900 total%=total%+1:ptr%=ptr%+LEND$+1
910 UNTIL?ptr%=13 OR ?ptr%=0 OR total%>10-disks%
920 NEXT:ENDPROC
930 :
940 DEFFNerr:VDU30:REPORT:=INKEY-1 OR(0*INKEY(50))
950 DEFFNerr2:PRINTTAB(0,23);:IF ERR=17 PRINTTAB(0,posn%);SPC(78);TAB(0,24);:IFNOTINKEY-1 ANDexit$<>""::PROCexit:ELSE IFERR=17:=INKEY-1
960 REPORT:IF ERR<128 PRINT" at line ";ERL;" ";:=TRUE
970 z%=INKEY(150):PRINTTAB(0,24);SPC(30);TAB(4,ii%+item%)CHR$32CHR$129CHR$157CHR$131;TAB(37,ii%+item%);" ";
980 =INKEY-1
990 DEFPROCexit:h%=INSTR(exit$,"/"):dd$=MID$(exit$,2,h%-2):H$=MID$(exit$,h%+1):H$=LEFT$(H$,INSTR(H$+",",",")-1)
1000 OSCLI"FX4":OSCLI"DIR "+dd$:IFH$="":RUN ELSE CHAINH$