home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume3
/
rrcount
< prev
next >
Wrap
Internet Message Format
|
1989-02-03
|
2KB
Path: xanth!mcnc!gatech!mandrill!hal!ncoast!allbery
From: heckbert.pa@xerox.com
Newsgroups: comp.sources.misc
Subject: v03i058: Reagan Countdown Program!
Message-ID: <880622-180110-2769@Xerox>
Date: 23 Jun 88 01:01:06 GMT
Sender: allbery@ncoast.UUCP
Reply-To: heckbert.pa@xerox.com
Lines: 75
Approved: allbery@ncoast.UUCP
comp.sources.misc: Volume 3, Issue 58
Submitted-By: "A. Nonymous" <heckbert.pa@xerox.com>
Archive-Name: rrcount
[I love it!!! Shar'ed and modified so V7ers can use rand() and S5ers can use
lrand48. (Dumbshar.) ++bsa]
Here is a handy program to tell you how many days Reagan has left in office.
Run it from your .login.
It brightens my day to see this number decreasing every time I log in!
(It will also help you plan for the big party we must have when Reagan's term
is over).
echo x - rrcount.c
sed 's/^X//' << \EOF > rrcount.c
X/*
X * rrcount.c: Reagan Countdown program
X * Paul Heckbert, ph@degas.berkeley.edu 9 Mar 1988
X */
X
X#define BSD /* use BSD rng */
X/*#define USG /* use USG rng; otherwise V7 */
X
X#define SEC_PER_DAY (24*3600)
X#define REAGAN_TIMEOUT 601329600 /* inauguration day
X noon, 20 Jan 1989: time to rejoice! */
X
Xstatic char *gipname[] = {
X "President Reagan",
X "Ronald Wilson Reagan",
X "the Insane Anglo War-Lord", /* anagram for "Ronald Wilson Reagan" */
X "Ronnie-boy",
X "Ronnie Ray-gun",
X "the gipper",
X "the geezer",
X "Bedtime for Bonzo",
X "\"The Great Communicator\"",
X "the jelly bean king",
X "mr. 3x5 card",
X};
X#define GIPNUM (sizeof gipname/sizeof gipname[0])
X
Xdouble frandom();
X
Xmain()
X{
X long t;
X int i;
X
X t = time(0);
X srandom(t);
X for (i=0; i<30; i++) random();
X t = REAGAN_TIMEOUT-t;
X printf("%d more days of %s\n", t/SEC_PER_DAY,
X gipname[(int)(GIPNUM*frandom())]);
X}
X
Xdouble frandom() /* random number between 0 and 1 */
X{
X#ifdef BSD
X return random()/2147483647.;
X#endif
X#ifdef SYSV
X extern double drand48();
X
X srand48(time(0) + getpid());
X return drand48();
X#endif
X#if !(defined(BSD) || defined(SYSV))
X srand((unsigned) time((long *) 0) + getpid());
X return rand() / ((double) (2 << 15) - 1);
X#endif
X}
EOF
exit 0