Home » Archimedes archive » Acorn User » AU 1995-08.adf » !Internet » StarterPak/!Newsbase/Transports/taylor/delgroup » Compare
Compare StarterPak/!Newsbase/Transports/taylor/delgroup with StarterPak/!Newsbase/Transports/taylor/addgroup
| File: | Archimedes archive » Acorn User » AU 1995-08.adf » !Internet » StarterPak/!Newsbase/Transports/taylor/delgroup |
| Compared with: | Archimedes archive » Acorn User » AU 1995-08.adf » !Internet » StarterPak/!Newsbase/Transports/taylor/addgroup |
| 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/delgroup | StarterPak/!Newsbase/Transports/taylor/addgroup |
|---|---|
| 10REM >delgroup | 10REM >addgroup |
| 20REM remove a group from the <NewsBase$TaylorConfig>.NewsBase.active file | 20REM add a group to the <NewsBase$TaylorConfig>.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 | |
| 240REM remove spaces from group name | 230REM remove spaces from group name |
| 250group$ = FNstripspaces(N$) | 240group$ = FNstripspaces(N$) |
| 260group$ = FNtolower(group$) | 250group$ = FNtolower(group$) |
| 270 | 260 |
| 280path$ = FNgetenv("NewsBase$TaylorConfig") | 270path$ = FNgetenv("NewsBase$TaylorConfig") |
| 290IF path$ = "" THEN | 280IF path$ = "" THEN |
| 300 PROCexit(1, "NewsBase$TaylorConfig has not been found") | 290 PROCexit(1, "NewsBase$TaylorConfig has not been found") |
| 330ENDIF | 300ENDIF |
| 340 | 310 |
| 350IF FNobjtype(path$ + ".active") <> 0 THEN | 320IF FNobjtype(path$ + ".active") <> 0 THEN |
| 360 REM we make a copy of our current groups file. Then we copy that | 330 REM we make a copy of our current groups file. Then we copy |
| 370 REM copy back line by line, inserting the new group where it | 340 REM that back line by line, inserting the new group where it |
| 380 REM lexically fits in. | 350 REM lexically fits in. |
| 390 OSCLI ("copy " + path$ + ".active " + path$ + ".active~ F~C~V") | 360 OSCLI ("copy " + path$ + ".active " + path$ + ".active~ F~C~V") |
| 400 in% = OPENIN(path$ + ".active~") | 370 in% = OPENIN(path$ + ".active~") |
| 410 IF in% = 0 THEN PROCexit(1, "could not open groups~ file") | 380 IF in% = 0 THEN PROCexit(1, "could not open active~ file") |
| 420 out% = OPENOUT(path$ + ".active") | 390 out% = OPENOUT(path$ + ".active") |
| 430 IF out% = 0 THEN PROCexit(1, "could not open groups file") | 400 IF out% = 0 THEN PROCexit(1, "could not open active file") |
| 440 o$ = GET$#in% | 410 o$ = GET$#in% |
| 450 WHILE o$ <> "" | 420 WHILE o$ <> "" |
| 460 IF o$ <> group$ THEN | 430 n$ = GET$#in% |
| 470 BPUT #out%, o$ | 440 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$ = GET$#in% | 490 o$ = n$ |
| 500 ENDWHILE | 500 ENDWHILE |
| 510 CLOSE #in% | 510 CLOSE #in% |
| 520 CLOSE #out% | 520 CLOSE #out% |
| 530 | 530ELSE |
| 540 OSCLI ("settype " + path$ + ".active FFF") | 540 out% = OPENOUT(path$ + ".active") |
| 550 IF out% = 0 THEN PROCexit(1, "could not open groups file") | |
| 560 BPUT #out%, group$ | |
| 570 CLOSE #out% | |
| 550ENDIF | 580ENDIF |
| 560 | 590 |
| 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 | |
| 570PROCexit(0, "Group added") | 760PROCexit(0, "Group added") |
| 580END | 770END |
| 590 | 780 |
| 600REM convert all characters in a string to lowercase. | 790REM convert all characters in a string to lowercase. |
| 610REM | 800REM |
| 620DEF FNtolower(a$) | 810DEF FNtolower(a$) |
| 630LOCAL i%, c$, cdiff | 820LOCAL i%, c$, cdiff |
| 640cdiff = ASC"a" - ASC"A" | 830cdiff = ASC"a" - ASC"A" |
| 650FOR i% = 1 TO LENa$ | 840FOR i% = 1 TO LENa$ |
| 660 c$ = MID$(a$, i%, 1) | 850 c$ = MID$(a$, i%, 1) |
| 670 IF c$ >= "A" AND c$ <= "Z" THEN | 860 IF c$ >= "A" AND c$ <= "Z" THEN |
| 680 MID$(a$, i%, 1) = CHR$(ASC(c$) + cdiff) | 870 MID$(a$, i%, 1) = CHR$(ASC(c$) + cdiff) |
| 690 ENDIF | 880 ENDIF |
| 700= a$ | 890= a$ |
| 710 | 900 |
| 720REM exit from here, returning appropriate info. | 910REM exit from here, returning appropriate info. |
| 730REM | 920REM |
| 740DEFPROCexit(n%,a$) | 930DEFPROCexit(n%,a$) |
| 750OSCLI("set NewsBase$ReturnCode "+STR$n%) | 940OSCLI("set NewsBase$ReturnCode "+STR$n%) |
| 760OSCLI("set NewsBase$ReturnInfo "+a$) | 950OSCLI("set NewsBase$ReturnInfo "+a$) |
| 770END | 960END |
| 780ENDPROC | 970ENDPROC |
| 790 | 980 |
| 800DEFFNobjtype(f$) | 990DEFFNobjtype(f$) |
| 810LOCALF% | 1000LOCALF% |
| 820SYS"XOS_File",17,f$TOt%;F% | 1010SYS"XOS_File",17,f$TOt%;F% |
| 830IF(F%AND1)THEN=-1:ELSE=t% | 1020IF(F%AND1)THEN=-1:ELSE=t% |
.