another political countdown
Brandon S. Allbery - comp.sources.misc
allbery at uunet.UU.NET
Sun Feb 19 06:54:51 AEST 1989
[By request, these type of postings are "persona non grata" in c.s.misc from
now on. ++bsa]
This is a counter posting for the more conservatively-minded folk on the
net.
#! /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 at degas.berkeley.edu 9 Mar 1988
X * Kevin Scott, kscott at cca.ucsf.edu 20 Jan 1989
X * Tom Albrecht, tom at dvnspc1.Dev.Unisys.COM 7 Feb 89 for the True Believers
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:
X (FOUR MORE YEARS!!!) */
X
Xstatic char *GBname[] = {
X "George Bush",
X "No prison furloughs",
X "Low inflation and low interest rates",
X "The Great Outdoorsman",
X "More excellent federal judges",
X "Without Dukakis",
X "Read My Lips - No New Taxes",
X "A kinder, gentler nation",
X "1000 points of light (I like that one)",
X "Son of the The Great Communicator",
X "Dan Rather's straight man",
X};
X#define GBNAME (sizeof GBname/sizeof GBname[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#ifndef USG
X srandom(t);
X for (i=0; i<30; i++) random();
X#endif
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 GBname[(int)(GBNAME*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 != 1862; then echo 'gbcount.c' is $chars characters, should be 1862 characters!; fi
fi
exit 0
---
Tom Albrecht "I have learned for myself that
Presbyterianism is not true."
- Joseph Smith, Jr.
More information about the Alt.sources
mailing list