A Usenet article generator [4.3 FIX]

trainor at ucla-cs.UUCP trainor at ucla-cs.UUCP
Thu Feb 19 18:36:43 AEST 1987


>Well, I compiled and run it, but at the end of producing its amusing
>output, it constantly gives "Segmentation fault - core dumped". This
>is on a VAX running 4.3BSD.

Same here.  It's just a sloppy pointer thing...  The DIFFs follow.
Also, the roll(n) function was returning large integers, outside the
range.  Please note that the low-order bits of most rand() functions
are junk!!!!  If you have random(), use it.

	Douglas

141c141
< 		srand ((unsigned) atoi (optarg));
---
> 		srand (atoi (optarg));
377c377
<     return (int) (n * (double) rand() / 32768.);
---
>     return ((((rand()>>8)&0x7fff)*n)/0x7fff);
403c403
< 	if (tp == NULL)
---
> 	if (p->scnod == (struct node *) NULL || tp == (char *) NULL)
ARPA:  trainor at locus.ucla.edu
UUCP:  ..!{sch-loki,silogic,randvax,ihnp4,sdcrdcf,trwspp,ucbvax}!ucla-cs!trainor
SNAKE: trainor at eric.sidewinder.snake



More information about the Comp.sources.unix mailing list