1000 ! * RMDIR.BAC 1005 INTEGER : EXTEND 1010 ; '** Remove directory **' 1020 ; ' Ver X.02, 1985-02-15' 1030 ; ' Copyright 1985 Dataindustrier AB' 1040 ; 1050 ! * Written by G|ran Nordenborg 1060 ! ** ** ** ** ** ** ** ** ** ** ** 1070 ! * 1080 ! * Ver date / Ver nb / Sign / Note 1090 ! * 85-01-28 / X.00 / GN / Main 1100 ! * 85-02-15 / X.01 / BL / Accessible from DOS, FNStartpar$ handling 1110 ! * 85-02-15 / X.02 / BL / Talknet checks if Lux-net 1120 ! * 1130 ! ** ** ** ** ** ** ** ** ** ** ** 1140 ! * 1150 ! EJECT 1160 ! ******************************** 1170 ! * 1180 ! * Main routine 1190 ! * 1200 IF FNRmdir THEN ; 'RMDIR abort' 1210 ; FNExit 1220 ! EJECT 1230 ! ******************************* 1240 ! * 1250 ! * Remove directory 1260 ! * 1270 DEF FNRmdir 1280 IF FNInitialize THEN RETURN T 1290 Cmd$=FNStartpar$ : IF LEN(Cmd$)=0 INPUT 'Command: 'Cmd$ 1300 IF FNCmdscan(Cmd$) THEN RETURN T 1310 IF INSTR(1,Option$,'?') THEN RETURN FNHelp 1320 Lft=FNOpen(Selfile$+'.Ufd',Lus) 1330 IF Lft=T THEN RETURN T 1340 POSIT #Lus,239-3 1350 GET #Lus Dirmap$ COUNT 16 1360 IF Dirmap$<>STRING$(16,0) THEN ; 'Directory ''' Selfile$ ''' is not empty' : RETURN T 1370 Chopcode$=CHR$(6,Lft,195,36,96) ! LI b,lft/JMP CHOP. 1380 Error=CALL(VARPTR(Chopcode$),-1) ! CHOP file 1390 IF Error THEN ; 'Error' Error 'during chop of file' : RETURN T 1400 CLOSE Lus 1410 RETURN F 1420 FNEND 1430 ! ******************************** 1440 ! * 1450 ! * All initialisations 1460 ! * 1470 DEF FNInitialize 1480 F=0 1490 T=NOT F 1500 Dosbuff$=' ' 1510 POKE VAROOT(Dosbuff$),0,1,0,245,0,1 1520 Lus=1 1530 Lud=Lus+1 1540 OPEN 'CON:' AS FILE Lud 1550 RETURN F 1560 FNEND 1570 ! ****************************** 1580 ! * 1590 ! * Help texts 1600 ! * 1610 DEF FNHelp 1620 ; #Lud 'RMDIR will remove an existing directory. Before remove, RMDIR' 1630 ; #Lud 'will check that directory is empty. Command syntax is ' 1640 ; #Lud '''DIRECTORY -OPTION''. The only option is ''?''.' 1650 RETURN F 1660 FNEND 1670 ! ***************************** 1680 ! * 1690 ! * Open long file name 1700 ! * 1710 ! * At exit : If error, exit T else exit LFT-number 1720 ! * 1730 DEF FNOpen(Fdp$,Luo) LOCAL Fpnt,Error,Opencode$=11,Fd$=256 1740 Fd$=Fdp$+CHR$(13) 1750 IF INSTR(1,Fd$,':')=0 THEN Devnr=255 ELSE IF FNDevnamenr(LEFT$(Fd$,INSTR(1,Fd$,':')-1)) THEN RETURN T ELSE Fd$=RIGHT$(Fd$,INSTR(1,Fd$,':')+1) 1760 OPEN 'DR2:' AS FILE Luo 1770 Fpnt=PEEK2(65344) 1780 WHILE PEEK(Fpnt+2)<>Luo 1790 Fpnt=PEEK2(Fpnt) 1800 WEND 1810 Opencode$=CHR$(1,Devnr,PEEK(Fpnt+21),205,24,96,208,192,46,21,201) ! LDI BC,Lft:Devnr/CALL OPEN./RNC/RNZ/LI L,21/RET 1820 Error=CALL(VARPTR(Opencode$),VARPTR(Fd$)) 1830 IF Error THEN CLOSE Luo : ; 'Error' Error 'during open of ''' Fdp$ '''' : RETURN T 1840 RETURN PEEK(Fpnt+21) 1850 FNEND 1860 ! ****************************************** 1870 ! * 1880 ! * Convert device name to number 1890 ! * 1900 DEF FNDevnamenr(Devname$) 1910 Devpnt=PEEK2(-133) 1920 WHILE FNGetdev=F 1930 IF Dev$=Devname$ THEN Devnr=Devnumber : RETURN F 1940 WEND 1950 ; 'Can''t find device ''' Devname$ '''' 1960 RETURN T 1970 FNEND 1980 ! ******************************** 1990 ! * 2000 ! * Get next device 2010 ! * 2020 DEF FNGetdev 2030 IF Devpnt=0 THEN RETURN T 2040 Dev$=CHR$(PEEK(Devpnt+2),PEEK(Devpnt+3),PEEK(Devpnt+4)) 2050 Devhandler=PEEK2(Devpnt+5) 2060 Devnumber=PEEK(Devpnt+7) 2070 Devpnt=PEEK2(Devpnt) 2080 RETURN F 2090 FNEND 2100 ! ************************************** 2110 ! * 2120 ! * Make string block letters 2130 ! * 2140 DEF FNCapstr$(Str$) 2150 FOR Strpnt=1 TO LEN(Str$) 2160 IF MID$(Str$,Strpnt,1)>=CHR$(97) THEN MID$(Str$,Strpnt,1)=CHR$(ASCII(MID$(Str$,Strpnt,1)) AND 223) 2170 NEXT Strpnt 2180 RETURN Str$ 2190 FNEND 2200 ! ******************************** 2210 ! * 2220 ! * Do communication with net central. 2230 ! * 2240 DEF FNTalknet(Fc,Sfc,B,C,D,E) LOCAL Z,Error 2250 IF PEEK(PEEK2(24616))=201 RETURN -1 ! This is not a Lux-net!!! 2260 POKE 64961,Fc ! FC -> MSG.FC (Function code). 2270 POKE 64962,Sfc ! SFC -> MSG.SFC (Subfunction code). 2280 POKE 64963,C,B ! MSG.PDN, MSG.ERRB (BC register to/from central). 2290 POKE 64965,E,D ! Register DE to/from central. 2300 POKE 64798,255 ! TFT fake => BSAVE. 2310 Z=CALL(24615) ! DCWAI. => Talk to the central. 2320 Error=PEEK(64962) 2330 IF Error>128 THEN Error=Error-128+35 2340 IF Error THEN ; 'Net error' Error : RETURN T 2350 RETURN F 2360 FNEND 2370 ! * CMDSCAN.BAC 2380 ! '** Command handler **' 2390 ! ' Ver X.00, 1984-08-09' 2400 ! ' Copyright 1984 Dataindustrier AB' 2410 ! 2420 ! * Written by G|ran Nordenborg 2430 ! ** ** ** ** ** ** ** ** ** ** ** 2440 ! * 2450 ! * Ver date / Ver nb / Sign / Note 2460 ! * 84-08-09 / X.00 / GN / Main 2470 ! * 2480 ! ** ** ** ** ** ** ** ** ** ** ** 2490 ! * 2500 ! EJECT 2510 ! ******************************** 2520 ! * 2530 ! * Main routine 2540 ! * 2550 DEF FNCmdscan(Str$) LOCAL Error 2560 Error=0 2570 Infile$='CON:' 2580 Outfile$='CON:' 2590 FOR Pnt=1 TO LEN(Str$) 2600 IF MID$(Str$,Pnt,1)>=CHR$(97) THEN MID$(Str$,Pnt,1)=CHR$(ASCII(MID$(Str$,Pnt,1)) AND 223) 2610 NEXT Pnt 2620 FOR Pnt=1 TO LEN(Str$) 2630 ON INSTR(1,' ,<>-',MID$(Str$,Pnt,1))+1 GOSUB 2670,2720,2720,2770,2910,3050 2640 NEXT Pnt 2650 GOSUB 2720 2660 RETURN Error 2670 ! * 2680 ! * No special but ascii character cound 2690 ! * 2700 File$=File$+MID$(Str$,Pnt,1) 2710 RETURN 2720 ! * 2730 ! * ' ' found 2740 ! * 2750 IF Termcont=0 THEN IF File$='' THEN RETURN ELSE Selfile$=File$ : File$='' : RETURN 2760 ON Termcont GOSUB 2830,2970,3100 2770 ! * 2780 ! * '<' found. Infile descriptor 2790 ! * 2800 File$='' 2810 Termcont=1 2820 RETURN 2830 ! * 2840 ! * '<' termination 2850 ! * 2860 IF Infile$<>'CON:' THEN Error=3 : RETURN 2870 Infile$=File$ 2880 File$='' 2890 Termcont=0 2900 RETURN 2910 ! * 2920 ! * '>' found. Out file descriptor 2930 ! * 2940 File$='' 2950 Termcont=2 2960 RETURN 2970 ! * 2980 ! * '>' termination 2990 ! * 3000 IF Outfile$<>'CON:' THEN Error=4 : RETURN 3010 Outfile$=File$ 3020 File$='' 3030 Termcont=0 3040 RETURN 3050 ! * 3060 ! * '-' found. Option descriptor 3070 ! * 3080 Termcont=3 3090 RETURN 3100 ! * 3110 ! * '-' termination 3120 ! * 3130 Option$=Option$+File$ 3140 File$='' 3150 Termcont=0 3160 RETURN 3170 FNEND 3180 DEF FNP 3190 FOR I=1 TO LEN(Dirmap$) 3200 ; ASCII(MID$(Dirmap$,I,1)); 3210 NEXT I 3220 RETURN F 3230 FNEND 3240 ! 3250 ! ********************************* 3260 ! * 3270 ! * Check if user entered from DOS or BASIC 3280 ! * 3290 DEF FNChkdos LOCAL I 3300 I=PEEK2(65302)-160 3310 WHILE I<160 : IF PEEK2(I)=-212 RETURN -1 3320 IF PEEK(I)<>13 I=I+1 : WEND 3330 RETURN 0 3340 FNEND 3350 ! 3360 ! ********************************** 3370 ! * 3380 ! * Get start parameter string (if any) 3390 ! * 3400 DEF FNStartpar$ LOCAL Cmdsp,I,Cmd$=160 3410 Cmdsp=PEEK2(65302)-160 3420 WHILE I<160 : I=I+1 : IF PEEK(Cmdsp+I-1)=44 GOTO 3450 3430 IF PEEK(Cmdsp+I-1)=13 RETURN '' ! No startpar string 3440 WEND : RETURN '' ! No startpar string 3450 IF PEEK(Cmdsp+I)=255 I=I+1 ! Skip DOS-entry flag 3460 WHILE I<160 : IF PEEK(Cmdsp+I)=13 GOTO 3490 3470 IF PEEK(Cmdsp+I)<32 OR PEEK(Cmdsp+I)>127 RETURN '' 3480 Cmd$=Cmd$+CHR$(PEEK(Cmdsp+I)) : I=I+1 : WEND 3490 RETURN Cmd$ 3500 FNEND 3510 ! 3520 ! ************************************* 3530 ! * 3540 ! * Exit to DOS or BASIC 3550 ! * 3560 DEF FNExit LOCAL A$=21,A 3570 IF FNChkdos=0 GOTO 3620 ELSE CLOSE ! We MUST close ALL files!!! 3580 A$='CMDINT SYS'+CHR$(14,255,205,27,96,216,195,3,193) 3590 A=VARPTR(A$) 3600 IF CALL(A+11,A) ; "Can't load CMDINT.SYS, press any key for RESET!"; 3610 GET A$ : IF CALL(0) REM Just a miracle would get through here... 3620 END ! End to get out of a function is ugly but... 3630 FNEND