Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!decvax!decwrl!cookie.dec.com!wecker
From: wecker@cookie.dec.com (DAVE  CUM GRANO SALIS  WECKER)
Newsgroups: comp.sys.amiga
Subject: Patching FEXEC (for MANX) on 1.2
Message-ID: <6913@decwrl.DEC.COM>
Date: Sun, 14-Dec-86 13:27:09 EST
Article-I.D.: decwrl.6913
Posted: Sun Dec 14 13:27:09 1986
Date-Received: Tue, 16-Dec-86 03:03:10 EST
Sender: daemon@decwrl.DEC.COM
Organization: Digital Equipment Corporation
Lines: 61

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