Home » Archimedes archive » Acorn User » AU 1998-08.adf » Freeware » PD/Xuen11/!Xuen/Resources/source/linkrun/c/main
PD/Xuen11/!Xuen/Resources/source/linkrun/c/main
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 » Archimedes archive » Acorn User » AU 1998-08.adf » Freeware |
Filename: | PD/Xuen11/!Xuen/Resources/source/linkrun/c/main |
Read OK: | ✔ |
File size: | 0489 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- Archimedes archive » Acorn User » AU 1998-02 B.adf » Extras » Start/!Start/Resources/source/linkrun/c/main
- Archimedes archive » Acorn User » AU 1998-08.adf » Freeware » PD/Xuen11/!Xuen/Resources/source/linkrun/c/main
- Archimedes archive » Acorn User » AU 1998-05 B.adf » Freeware2 » xuen/!Xuen/Resources/source/linkrun/c/main
File contents
/************************************************ * Linkrun (c) 1996 Barny Short * * Module: main.c * * * ************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <os.h> char FileName[1024]; char Command[1024]; FILE * handle; char FilerRun[1024] = "Filer_Run \0"; char * Dptr; char InCh; void SourceToDest(char * Sptr) { while(*Sptr >31) { if (*Sptr >31) *Dptr = *Sptr; Sptr++; Dptr++; } } int main(int argc, char * args[]) { if (argc<=1) { printf("\n%s usage : %s [Link filename].\n\n", args[0], args[0]); exit(0); } Dptr = Command; SourceToDest(FilerRun); handle=fopen(args[1], "rb"); if (handle==0) { printf("Error : Couldn't input file '%s'\n",args[1]); exit(0); } /* fscanf(handle, "%s", Dptr);*/ while(!feof(handle)) { fscanf(handle, "%c", &InCh); if ( ((int) InCh) > 31) { *Dptr = InCh; Dptr++; } } fclose(handle); *Dptr = 0; Dptr++; os_cli(Command); return(1); }
00000000 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |/***************| 00000010 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************| * 00000030 2a 0a 20 2a 20 4c 69 6e 6b 72 75 6e 20 28 63 29 |*. * Linkrun (c)| 00000040 20 31 39 39 36 20 42 61 72 6e 79 20 53 68 6f 72 | 1996 Barny Shor| 00000050 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |t | 00000060 20 20 2a 0a 20 2a 20 4d 6f 64 75 6c 65 3a 20 6d | *. * Module: m| 00000070 61 69 6e 2e 63 20 20 20 20 20 20 20 20 20 20 20 |ain.c | 00000080 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000090 20 20 20 20 2a 0a 20 2a 20 20 20 20 20 20 20 20 | *. * | 000000a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | * 000000c0 20 20 20 20 20 20 2a 0a 20 2a 2a 2a 2a 2a 2a 2a | *. *******| 000000d0 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************| * 000000f0 2a 2a 2a 2a 2a 2a 2a 2a 2a 2f 0a 0a 23 69 6e 63 |*********/..#inc| 00000100 6c 75 64 65 20 3c 73 74 64 69 6f 2e 68 3e 0a 23 |lude <stdio.h>.#| 00000110 69 6e 63 6c 75 64 65 20 3c 73 74 64 6c 69 62 2e |include <stdlib.| 00000120 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c 73 74 72 |h>.#include <str| 00000130 69 6e 67 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 |ing.h>.#include | 00000140 3c 63 74 79 70 65 2e 68 3e 0a 0a 23 69 6e 63 6c |<ctype.h>..#incl| 00000150 75 64 65 20 3c 6f 73 2e 68 3e 0a 0a 63 68 61 72 |ude <os.h>..char| 00000160 20 46 69 6c 65 4e 61 6d 65 5b 31 30 32 34 5d 3b | FileName[1024];| 00000170 0a 63 68 61 72 20 43 6f 6d 6d 61 6e 64 5b 31 30 |.char Command[10| 00000180 32 34 5d 3b 0a 46 49 4c 45 20 2a 20 68 61 6e 64 |24];.FILE * hand| 00000190 6c 65 3b 0a 0a 63 68 61 72 20 46 69 6c 65 72 52 |le;..char FilerR| 000001a0 75 6e 5b 31 30 32 34 5d 20 3d 20 22 46 69 6c 65 |un[1024] = "File| 000001b0 72 5f 52 75 6e 20 5c 30 22 3b 0a 0a 63 68 61 72 |r_Run \0";..char| 000001c0 20 2a 20 44 70 74 72 3b 0a 63 68 61 72 20 49 6e | * Dptr;.char In| 000001d0 43 68 3b 0a 0a 76 6f 69 64 20 53 6f 75 72 63 65 |Ch;..void Source| 000001e0 54 6f 44 65 73 74 28 63 68 61 72 20 2a 20 53 70 |ToDest(char * Sp| 000001f0 74 72 29 0a 7b 0a 20 20 77 68 69 6c 65 28 2a 53 |tr).{. while(*S| 00000200 70 74 72 20 3e 33 31 29 0a 20 20 7b 0a 20 20 20 |ptr >31). {. | 00000210 20 69 66 20 28 2a 53 70 74 72 20 3e 33 31 29 20 | if (*Sptr >31) | 00000220 2a 44 70 74 72 20 3d 20 2a 53 70 74 72 3b 0a 20 |*Dptr = *Sptr;. | 00000230 20 20 20 53 70 74 72 2b 2b 3b 0a 20 20 20 20 44 | Sptr++;. D| 00000240 70 74 72 2b 2b 3b 0a 20 20 7d 0a 7d 0a 0a 69 6e |ptr++;. }.}..in| 00000250 74 20 6d 61 69 6e 28 69 6e 74 20 61 72 67 63 2c |t main(int argc,| 00000260 20 63 68 61 72 20 2a 20 61 72 67 73 5b 5d 29 0a | char * args[]).| 00000270 7b 0a 0a 0a 20 20 69 66 20 28 61 72 67 63 3c 3d |{... if (argc<=| 00000280 31 29 0a 20 20 7b 0a 20 20 20 20 70 72 69 6e 74 |1). {. print| 00000290 66 28 22 5c 6e 25 73 20 75 73 61 67 65 20 3a 20 |f("\n%s usage : | 000002a0 25 73 20 5b 4c 69 6e 6b 20 66 69 6c 65 6e 61 6d |%s [Link filenam| 000002b0 65 5d 2e 5c 6e 5c 6e 22 2c 20 61 72 67 73 5b 30 |e].\n\n", args[0| 000002c0 5d 2c 20 61 72 67 73 5b 30 5d 29 3b 0a 20 20 20 |], args[0]);. | 000002d0 20 65 78 69 74 28 30 29 3b 0a 20 20 7d 0a 0a 20 | exit(0);. }.. | 000002e0 20 44 70 74 72 20 3d 20 43 6f 6d 6d 61 6e 64 3b | Dptr = Command;| 000002f0 0a 20 20 53 6f 75 72 63 65 54 6f 44 65 73 74 28 |. SourceToDest(| 00000300 46 69 6c 65 72 52 75 6e 29 3b 0a 0a 20 20 68 61 |FilerRun);.. ha| 00000310 6e 64 6c 65 3d 66 6f 70 65 6e 28 61 72 67 73 5b |ndle=fopen(args[| 00000320 31 5d 2c 20 22 72 62 22 29 3b 0a 20 20 69 66 20 |1], "rb");. if | 00000330 28 68 61 6e 64 6c 65 3d 3d 30 29 0a 20 20 7b 0a |(handle==0). {.| 00000340 20 20 20 20 70 72 69 6e 74 66 28 22 45 72 72 6f | printf("Erro| 00000350 72 20 3a 20 43 6f 75 6c 64 6e 27 74 20 69 6e 70 |r : Couldn't inp| 00000360 75 74 20 66 69 6c 65 20 27 25 73 27 5c 6e 22 2c |ut file '%s'\n",| 00000370 61 72 67 73 5b 31 5d 29 3b 0a 20 20 20 20 65 78 |args[1]);. ex| 00000380 69 74 28 30 29 3b 0a 20 20 7d 0a 0a 0a 2f 2a 20 |it(0);. }.../* | 00000390 20 66 73 63 61 6e 66 28 68 61 6e 64 6c 65 2c 20 | fscanf(handle, | 000003a0 22 25 73 22 2c 20 44 70 74 72 29 3b 2a 2f 0a 0a |"%s", Dptr);*/..| 000003b0 20 20 77 68 69 6c 65 28 21 66 65 6f 66 28 68 61 | while(!feof(ha| 000003c0 6e 64 6c 65 29 29 0a 20 20 7b 0a 20 20 20 20 66 |ndle)). {. f| 000003d0 73 63 61 6e 66 28 68 61 6e 64 6c 65 2c 20 22 25 |scanf(handle, "%| 000003e0 63 22 2c 20 26 49 6e 43 68 29 3b 0a 20 20 20 20 |c", &InCh);. | 000003f0 69 66 20 28 20 28 28 69 6e 74 29 20 49 6e 43 68 |if ( ((int) InCh| 00000400 29 20 3e 20 33 31 29 0a 20 20 20 20 7b 0a 20 20 |) > 31). {. | 00000410 20 20 20 20 2a 44 70 74 72 20 3d 20 49 6e 43 68 | *Dptr = InCh| 00000420 3b 0a 20 20 20 20 20 20 44 70 74 72 2b 2b 3b 0a |;. Dptr++;.| 00000430 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 66 63 6c | }. }.. fcl| 00000440 6f 73 65 28 68 61 6e 64 6c 65 29 3b 0a 20 20 2a |ose(handle);. *| 00000450 44 70 74 72 20 3d 20 30 3b 0a 20 20 44 70 74 72 |Dptr = 0;. Dptr| 00000460 2b 2b 3b 0a 0a 20 20 6f 73 5f 63 6c 69 28 43 6f |++;.. os_cli(Co| 00000470 6d 6d 61 6e 64 29 3b 0a 0a 20 20 72 65 74 75 72 |mmand);.. retur| 00000480 6e 28 31 29 3b 0a 7d 0a 0a |n(1);.}..| 00000489