Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!pacbell!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm From: tholm@uvicctr.UUCP (Terrence W. Holm) Newsgroups: comp.os.minix Subject: fortune cookie Message-ID: <433@uvicctr.UUCP> Date: 2 Jun 88 00:42:54 GMT Article-I.D.: uvicctr.433 Reply-To: tholm@uvicctr.UUCP (Terrence W. Holm) Organization: University of Victoria, Victoria B.C. Canada Lines: 53 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