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