home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume6
/
gbcount2
< prev
next >
Wrap
Internet Message Format
|
1989-02-03
|
3KB
Path: xanth!nic.MR.NET!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!allbery
From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
Newsgroups: comp.sources.misc
Subject: v06i027: Bush in '92 countdown program
Message-ID: <47760@uunet.UU.NET>
Date: 29 Jan 89 21:21:51 GMT
Sender: allbery@uunet.UU.NET
Reply-To: kscott@cca.ucsf.EDU (Kevin Scott)
Lines: 86
Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
X-Arch-Keywords: portable, c, politics, fun
Posting-number: Volume 6, Issue 27
Submitted-by: kscott@cca.ucsf.EDU (Kevin Scott)
Archive-name: gbcount2
[This silly politics stuff is making me violently sick. ++bsa]
#! /bin/sh
# This file was wrapped with "dummyshar". "sh" this file to extract.
# Contents: gbcount.c
echo extracting 'gbcount.c'
if test -f 'gbcount.c' -a -z "$1"; then echo Not overwriting 'gbcount.c'; else
sed 's/^X//' << \EOF > 'gbcount.c'
X/*
X * gbcount.c: George Bush Countdown program
X * Paul Heckbert, ph@degas.berkeley.edu 9 Mar 1988
X * Kevin Scott, kscott@cca.ucsf.edu 20 Jan 1989
X */
X
X#define BSD /* use BSD rng */
X/*#define USG /* use USG rng; otherwise V7 */
X
X#include <stdio.h>
X#define SEC_PER_DAY (24*3600)
X#define BUSH_TIMEOUT 727300800 /* inauguration day
X noon, 20 Jan 1993: time to rejoice!
X (anticipating one term) */
X
Xstatic char *wimpname[] = {
X "The French Connection",
X "George Bush",
X "Mister Skull and Bones",
X "The Quayle Hunter",
X "Noriega's blackmailee",
X "Dan Quayle jokes",
X "BU--SH--",
X "a kindler, gentler aristocracy",
X "1000 points of light",
X "Son of the Gipper",
X "the Wimp",
X};
X#define WIMPNUM (sizeof wimpname/sizeof wimpname[0])
X
Xdouble frandom();
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X long t;
X int i;
X
X t = time(0);
X srandom(t);
X for (i=0; i<30; i++) random();
X if (argc == 1) t = BUSH_TIMEOUT-t;
X else if (*(argv[1]+1) == 'p') t = BUSH_TIMEOUT -t -10800;
X else if (*(argv[1]+1) == 'm') t = BUSH_TIMEOUT -t -7200;
X else if (*(argv[1]+1) == 'c') t = BUSH_TIMEOUT -t -3600;
X else if (*(argv[1]+1) == 'e') t = BUSH_TIMEOUT -t;
X else printf("By Eastern Standard Time there are ");
X printf("%d more days of %s\n", t/SEC_PER_DAY,
X wimpname[(int)(WIMPNUM*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}
X
EOF
chars=`wc -c < 'gbcount.c'`
if test $chars != 1779; then echo 'gbcount.c' is $chars characters, should be 1779 characters!; fi
fi
exit 0