Home » Archimedes archive » Acorn User » AU 1995-08.adf » !Internet » StarterPak/!Newsbase/Transports/taylor/addgroup » Compare

Compare StarterPak/!Newsbase/Transports/taylor/addgroup with StarterPak/!Newsbase/Transports/taylor/delgroup

File: Archimedes archive » Acorn User » AU 1995-08.adf » !Internet » StarterPak/!Newsbase/Transports/taylor/addgroup
Compared with: Archimedes archive » Acorn User » AU 1995-08.adf » !Internet » StarterPak/!Newsbase/Transports/taylor/delgroup
Similarity: 73% of bytes duplicated

69 of 105 lines (74.2%) are identical in the two listings. Duplicated Different

Line numbers are ignored when comparing lines, so that renumbered programs still match.

StarterPak/!Newsbase/Transports/taylor/addgroup StarterPak/!Newsbase/Transports/taylor/delgroup
10REM >addgroup 10REM >delgroup
20REM add a group to the <NewsBase$TaylorConfig>.active file 20REM remove a group from the <NewsBase$TaylorConfig>.NewsBase.active file
30REM 30REM
40REM Author: Gunnar ZREPORTtl 40REM Author: Gunnar ZREPORTtl
50REM Date: 19-Sep-1994 50REM Date: 19-Sep-1994
60REM Last modified: 13-Nov-1994 60REM Last modified: 13-Nov-1994
70 70
80ONERROR REPORT:PRINT" at line ";ERL:END 80ONERROR REPORT:PRINT" at line ";ERL:END
90 90
100LIBRARY "<NewsBase$TaylorDir>.ScriptLib" 100LIBRARY "<NewsBase$TaylorDir>.ScriptLib"
110 110
120REM get the command line parameters. 120REM get the command line parameters.
130PROCentry 130PROCentry
140IF (argc = 3) THEN 140IF (argc = 3) THEN
150 IF argv$(1) = "-n" THEN 150 IF argv$(1) = "-n" THEN
160 N$ = argv$(2) 160 N$ = argv$(2)
170 ELSE 170 ELSE
180 PROCexit(1, "Invalid Parameters") 180 PROCexit(1, "Invalid Parameters")
190 ENDIF 190 ENDIF
200ELSE 200ELSE
210 PROCexit(1, "Invalid Parameters") 210 PROCexit(1, "Invalid Parameters")
220ENDIF 220ENDIF
230
230REM remove spaces from group name 240REM remove spaces from group name
240group$ = FNstripspaces(N$) 250group$ = FNstripspaces(N$)
250group$ = FNtolower(group$) 260group$ = FNtolower(group$)
260 270
270path$ = FNgetenv("NewsBase$TaylorConfig") 280path$ = FNgetenv("NewsBase$TaylorConfig")
280IF path$ = "" THEN 290IF path$ = "" THEN
290 PROCexit(1, "NewsBase$TaylorConfig has not been found") 300 PROCexit(1, "NewsBase$TaylorConfig has not been found")
300ENDIF 330ENDIF
310 340
320IF FNobjtype(path$ + ".active") <> 0 THEN 350IF FNobjtype(path$ + ".active") <> 0 THEN
330 REM we make a copy of our current groups file. Then we copy 360 REM we make a copy of our current groups file. Then we copy that
340 REM that back line by line, inserting the new group where it 370 REM copy back line by line, inserting the new group where it
350 REM lexically fits in. 380 REM lexically fits in.
360 OSCLI ("copy " + path$ + ".active " + path$ + ".active~ F~C~V") 390 OSCLI ("copy " + path$ + ".active " + path$ + ".active~ F~C~V")
370 in% = OPENIN(path$ + ".active~") 400 in% = OPENIN(path$ + ".active~")
380 IF in% = 0 THEN PROCexit(1, "could not open active~ file") 410 IF in% = 0 THEN PROCexit(1, "could not open groups~ file")
390 out% = OPENOUT(path$ + ".active") 420 out% = OPENOUT(path$ + ".active")
400 IF out% = 0 THEN PROCexit(1, "could not open active file") 430 IF out% = 0 THEN PROCexit(1, "could not open groups file")
410 o$ = GET$#in% 440 o$ = GET$#in%
420 WHILE o$ <> "" 450 WHILE o$ <> ""
430 n$ = GET$#in% 460 IF o$ <> group$ THEN
440 BPUT #out%, o$ 470 BPUT #out%, o$
450 REM IF o$ < group$ AND n$ > group$ THEN
460 IF n$="" THEN
470 BPUT #out%, group$
480 ENDIF 480 ENDIF
490 o$ = n$ 490 o$ = GET$#in%
500 ENDWHILE 500 ENDWHILE
510 CLOSE #in% 510 CLOSE #in%
520 CLOSE #out% 520 CLOSE #out%
530ELSE 530
540 out% = OPENOUT(path$ + ".active") 540 OSCLI ("settype " + path$ + ".active FFF")
550 IF out% = 0 THEN PROCexit(1, "could not open groups file")
560 BPUT #out%, group$
570 CLOSE #out%
580ENDIF 550ENDIF
590 560
600OSCLI ("settype " + path$ + ".active FFF")
610
620REM update newgroups file... I am not sure wether this is going
630REM to work as I expect it to... If this file is not writable,
631REM don't complain, just ignore it.
640REM p1$ = FNgetenv("NewsDir$Dir")
650REM IF p1$ <> "" THEN
660REM p1$ += ".scrap.NewTaylor"
670REM IF FNobjtype(p1$) <> 0 THEN
680REM u% = OPENUP(p1$)
690REM ELSE
700REM u% = OPENOUT(p1$)
710REM ENDIF
711REM IF u% > 0 THEN
720REM BPUT#u%, group$
730REM CLOSE#u%
731REM ENDIF
740REM ENDIF
750
760PROCexit(0, "Group added") 570PROCexit(0, "Group added")
770END 580END
780 590
790REM convert all characters in a string to lowercase. 600REM convert all characters in a string to lowercase.
800REM 610REM
810DEF FNtolower(a$) 620DEF FNtolower(a$)
820LOCAL i%, c$, cdiff 630LOCAL i%, c$, cdiff
830cdiff = ASC"a" - ASC"A" 640cdiff = ASC"a" - ASC"A"
840FOR i% = 1 TO LENa$ 650FOR i% = 1 TO LENa$
850 c$ = MID$(a$, i%, 1) 660 c$ = MID$(a$, i%, 1)
860 IF c$ >= "A" AND c$ <= "Z" THEN 670 IF c$ >= "A" AND c$ <= "Z" THEN
870 MID$(a$, i%, 1) = CHR$(ASC(c$) + cdiff) 680 MID$(a$, i%, 1) = CHR$(ASC(c$) + cdiff)
880 ENDIF 690 ENDIF
890= a$ 700= a$
900 710
910REM exit from here, returning appropriate info. 720REM exit from here, returning appropriate info.
920REM 730REM
930DEFPROCexit(n%,a$) 740DEFPROCexit(n%,a$)
940OSCLI("set NewsBase$ReturnCode "+STR$n%) 750OSCLI("set NewsBase$ReturnCode "+STR$n%)
950OSCLI("set NewsBase$ReturnInfo "+a$) 760OSCLI("set NewsBase$ReturnInfo "+a$)
960END 770END
970ENDPROC 780ENDPROC
980 790
990DEFFNobjtype(f$) 800DEFFNobjtype(f$)
1000LOCALF% 810LOCALF%
1010SYS"XOS_File",17,f$TOt%;F% 820SYS"XOS_File",17,f$TOt%;F%
1020IF(F%AND1)THEN=-1:ELSE=t% 830IF(F%AND1)THEN=-1:ELSE=t%