--- /dev/null
+REM
+REM fixLink
+REM
+REM Fix object files output by partial AOF linking
+REM
+REM © 1995-1998 Straylight
+REM
+
+REM ----- Licensing note ----------------------------------------------------
+REM
+REM This file is part of Straylight's core utilities (coreutils)
+REM
+REM Coreutils is free software; you can redistribute it and/or modify
+REM it under the terms of the GNU General Public License as published by
+REM the Free Software Foundation; either version 2, or (at your option)
+REM any later version
+REM
+REM Coreutils is distributed in the hope that it will be useful,
+REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+REM GNU General Public License for more details.
+REM
+REM You should have received a copy of the GNU General Public License
+REM along with Coreutils. If not, write to the Free Software Foundation,
+REM 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+SYS "OS_GetEnv" TO comm$
+IF INSTR(comm$,"-quit")=0 THEN ERROR 1,"fixLink must be started using *Run"
+comm$=MID$(comm$,INSTR(comm$,"""")+1)
+comm$=MID$(comm$,INSTR(comm$," ")+1)
+comm$=LEFT$(comm$,INSTR(comm$,"""")-1)
+
+SYS "OS_File",17,comm$ TO ,,,,size%
+DIM b% size%
+SYS "OS_File",16,comm$,b%,0
+
+REM --- Find header ---
+
+DIM q% 8
+$q%="OBJ_HEAD"
+A%=q%!0
+B%=q%!4
+c%=b%!4
+x%=b%+12
+o%=0
+FOR i%=1 TO c%
+ IF x%!0=A% AND x%!4=B% THEN o%=x%!8
+ x%+=16
+NEXT
+IF o%=0 THEN ERROR 0,"Erk!"
+
+REM --- Now munge attributes ---
+
+x%=b%+o%+24
+a%=!(b%+o%+8)
+FOR i%=1 TO a%
+ x%!4=x%!4 AND &FFFF
+ x%+=20
+NEXT
+
+REM --- Save AOF file back ---
+
+SYS "OS_File",10,comm$,&FFD,,b%,b%+size%
+END