[comp.os.minix] fortune cookie

tholm@uvicctr.UUCP (Terrence W. Holm) (06/02/88)

EFTH Minix report #17  - June 1988 -  K. Lehenbauer's cookie(6)


Karl Lehenbauer has submitted a fortune cookie program to
comp.sources.games (V4, #15, "cookie/Part01"). By making some
minor changes and following his README file, it will run
under Minix.


cookhash.c

	Use "%06X\n", if you don't have a printf with %lx.

cookie.h

	Use something like:

	  #define COOKIEFILE "/usr/src/public/cookie/cookies"
	  #define HASHFILE   "/usr/src/public/cookie/cookie.hash"

cookie.c

	Apply some diffs to get srand() to work; The following
	works, but you can do better:

3a4,6
> /*  Edited for Minix    1988-May-27     EFTH    */
> 
> 
15a19,20
> extern long ftell();
> extern FILE  *fopen();
89d93
< 	 */
90a95,97
> 	 */
> 	{
> 	int srand = (getpid() + (int) time(NULL) ) % 10000;
91a99,102
> 	while( srand-- )
> 		rand();
> 	}
> 
93c104
< 	oneiwant = really_random(nentries);
---
> 	oneiwant = rand() % nentries;
--------------------------------------------------------------------
               Edwin L. Froese
                  uw-beaver!ubc-cs!mprg!handel!froese

               Terrence W. Holm
                  {uw-beaver,ubc-cs}!uvicctr!sirius!tholm