[comp.sys.amiga] Patching FEXEC

wecker@cookie.dec.com (DAVE CUM GRANO SALIS WECKER) (12/14/86)

I have had alot of success installing the various patches for CC, MAKE
and DB (under Manx Aztec-C 3.20). However, no one has mentioned a patch for
the actual FEXEC routine (in C.LIB) so that programs you write yourself will
work.... well, I got tired of waiting for it, so here it is:

1) Extract the FEXEC module from C.LIB:

	lb c.lib -x fexec

2) Make sure that you get the right byte:

	hd +176 fexec.o

   (at hex 176 you should see a hex AC)

3) Do the patch (so program listed below):

	copy fexec.o fexec_new.o
	patch fexec_new.o 176

4) Recreate the library:

	lb c.lib -r fexec fexec_new

5) lb may leave around a file called C.$$$ ... this is the new library, so:

	copy c.$$$ c.lib

6) relink anything that uses fexec() or fexecv() (like Matt's shell).

===========================PATCH PROGRAM==================================
main(argc,argv)
int argc;
char **argv;
    {
    int	    fd;
    long    pos;

    if (argc < 2 || (fd = open(argv[1],2)) == -1) {
	printf("Can't open file\n");
	exit(1);
	}
    if (argc < 3 || sscanf(argv[2],"%lx",&pos) != 1) {
	printf("Can't get address argument\n");
	exit(1);
	}

    if (lseek(fd,(long)pos,0) == -1L) {
	printf("Can't seek\n");
	exit(1);
	}
    if (write(fd,"\xa8",1) == -1) {
	printf("Can't write\n");
	exit(1);
	}
    close(fd);
    }
======================================================================

I LOVE 1.2!!!
dave	decwrl!cookie.dec.com!wecker

phils@tekigm.UUCP (Phil Staub) (12/15/86)

In article <6913@decwrl.DEC.COM> wecker@cookie.dec.com (DAVE  CUM GRANO SALIS  WECKER) writes:
>I have had alot of success installing the various patches for CC, MAKE
>and DB (under Manx Aztec-C 3.20). However, no one has mentioned a patch for
>the actual FEXEC routine (in C.LIB) so that programs you write yourself will
>work.... well, I got tired of waiting for it, so here it is:

Dave, I think you'll find that for the sake of completeness, you'll also
need to make patches to the modules execv.c and execvp.c. They both contain
the same strange construct which created the problem in the first place.

This is the reason that MAKE required two locations to be patched.

>
>I LOVE 1.2!!!
>dave	decwrl!cookie.dec.com!wecker

Me too!!!


-- 
-------------------------------------------------------------------------------
Phil Staub              tektronix!tekigm!phils    (206) 253-5634
Tektronix, Inc., ISI Engineering
P.O.Box 3500, M/S C1-904, Vancouver, Washington  98668