games@tekred.CNA.TEK.COM (04/07/89)
Submitted-by: "Wayne A. Christopher" <faustus@dogwood.Berkeley.EDU>
Posting-number: Volume 6, Issue 47
Archive-name: scrabble/Part02
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 2 (of 2)."
# Contents: board.c curses.ext player.c plural.c savegame.c user.c
# util.c util.h
# Wrapped by billr@saab on Thu Apr 6 12:40:39 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'board.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'board.c'\"
else
echo shar: Extracting \"'board.c'\" \(3366 characters\)
sed "s/^X//" >'board.c' <<'END_OF_FILE'
X
X/* RCS Info: $Revision: 1.3 $ on $Date: 89/03/15 16:31:58 $
X * $Source: /yew3/faustus/src/scrabble/RCS/board.c,v $
X * Copyright (c) 1989 Wayne A. Christopher, U. C. Berkeley CS Dept
X * faustus@renoir.berkeley.edu, ucbvax!faustus
X * Permission is granted to modify and re-distribute this code in any manner
X * as long as this notice is preserved. All standard disclaimers apply.
X *
X */
X
X#include "scrabble.h"
X
Xstatic char *bonus_map[] = {
X "T d T d T",
X " D t t D ",
X " D d d D ",
X "d D d D d",
X " D D ",
X " t t t t ",
X " d d d d ",
X "T d D d T",
X " d d d d ",
X " t t t t ",
X " D D ",
X "d D d D d",
X " D d d D ",
X " D t t D ",
X "T d T d T"
X} ;
X
Xstatic int distrib[NUM_LETTERS] = {
X /* A B C D E F G H I J K L M */
X 9, 2, 2, 4,12, 2, 3, 2, 9, 1, 1, 4, 2,
X
X /* N O P Q R S T U V W X Y Z * */
X 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1, 2
X} ;
X
Xint letterpoint_values[NUM_LETTERS] = {
X /* A B C D E F G H I J K L M */
X 1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3,
X
X /* N O P Q R S T U V W X Y Z * */
X 1, 1, 3,10, 1, 1, 1, 1, 4, 4, 8, 4,10, 0
X} ;
X
Xboard_t *
Xmakeboard()
X{
X board_t *board = (board_t *) util_malloc(sizeof (board_t));
X int i, j, k;
X
X for (i = 0; i < SIZE; i++)
X for (j = 0; j < SIZE; j++) {
X board->letters[i][j] = ' ';
X switch (bonus_map[i][j]) {
X case ' ': board->bonus[i][j] = NONE; break;
X case 'd': board->bonus[i][j] = DOUBLE_LETTER; break;
X case 't': board->bonus[i][j] = TRIPLE_LETTER; break;
X case 'D': board->bonus[i][j] = DOUBLE_WORD; break;
X case 'T': board->bonus[i][j] = TRIPLE_WORD; break;
X }
X }
X
X for (i = POOL_SIZE - 1; i >= 0; i--) {
X j = random() % (i + 1);
X for (k = 0; j >= 0; j -= distrib[k++])
X ;
X k--;
X distrib[k]--;
X if (k == NUM_LETTERS - 1)
X board->pool[i] = WILD;
X else
X board->pool[i] = 'a' + k;
X }
X
X board->numleft = POOL_SIZE;
X board->virgin = true;
X
X return (board);
X}
X
Xvoid
Xboardmove(board_t *board, move_t *move)
X{
X int i;
X
X if (move->horiz)
X for (i = 0; i < move->length; i++) {
X board->letters[move->x + i][move->y] = move->wild[i] ?
X makewild(move->word[i]) : move->word[i];
X }
X else
X for (i = 0; i < move->length; i++) {
X board->letters[move->x][move->y + i] = move->wild[i] ?
X makewild(move->word[i]) : move->word[i];
X }
X
X board->virgin = false;
X
X return;
X}
X
Xchar
Xpickletter(board_t *board)
X{
X if (board->numleft)
X return (board->pool[--board->numleft]);
X else
X return (ZIP);
X}
X
X#ifdef notdef
X
Xstatic char lbchar[] = " `\"(<";
Xstatic char rbchar[] = " '\")>";
X
Xvoid
Xprintboard(board_t *board, FILE *fp)
X{
X int i, j;
X char c;
X
X fprintf(fp, " ");
X for (j = 0; j < SIZE; j++)
X fprintf(fp, " %-2d", j);
X fprintf(fp, "\n");
X for (i = 0; i < SIZE; i++) {
X fprintf(fp, "%2d ", i);
X for (j = 0; j < SIZE; j++) {
X if (something(board->letters[j][i])) {
X if (iswild(board->letters[j][i]))
X c = tolower(board->letters[j][i]);
X else
X c = toupper(board->letters[j][i]);
X } else {
X c = '.';
X }
X fprintf(fp, "%c%c%c", lbchar[board->bonus[j][i]], c,
X rbchar[board->bonus[j][i]]);
X }
X fprintf(fp, " %-2d\n", i);
X }
X fprintf(fp, " ");
X for (j = 0; j < SIZE; j++)
X fprintf(fp, " %-2d", j);
X fprintf(fp, "\n\tLetters left: %d\n", board->numleft);
X
X return;
X}
X
X#endif
X
END_OF_FILE
if test 3366 -ne `wc -c <'board.c'`; then
echo shar: \"'board.c'\" unpacked with wrong size!
fi
# end of 'board.c'
fi
if test -f 'curses.ext' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'curses.ext'\"
else
echo shar: Extracting \"'curses.ext'\" \(862 characters\)
sed "s/^X//" >'curses.ext' <<'END_OF_FILE'
X/*
X * Copyright (c) 1981 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that this notice is preserved and that due credit is given
X * to the University of California at Berkeley. The name of the University
X * may not be used to endorse or promote products derived from this
X * software without specific prior written permission. This software
X * is provided ``as is'' without express or implied warranty.
X *
X * @(#)curses.ext 5.4 (Berkeley) 6/8/88
X */
X
X/*
X * External variables for the curses library
X */
X
X/* LINTLIBRARY */
X
X# include "curses.h"
X
Xextern bool _echoit, _rawmode, My_term, _endwin;
X
Xextern char ttytype[50], *_unctrl[];
X
Xextern int _tty_ch, LINES, COLS;
X
Xextern SGTTY _tty;
X
Xchar _putchar();
X
X#ifdef DEBUG
X# define outf _outf
X
XFILE *outf;
X#endif
END_OF_FILE
if test 862 -ne `wc -c <'curses.ext'`; then
echo shar: \"'curses.ext'\" unpacked with wrong size!
fi
# end of 'curses.ext'
fi
if test -f 'player.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'player.c'\"
else
echo shar: Extracting \"'player.c'\" \(3184 characters\)
sed "s/^X//" >'player.c' <<'END_OF_FILE'
X
X/* RCS Info: $Revision: 1.3 $ on $Date: 89/03/15 16:33:07 $
X * $Source: /yew3/faustus/src/scrabble/RCS/player.c,v $
X * Copyright (c) 1989 Wayne A. Christopher, U. C. Berkeley CS Dept
X * faustus@renoir.berkeley.edu, ucbvax!faustus
X * Permission is granted to modify and re-distribute this code in any manner
X * as long as this notice is preserved. All standard disclaimers apply.
X *
X */
X
X#include "scrabble.h"
X
Xplayer_t *
Xmakeplayer(board_t *board, int num)
X{
X player_t *player = (player_t *) util_malloc(sizeof (player_t));
X int i;
X char buf[BSIZE], *s;
X
X if (userpick) {
X while (player->numworking < WORK_SIZE) {
X printf("Input %d letters for player %d: ", WORK_SIZE -
X player->numworking, num);
X fgets(buf, BSIZE, stdin);
X s = buf;
X while ((player->numworking < WORK_SIZE) &&
X (*s != '\n')) {
X if (isupper(*s))
X *s = tolower(*s);
X else if (*s == ' ')
X *s = WILD;
X player->working[player->numworking++] =
X *s++;
X /* So that the count goes down. */
X (void) pickletter(board);
X }
X if (*s != '\n')
X printf("Ignored extra letters\n");
X }
X } else {
X for (i = 0; i < WORK_SIZE; i++)
X player->working[i] = pickletter(board);
X }
X
X player->numworking = WORK_SIZE;
X player->score = 0;
X player->machine = true;
X
X return (player);
X}
X
X/* Note that this must be called before boardmove. */
X
Xvoid
Xplayermove(board_t *board, player_t *player, move_t *move)
X{
X int i, j, k;
X char c;
X char buf[BSIZE], *s;
X bool found;
X
X player->score += move->points;
X
X for (i = 0; i < move->length; i++)
X if (!something(boardletter(board, move->x, move->y,
X move->horiz, i))) {
X found = false;
X for (j = 0; j < player->numworking; j++)
X if (player->working[j] == move->word[i]) {
X for (k = j; k < player->numworking - 1;
X k++)
X player->working[k] =
X player->working[k + 1];
X player->numworking--;
X found = true;
X break;
X }
X if (!found)
X for (j = 0; j < player->numworking; j++)
X if (player->working[j] == WILD) {
X for (k = j; k < player->
X numworking - 1;
X k++)
X player->working[k] =
X player->
X working[k + 1];
X player->numworking--;
X break;
X }
X }
X
X if (userpick) {
X if (board->numleft) {
X sprintf(buf, "Input %d letters: ",
X min(WORK_SIZE - player->numworking,
X board->numleft));
X s = user_question(buf);
X while (*s && player->numworking < WORK_SIZE) {
X if (!board->numleft)
X break;
X player->working[player->numworking++] =
X isupper(*s) ? tolower(*s) : *s;
X s++;
X (void) pickletter(board);
X }
X if (*s)
X user_message("Ignoring extra letters.\n");
X }
X } else {
X while (player->numworking < WORK_SIZE) {
X c = pickletter(board);
X if (something(c))
X player->working[player->numworking++] = c;
X else
X break;
X }
X }
X
X return;
X}
X
X#ifdef notdef
X
Xvoid
Xprintplayer(player_t *player, int num, FILE *fp)
X{
X int i;
X
X if (num >= 0)
X fprintf(fp, "Player %d: score = %d\tletters =", num,
X player->score);
X else
X fprintf(fp, "Score = %d\tletters =", player->score);
X for (i = 0; i < player->numworking; i++)
X fprintf(fp, " %c", player->working[i]);
X fprintf(fp, "\n");
X
X return;
X}
X
X#endif
X
END_OF_FILE
if test 3184 -ne `wc -c <'player.c'`; then
echo shar: \"'player.c'\" unpacked with wrong size!
fi
# end of 'player.c'
fi
if test -f 'plural.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'plural.c'\"
else
echo shar: Extracting \"'plural.c'\" \(1304 characters\)
sed "s/^X//" >'plural.c' <<'END_OF_FILE'
X
X/* RCS Info: $Revision: 1.1 $ on $Date: 89/03/15 11:17:10 $
X * $Source: /yew3/faustus/src/scrabble/RCS/plural.c,v $
X * Copyright (c) 1989 Wayne A. Christopher, U. C. Berkeley CS Dept
X * faustus@renoir.berkeley.edu, ucbvax!faustus
X * Permission is granted to modify and re-distribute this code in any manner
X * as long as this notice is preserved. All standard disclaimers apply.
X *
X * This program reads words from standard input and pluralizes them.
X */
X
X#include <stdio.h>
X#include <strings.h>
X
Xstruct {
X char *end;
X char *new;
X} endings[] = {
X { "s", "ses" },
X { "x", "xes" },
X { "z", "zes" },
X { "ch", "ches" },
X { "sh", "shes" },
X { "ey", "eys" },
X { "y", "ies" },
X { "", "s" }
X} ;
X
Xvoid
Xpluralize(char *word)
X{
X int i, wl, sl;
X char *s, *t;
X
X for (i = 0; i < sizeof (endings) / sizeof (endings[0]); i++) {
X for (s = word, wl = 0; *s; s++, wl++)
X ;
X for (t = endings[i].end, sl = 0; *t; t++, sl++)
X ;
X if (sl > wl)
X continue;
X s -= sl;
X for (t = endings[i].end; *t; t++, s++)
X if (*s != *t)
X break;
X if (!*t) {
X s -= sl;
X for (t = endings[i].new; *t; t++, s++)
X *s = *t;
X *s = '\0';
X break;
X }
X }
X}
X
Xmain()
X{
X char buf[512];
X
X while (fgets(buf, 512, stdin)) {
X buf[strlen(buf) - 1] = '\0';
X pluralize(buf);
X printf("%s\n", buf);
X }
X
X exit(0);
X}
X
END_OF_FILE
if test 1304 -ne `wc -c <'plural.c'`; then
echo shar: \"'plural.c'\" unpacked with wrong size!
fi
# end of 'plural.c'
fi
if test -f 'savegame.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'savegame.c'\"
else
echo shar: Extracting \"'savegame.c'\" \(681 characters\)
sed "s/^X//" >'savegame.c' <<'END_OF_FILE'
X
X/* RCS Info: $Revision: 1.1 $ on $Date: 89/03/15 11:17:14 $
X * $Source: /yew3/faustus/src/scrabble/RCS/savegame.c,v $
X * Copyright (c) 1989 Wayne A. Christopher, U. C. Berkeley CS Dept
X * faustus@renoir.berkeley.edu, ucbvax!faustus
X * Permission is granted to modify and re-distribute this code in any manner
X * as long as this notice is preserved. All standard disclaimers apply.
X *
X */
X
X#include "scrabble.h"
X
Xboard_t *
Xrestoregame(FILE *fp, int *nump, int *whosup, int *turn)
X{
X return (NULL);
X}
X
Xplayer_t *
Xrestoreplayer(FILE *fp)
X{
X return (NULL);
X}
X
Xvoid
Xsavegame(FILE *fp, int nump, int whosup, int turn)
X{
X return;
X}
X
Xvoid
Xsaveplayer(FILE *fp)
X{
X return;
X}
X
END_OF_FILE
if test 681 -ne `wc -c <'savegame.c'`; then
echo shar: \"'savegame.c'\" unpacked with wrong size!
fi
# end of 'savegame.c'
fi
if test -f 'user.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'user.c'\"
else
echo shar: Extracting \"'user.c'\" \(3417 characters\)
sed "s/^X//" >'user.c' <<'END_OF_FILE'
X
X/* RCS Info: $Revision: 1.1 $ on $Date: 89/03/15 11:17:22 $
X * $Source: /yew3/faustus/src/scrabble/RCS/user.c,v $
X * Copyright (c) 1989 Wayne A. Christopher, U. C. Berkeley CS Dept
X * faustus@renoir.berkeley.edu, ucbvax!faustus
X * Permission is granted to modify and re-distribute this code in any manner
X * as long as this notice is preserved. All standard disclaimers apply.
X *
X * With a minimum amount of hacking more device descriptions can be
X * added to this file.
X */
X
X#include "scrabble.h"
X
Xstruct device {
X void (*init)(board_t *board, player_t *players[], int numplayers);
X void (*message)(char *message);
X char *(*question)(char *message);
X bool (*confirm)(char *message);
X command_t (*command)(board_t *board, player_t *player, move_t *move);
X void (*drawplayer)(player_t *player, int pos, bool up);
X void (*drawsummary)(board_t *board, int turn);
X void (*drawmove)(board_t *board, move_t *move, player_t *player);
X void (*givehelp)();
X void (*update)();
X void (*cleanup)();
X} ;
X
Xstatic struct device tty_device = {
X tty_init,
X tty_message,
X tty_question,
X tty_confirm,
X tty_command,
X tty_drawplayer,
X tty_drawsummary,
X tty_drawmove,
X tty_givehelp,
X tty_update,
X tty_cleanup
X} ;
X
Xstatic struct device *dev;
X
Xvoid
Xuser_init(devtype_t type, board_t *board, player_t *players[], int numplayers)
X{
X switch (type) {
X case DEV_TTY: dev = &tty_device; break;
X default: abort();
X }
X
X (dev->init)(board, players, numplayers);
X return;
X}
X
Xvoid
Xuser_message(char *message)
X{
X (dev->message)(message);
X return;
X}
X
Xchar *
Xuser_question(char *message)
X{
X return ((dev->question)(message));
X}
X
Xbool
Xuser_confirm(char *message)
X{
X return ((dev->confirm)(message));
X}
X
Xcommand_t
Xuser_command(board_t *board, player_t *player, move_t *move)
X{
X return ((dev->command)(board, player, move));
X}
X
Xvoid
Xuser_drawplayer(player_t *player, int pos, bool up)
X{
X (dev->drawplayer)(player, pos, up);
X return;
X}
X
Xvoid
Xuser_drawsummary(board_t *board, int turn)
X{
X (dev->drawsummary)(board, turn);
X return;
X}
X
Xvoid
Xuser_drawmove(board_t *board, move_t *move, player_t *player)
X{
X (dev->drawmove)(board, move, player);
X return;
X}
X
Xvoid
Xuser_update()
X{
X (dev->update)();
X return;
X}
X
Xvoid
Xuser_cleanup()
X{
X (dev->cleanup)();
X return;
X}
X
Xvoid
Xuser_givehelp()
X{
X (dev->givehelp)();
X return;
X}
X
X#ifdef notdef
X
Xbool
Xreadmove(board_t *board, player_t *player, move_t *move)
X{
X char buf[BSIZE];
X int x, y, i;
X char dir, word[BSIZE];
X
X for (;;) {
X printplayer(player, -1, stdout);
X printf("Enter move [ x y dir word ]: ");
X fgets(buf, BSIZE, stdin);
X if (sscanf(buf, "%d %d %c %s", &x, &y, &dir, word) != 4) {
X printf("Invalid command.\n");
X printboard(board, stdout);
X continue;
X }
X move->x = x;
X move->y = y;
X move->horiz = (dir == 'h') ? true : false;
X for (i = 0; i < strlen(word); i++) {
X if (!isalpha(word[i])) {
X printf("Bad word.\n");
X break;
X } else if (isupper(word[i])) {
X word[i] = tolower(word[i]);
X }
X }
X if (word[i])
X continue;
X
X move->word = strsav(word);
X move->length = strlen(move->word);
X for (i = 0; i < SIZE; i++)
X move->wild[i] = false;
X
X if (!isaword(word)) {
X printf("I don't think \"%s\" is a word. Do you? ",
X word);
X fgets(buf, BSIZE, stdin);
X if ((buf[0] != 'y') && (buf[0] != 'Y'))
X continue;
X }
X trymove(move, board, player);
X
X if (move->points < 0) {
X printf("You can't do that.\n");
X continue;
X }
X
X return (true);
X }
X}
X
X#endif
X
END_OF_FILE
if test 3417 -ne `wc -c <'user.c'`; then
echo shar: \"'user.c'\" unpacked with wrong size!
fi
# end of 'user.c'
fi
if test -f 'util.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'util.c'\"
else
echo shar: Extracting \"'util.c'\" \(2328 characters\)
sed "s/^X//" >'util.c' <<'END_OF_FILE'
X
X/* RCS Info: $Revision: 1.1 $ on $Date: 89/03/10 10:11:10 $
X * $Source: /yew3/faustus/src/scrabble/RCS/util.c,v $
X * Copyright (c) 1988 Wayne A. Christopher, U. C. Berkeley CAD Group
X * faustus@cad.berkeley.edu, ucbvax!faustus
X * Permission is granted to modify and re-distribute this code in any manner
X * as long as this notice is preserved. All standard disclaimers apply.
X *
X */
X
X#include "util.h"
X#include <pwd.h>
X#include <sys/types.h>
X#include <sys/time.h>
X#include <sys/resource.h>
X
Xextern char *malloc();
Xextern char *realloc();
X
Xchar *
Xstrsav(str)
X char *str;
X{
X char *p;
X
X p = malloc(strlen(str) + 1);
X if (p)
X strcpy(p, str);
X return (p);
X}
X
Xchar *
Xstrstr(str, sub)
X char *str, *sub;
X{
X char *s, *t;
X
X while (*str) {
X if (*str == *sub) {
X for (s = sub, t = str; *s && *t; s++, t++)
X if (*s != *t)
X break;
X if (!*s)
X return (str);
X }
X str++;
X }
X return (NULL);
X}
X
Xchar *
Xutil_datestring()
X{
X register char *tzn;
X struct tm *tp;
X static char tbuf[40];
X char *ap;
X struct timeval tv;
X struct timezone tz;
X char *timezone(), *asctime();
X int i;
X struct tm *localtime();
X
X (void) gettimeofday(&tv, &tz);
X tp = localtime((time_t *) &tv.tv_sec);
X ap = asctime(tp);
X tzn = timezone(tz.tz_minuteswest, tp->tm_isdst);
X sprintf(tbuf, "%.20s", ap);
X if (tzn)
X strcat(tbuf, tzn);
X strcat(tbuf, ap + 19);
X i = strlen(tbuf);
X tbuf[i - 1] = '\0';
X return (tbuf);
X}
X
Xint
Xutil_seconds()
X{
X struct rusage ruse;
X
X getrusage(RUSAGE_SELF, &ruse);
X return (ruse.ru_utime.tv_sec);
X}
X
Xchar *
Xutil_tildexpand(s)
X char *s;
X{
X struct passwd *pw;
X char *n, buf[64];
X int i;
X
X if (*s != '~') {
X n = malloc(strlen(s) + 1);
X strcpy(n, s);
X return (n);
X }
X
X for (s++, i = 0; *s != '/'; s++, i++)
X buf[i] = *s;
X buf[i] = '\0';
X if (!i)
X pw = getpwuid(getuid());
X else
X pw = getpwnam(buf);
X if (!pw)
X return (s);
X n = malloc(strlen(s) + strlen(pw->pw_dir) + 1);
X strcpy(n, pw->pw_dir);
X strcat(n, s);
X return (n);
X}
X
Xchar *
Xutil_malloc(num)
X int num;
X{
X char *s;
X
X s = malloc((unsigned) num);
X if (!s) {
X fprintf(stderr, "malloc: can't allocate %d bytes", num);
X exit(1);
X }
X bzero(s, num);
X return (s);
X}
X
Xchar *
Xutil_realloc(ptr, num)
X char *ptr;
X int num;
X{
X char *s;
X
X s = realloc(ptr, (unsigned) num);
X if (!s) {
X fprintf(stderr, "realloc: can't allocate %d bytes", num);
X exit(1);
X }
X return (s);
X}
X
END_OF_FILE
if test 2328 -ne `wc -c <'util.c'`; then
echo shar: \"'util.c'\" unpacked with wrong size!
fi
# end of 'util.c'
fi
if test -f 'util.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'util.h'\"
else
echo shar: Extracting \"'util.h'\" \(1876 characters\)
sed "s/^X//" >'util.h' <<'END_OF_FILE'
X
X/* RCS Info: $Revision: 1.1 $ on $Date: 89/03/10 10:11:14 $
X * $Source: /yew3/faustus/src/scrabble/RCS/util.h,v $
X * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
X *
X * Standard definitions.
X */
X
X#define UNIX
X#define BSD
X
X/* vcc has problems with math.h */
X
X#define u3b 0
X#define u3b5 0
X#define gcos 0
X#define gould 0
X#define pdp11 0
X#define u370 0
X
X#ifndef FILE
X#include <stdio.h>
X#endif
X#ifndef isalpha
X#include <ctype.h>
X#endif
X#ifndef HUGE
X#include <math.h>
X#endif
X#include <strings.h>
X
X#ifdef assert
X#undef assert
X#endif
X
X#define assert(ex) \
X {if (!(ex)) {\
X fprintf(stderr,"Internal error: file %s, line %d\n",\
X __FILE__, __LINE__);\
X abort();\
X }}
X
Xtypedef int bool;
X
X#define false 0
X#define true 1
X
X#define boolname(vv) ((vv) ? "true" : "false")
X
X#define gprof_point(name) asm(" .globl name"); asm("name:");
X
X#define BSIZE 512
X
X/* Some standard macros. */
X
X#define eq(a,b) (!strcmp((a), (b)))
X#define alloc(strname) ((struct strname *) util_malloc(sizeof(struct strname)))
X#define max(i, j) (((i) > (j)) ? (i) : (j))
X#define min(i, j) (((i) < (j)) ? (i) : (j))
X#define badness() { fprintf(stderr, \
X "Internal Error: line %d in file %s\n",\
X __LINE__, __FILE__);\
X exit(1); }
X
X#define EXIT_NORMAL 0
X#define EXIT_BAD 1
X
X/* Utility things. */
X
Xextern char *strsav();
Xextern char *strstr();
Xextern char *util_datestring();
Xextern char *util_malloc();
Xextern char *util_realloc();
Xextern int util_seconds();
Xextern char *util_tildexpand();
X
X/* Externs from libc */
X
Xextern char *getenv();
Xextern char *mktemp();
Xextern int errno;
Xextern char *sys_errlist[];
Xextern double atof();
Xextern long random();
Xextern void srandom();
Xextern long time();
Xextern void exit();
Xextern void bcopy();
Xextern char *sbrk();
Xextern char *getlogin();
Xextern void free();
Xextern void perror();
Xextern void abort();
X
END_OF_FILE
if test 1876 -ne `wc -c <'util.h'`; then
echo shar: \"'util.h'\" unpacked with wrong size!
fi
# end of 'util.h'
fi
echo shar: End of archive 2 \(of 2\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked both archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0