games@saab.CNA.TEK.COM (10/27/88)
Submitted by: conrad@cgl.ucsf.edu Comp.sources.games: Volume 5, Issue 78 Archive-name: hunt2/Part04 [I got several reports that this got lost along the way. -br] #! /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 4 (of 4)." # Contents: bsd.h pathname.c talk_ctl.h terminal.c # Wrapped by billr@saab on Wed Oct 19 09:23:35 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'bsd.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'bsd.h'\" else echo shar: Extracting \"'bsd.h'\" \(456 characters\) sed "s/^X//" >'bsd.h' <<'END_OF_FILE' X/* X * Hunt X * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold X * San Francisco, California X * X * Copyright (c) 1985 Regents of the University of California. X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X */ X X# if BSD >= 43 X# define BROADCAST X# define SYSLOG_43 X# define TALK_43 X# endif X# if BSD == 42 X# define SYSLOG_42 X# define TALK_42 X# endif END_OF_FILE if test 456 -ne `wc -c <'bsd.h'`; then echo shar: \"'bsd.h'\" unpacked with wrong size! fi # end of 'bsd.h' fi if test -f 'pathname.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'pathname.c'\" else echo shar: Extracting \"'pathname.c'\" \(962 characters\) sed "s/^X//" >'pathname.c' <<'END_OF_FILE' X/* X * Hunt X * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold X * San Francisco, California X * X * Copyright (c) 1985 Regents of the University of California. X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X */ X X/* X * There is no particular significance to the numbers assigned X * to Test_port. They're just random numbers greater than the X * range reserved for privileged sockets. X */ X X# ifdef DEBUG X Xchar *Driver = "/va/conrad/games/src/hunt/huntd.dbg"; X# ifdef INTERNET Xint Test_port = ('h' << 8) | 't'; X# else INTERNET Xchar *Sock_name = "/tmp/hunt"; X# endif INTERNET Xchar *Stat_file = "/va/conrad/games/src/hunt/hunt.stats"; X X# else DEBUG X Xchar *Driver = "/usr/games/lib/huntd"; X# ifdef INTERNET Xint Test_port = ('h' << 8) | 't'; X# else INTERNET Xchar *Sock_name = "/tmp/hunt"; X# endif INTERNET Xchar *Stat_file = "/usr/tmp/hunt.stats"; X X# endif DEBUG END_OF_FILE if test 962 -ne `wc -c <'pathname.c'`; then echo shar: \"'pathname.c'\" unpacked with wrong size! fi # end of 'pathname.c' fi if test -f 'talk_ctl.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'talk_ctl.h'\" else echo shar: Extracting \"'talk_ctl.h'\" \(1818 characters\) sed "s/^X//" >'talk_ctl.h' <<'END_OF_FILE' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X * X * @(#)talk_ctl.h 5.2 (Berkeley) 3/13/86 X */ X X#include <sys/types.h> X#include <netinet/in.h> X X#ifdef TALK_43 X#include <protocols/talkd.h> X#else X#include <sys/socket.h> X X#define NAME_SIZE 9 X#define TTY_SIZE 16 X#ifndef MAXHOSTNAMELEN X#define MAXHOSTNAMELEN 256 X#endif X X#define MAX_LIFE 60 /* max time daemon saves invitations */ X/* RING_WAIT should be 10's of seconds less than MAX_LIFE */ X#define RING_WAIT 30 /* time to wait before refreshing invitation */ X X/* type values */ X#define LEAVE_INVITE 0 X#define LOOK_UP 1 X#define DELETE 2 X#define ANNOUNCE 3 X X/* answer values */ X#define SUCCESS 0 X#define NOT_HERE 1 X#define FAILED 2 X#define MACHINE_UNKNOWN 3 X#define PERMISSION_DENIED 4 X#define UNKNOWN_REQUEST 5 X Xtypedef struct ctl_response { X char type; X char answer; X int id_num; X struct sockaddr_in addr; X} CTL_RESPONSE; X Xtypedef struct ctl_msg { X char type; X char l_name[NAME_SIZE]; X char r_name[NAME_SIZE]; X int id_num; X int pid; X char r_tty[TTY_SIZE]; X struct sockaddr_in addr; X struct sockaddr_in ctl_addr; X} CTL_MSG; X#endif X X#include <errno.h> X#ifdef LOG X#include <syslog.h> X#endif X Xextern int errno; X Xextern struct sockaddr_in daemon_addr; Xextern struct sockaddr_in ctl_addr; Xextern struct sockaddr_in my_addr; Xextern struct in_addr my_machine_addr; Xextern struct in_addr his_machine_addr; Xextern u_short daemon_port; Xextern int ctl_sockt; Xextern CTL_MSG msg; X X#ifdef LOG X#define p_error(str) syslog(LOG_WARNING, "faketalk %s: %m", str) X#else LOG X#define p_error(str) perror(str) X#endif LOG X X# ifndef htons Xextern unsigned short htons(), ntohs(); X# endif X# ifndef htonl Xextern unsigned long htonl(), ntohl(); X# endif END_OF_FILE if test 1818 -ne `wc -c <'talk_ctl.h'`; then echo shar: \"'talk_ctl.h'\" unpacked with wrong size! fi # end of 'talk_ctl.h' fi if test -f 'terminal.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'terminal.c'\" else echo shar: Extracting \"'terminal.c'\" \(1922 characters\) sed "s/^X//" >'terminal.c' <<'END_OF_FILE' X/* X * Hunt X * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold X * San Francisco, California X * X * Copyright (c) 1985 Regents of the University of California. X * All rights reserved. The Berkeley software License Agreement X * specifies the terms and conditions for redistribution. X */ X X# include "hunt.h" X# define TERM_WIDTH 80 /* Assume terminals are 80-char wide */ X X/* X * cgoto: X * Move the cursor to the given position on the given player's X * terminal. X */ Xcgoto(pp, y, x) Xregister PLAYER *pp; Xregister int y, x; X{ X if (x == pp->p_curx && y == pp->p_cury) X return; X sendcom(pp, MOVE, y, x); X pp->p_cury = y; X pp->p_curx = x; X} X X/* X * outch: X * Put out a single character. X */ Xoutch(pp, ch) Xregister PLAYER *pp; Xchar ch; X{ X if (++pp->p_curx >= TERM_WIDTH) { X pp->p_curx = 0; X pp->p_cury++; X } X (void) putc(ch, pp->p_output); X} X X/* X * outstr: X * Put out a string of the given length. X */ Xoutstr(pp, str, len) Xregister PLAYER *pp; Xregister char *str; Xregister int len; X{ X pp->p_curx += len; X pp->p_cury += (pp->p_curx / TERM_WIDTH); X pp->p_curx %= TERM_WIDTH; X while (len--) X (void) putc(*str++, pp->p_output); X} X X/* X * clrscr: X * Clear the screen, and reset the current position on the screen. X */ Xclrscr(pp) Xregister PLAYER *pp; X{ X sendcom(pp, CLEAR); X pp->p_cury = 0; X pp->p_curx = 0; X} X X/* X * ce: X * Clear to the end of the line X */ Xce(pp) XPLAYER *pp; X{ X sendcom(pp, CLRTOEOL); X} X X/* X * ref; X * Refresh the screen X */ Xref(pp) Xregister PLAYER *pp; X{ X sendcom(pp, REFRESH); X} X X/* X * sendcom: X * Send a command to the given user X */ X/* VARARGS2 */ Xsendcom(pp, command, arg1, arg2) Xregister PLAYER *pp; Xregister int command; Xint arg1, arg2; X{ X (void) putc(command, pp->p_output); X switch (command & 0377) { X case MOVE: X (void) putc(arg1, pp->p_output); X (void) putc(arg2, pp->p_output); X break; X case ADDCH: X case READY: X (void) putc(arg1, pp->p_output); X break; X } X} END_OF_FILE if test 1922 -ne `wc -c <'terminal.c'`; then echo shar: \"'terminal.c'\" unpacked with wrong size! fi # end of 'terminal.c' fi echo shar: End of archive 4 \(of 4\). cp /dev/null ark4isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 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