Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199508.adf » !Internet » StarterPak/!Newsbase/Transports/taylor/printto
StarterPak/!Newsbase/Transports/taylor/printto
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199508.adf » !Internet |
Filename: | StarterPak/!Newsbase/Transports/taylor/printto |
Read OK: | ✔ |
File size: | 03FD bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM >printto 20REM creates a file and prints a string to it. 30REM this in intended for compressed batches, to prefix them 40REM with #! cunbatch headers. 50REM 60REM Author: Gunnar ZREPORTtl 70REM Date: 19-Sep-1994 80REM Last modified: 19-Sep-1994 90REM 100REM usage: printto filename string 110REM where the string is just the tail of the command line after 120REM the first space after the filename. 130 140ONERROR REPORT:PRINT" at line ";ERL:END 150 160SYS"OS_GetEnv" TO a$ 170 180p% = INSTR(a$, " ") 190b$ = FNtolower(a$) 200p% = INSTR(b$, "-quit", p%) 210IF p% > 0 220 p% = INSTR(a$," ", p% + 5) 230ENDIF 240p% = INSTR(a$, " ", p% + 1) 250WHILE MID$(a$, p%, 1) = " ": p% += 1: ENDWHILE 260Q% =INSTR(a$," ", p% + 1) 270file$ = MID$(a$, p%, Q% - p%) 280string$ = MID$(a$, Q% + 1) 290f% = OPENOUT(file$) 300BPUT#f%, string$ 310CLOSE#f% 320END 330 340REM convert all characters in a string to lowercase. 350REM 360DEF FNtolower(a$) 370LOCAL i%, c$, cdiff 380cdiff = ASC"a" - ASC"A" 390FOR i% = 1 TO LENa$ 400 c$ = MID$(a$, i%, 1) 410 IF c$ >= "A" AND c$ <= "Z" THEN 420 MID$(a$, i%, 1) = CHR$(ASC(c$) + cdiff) 430 ENDIF 440= a$
� >printto /� creates a file and prints a string to it. =� this in intended for compressed batches, to prefix them (� with #! cunbatch headers. 2� <!� Author: Gunnar Z�tl F!� Date: 19-Sep-1994 P!� Last modified: 19-Sep-1994 Z� d$� usage: printto filename string nA� where the string is just the tail of the command line after x)� the first space after the filename. � �� �:�" at line ";�:� � �ș"OS_GetEnv" � a$ � �p% = �a$, " ") �b$ = �tolower(a$) �p% = �b$, "-quit", p%) �� p% > 0 � p% = �a$," ", p% + 5) �� �p% = �a$, " ", p% + 1) �$ȕ �a$, p%, 1) = " ": p% += 1: � Q% =�a$," ", p% + 1) file$ = �a$, p%, Q% - p%) string$ = �a$, Q% + 1) "f% = �(file$) ,�#f%, string$ 6�#f% @� J T6� convert all characters in a string to lowercase. ^� h� �tolower(a$) r� i%, c$, cdiff |cdiff = �"a" - �"A" �� i% = 1 � �a$ � c$ = �a$, i%, 1) �! � c$ >= "A" � c$ <= "Z" � �* �a$, i%, 1) = �(�(c$) + cdiff) � � �= a$ �
00000000 0d 00 0a 0e f4 20 3e 70 72 69 6e 74 74 6f 0d 00 |..... >printto..| 00000010 14 2f f4 20 63 72 65 61 74 65 73 20 61 20 66 69 |./. creates a fi| 00000020 6c 65 20 61 6e 64 20 70 72 69 6e 74 73 20 61 20 |le and prints a | 00000030 73 74 72 69 6e 67 20 74 6f 20 69 74 2e 0d 00 1e |string to it....| 00000040 3d f4 20 74 68 69 73 20 69 6e 20 69 6e 74 65 6e |=. this in inten| 00000050 64 65 64 20 66 6f 72 20 63 6f 6d 70 72 65 73 73 |ded for compress| 00000060 65 64 20 62 61 74 63 68 65 73 2c 20 74 6f 20 70 |ed batches, to p| 00000070 72 65 66 69 78 20 74 68 65 6d 0d 00 28 1f f4 20 |refix them..(.. | 00000080 77 69 74 68 20 23 21 20 63 75 6e 62 61 74 63 68 |with #! cunbatch| 00000090 20 68 65 61 64 65 72 73 2e 0d 00 32 05 f4 0d 00 | headers...2....| 000000a0 3c 21 f4 20 41 75 74 68 6f 72 3a 20 20 20 20 20 |<!. Author: | 000000b0 20 20 20 20 47 75 6e 6e 61 72 20 5a f6 74 6c 0d | Gunnar Z.tl.| 000000c0 00 46 21 f4 20 44 61 74 65 3a 20 20 20 20 20 20 |.F!. Date: | 000000d0 20 20 20 20 20 31 39 2d 53 65 70 2d 31 39 39 34 | 19-Sep-1994| 000000e0 0d 00 50 21 f4 20 4c 61 73 74 20 6d 6f 64 69 66 |..P!. Last modif| 000000f0 69 65 64 3a 20 20 31 39 2d 53 65 70 2d 31 39 39 |ied: 19-Sep-199| 00000100 34 0d 00 5a 05 f4 0d 00 64 24 f4 20 75 73 61 67 |4..Z....d$. usag| 00000110 65 3a 20 70 72 69 6e 74 74 6f 20 66 69 6c 65 6e |e: printto filen| 00000120 61 6d 65 20 73 74 72 69 6e 67 0d 00 6e 41 f4 20 |ame string..nA. | 00000130 77 68 65 72 65 20 74 68 65 20 73 74 72 69 6e 67 |where the string| 00000140 20 69 73 20 6a 75 73 74 20 74 68 65 20 74 61 69 | is just the tai| 00000150 6c 20 6f 66 20 74 68 65 20 63 6f 6d 6d 61 6e 64 |l of the command| 00000160 20 6c 69 6e 65 20 61 66 74 65 72 0d 00 78 29 f4 | line after..x).| 00000170 20 74 68 65 20 66 69 72 73 74 20 73 70 61 63 65 | the first space| 00000180 20 61 66 74 65 72 20 74 68 65 20 66 69 6c 65 6e | after the filen| 00000190 61 6d 65 2e 0d 00 82 04 0d 00 8c 19 ee 85 20 f6 |ame........... .| 000001a0 3a f1 22 20 61 74 20 6c 69 6e 65 20 22 3b 9e 3a |:." at line ";.:| 000001b0 e0 0d 00 96 04 0d 00 a0 16 c8 99 22 4f 53 5f 47 |..........."OS_G| 000001c0 65 74 45 6e 76 22 20 b8 20 61 24 0d 00 aa 04 0d |etEnv" . a$.....| 000001d0 00 b4 12 70 25 20 3d 20 a7 61 24 2c 20 22 20 22 |...p% = .a$, " "| 000001e0 29 0d 00 be 15 62 24 20 3d 20 a4 74 6f 6c 6f 77 |)....b$ = .tolow| 000001f0 65 72 28 61 24 29 0d 00 c8 1a 70 25 20 3d 20 a7 |er(a$)....p% = .| 00000200 62 24 2c 20 22 2d 71 75 69 74 22 2c 20 70 25 29 |b$, "-quit", p%)| 00000210 0d 00 d2 0c e7 20 70 25 20 3e 20 30 0d 00 dc 1d |..... p% > 0....| 00000220 20 20 20 20 70 25 20 3d 20 a7 61 24 2c 22 20 22 | p% = .a$," "| 00000230 2c 20 70 25 20 2b 20 35 29 0d 00 e6 05 cd 0d 00 |, p% + 5).......| 00000240 f0 1a 70 25 20 3d 20 a7 61 24 2c 20 22 20 22 2c |..p% = .a$, " ",| 00000250 20 70 25 20 2b 20 31 29 0d 00 fa 24 c8 95 20 c1 | p% + 1)...$.. .| 00000260 61 24 2c 20 70 25 2c 20 31 29 20 3d 20 22 20 22 |a$, p%, 1) = " "| 00000270 3a 20 70 25 20 2b 3d 20 31 3a 20 ce 0d 01 04 18 |: p% += 1: .....| 00000280 51 25 20 3d a7 61 24 2c 22 20 22 2c 20 70 25 20 |Q% =.a$," ", p% | 00000290 2b 20 31 29 0d 01 0e 1d 66 69 6c 65 24 20 3d 20 |+ 1)....file$ = | 000002a0 c1 61 24 2c 20 70 25 2c 20 51 25 20 2d 20 70 25 |.a$, p%, Q% - p%| 000002b0 29 0d 01 18 1a 73 74 72 69 6e 67 24 20 3d 20 c1 |)....string$ = .| 000002c0 61 24 2c 20 51 25 20 2b 20 31 29 0d 01 22 11 66 |a$, Q% + 1)..".f| 000002d0 25 20 3d 20 ae 28 66 69 6c 65 24 29 0d 01 2c 11 |% = .(file$)..,.| 000002e0 d5 23 66 25 2c 20 73 74 72 69 6e 67 24 0d 01 36 |.#f%, string$..6| 000002f0 08 d9 23 66 25 0d 01 40 05 e0 0d 01 4a 04 0d 01 |..#f%..@....J...| 00000300 54 36 f4 20 63 6f 6e 76 65 72 74 20 61 6c 6c 20 |T6. convert all | 00000310 63 68 61 72 61 63 74 65 72 73 20 69 6e 20 61 20 |characters in a | 00000320 73 74 72 69 6e 67 20 74 6f 20 6c 6f 77 65 72 63 |string to lowerc| 00000330 61 73 65 2e 0d 01 5e 05 f4 0d 01 68 12 dd 20 a4 |ase...^....h.. .| 00000340 74 6f 6c 6f 77 65 72 28 61 24 29 0d 01 72 13 ea |tolower(a$)..r..| 00000350 20 69 25 2c 20 63 24 2c 20 63 64 69 66 66 0d 01 | i%, c$, cdiff..| 00000360 7c 17 63 64 69 66 66 20 3d 20 97 22 61 22 20 2d ||.cdiff = ."a" -| 00000370 20 97 22 41 22 0d 01 86 12 e3 20 69 25 20 3d 20 | ."A"..... i% = | 00000380 31 20 b8 20 a9 61 24 0d 01 90 18 20 20 20 20 63 |1 . .a$.... c| 00000390 24 20 3d 20 c1 61 24 2c 20 69 25 2c 20 31 29 0d |$ = .a$, i%, 1).| 000003a0 01 9a 21 20 20 20 20 e7 20 63 24 20 3e 3d 20 22 |..! . c$ >= "| 000003b0 41 22 20 80 20 63 24 20 3c 3d 20 22 5a 22 20 8c |A" . c$ <= "Z" .| 000003c0 0d 01 a4 2a 20 20 20 20 20 20 20 20 c1 61 24 2c |...* .a$,| 000003d0 20 69 25 2c 20 31 29 20 3d 20 bd 28 97 28 63 24 | i%, 1) = .(.(c$| 000003e0 29 20 2b 20 63 64 69 66 66 29 0d 01 ae 09 20 20 |) + cdiff).... | 000003f0 20 20 cd 0d 01 b8 08 3d 20 61 24 0d ff | .....= a$..| 000003fd