[net.bugs.4bsd] Trek

cpf@lasspvax.UUCP (Footenay Courtman) (03/25/85)

>
>I am new at this so please bear with me. We have the game trek that was
>distributed with with BSD 4.2. Unfortunately, after playing a few minutes
>we get a segmentation fault. 
>
The problem is in the code for events.c.  There are three bmove calls
right in a row: bmove(Quad,...), bmove(Event,...), bmove(New,...).
Quad and Event are arrays, New is a structure.  The argument for the 
third bmove should be &New:
	    i = (int)bmove((char *)Quad, (char *)i, sizeof (Quad));
	    i = (int)bmove((char *)Event, (char *)i, sizeof(Event));
	    i = (int)bmove((char *)&Now, (char *)i, sizeof (Now));
I no longer have the original source, so I can not post a diff.  I have
added all the casts myself, so the thing will pass lint.  The source
originaly read:
	    i = bmove(Quad, i, sizeof (Quad));
	    i = bmove(Event, i, sizeof(Event));
	    i = bmove(Now, i, sizeof (Now));
Note the absence of the ampersand.  Segmention faults are the unsuprising
result of this bug.  Note that the README file is unduly scary;  I don't
think anything else had to be changed to run on 4.2.  I say "I don't think"
because I hacked the code until most of it passed lint.
-- 
Courtenay Footman			arpa:	cpf@lnsvax
Newman Lab. of Nuclear Studies		usenet:	cornell!lnsvax!cpf
Cornell University