games@tekred.TEK.COM (06/01/88)
Submitted by: udenva!koala!dir (Dan Rosenblatt) Comp.sources.games: Volume 4, Issue 24 Archive-name: spacewar/Part04 #! /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 6)." # Contents: Makefile alninit.c build.h damage.c psw.c sw.c upddbm.c # upddmg.c updsys.c usrcmd.c vmspsw.c # Wrapped by billr@saab on Tue May 31 09:54:53 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(4797 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' X# X# Spacewar - makefile X# X# Copyright 1984 obo Systems, Inc. X# Copyright 1984 Dan Rosenblatt X# XLDFLAGS= -n XCFLAGS= -O -DBSD -DVOID=void -m68020 -f68881 -DNEEDFMOD XLPR= lpr X XINCLUDES= aln.h build.h crft.h flds.h login.h mlbx.h obj.h plyr.h \ X spacewar.h sys.h torp.h ucmd.h uio.h uio2.h universe.h XSOURCES= sw.c globals.c lckmsg.c proctrap.c shutdown.c \ X alninit.c objinit.c crftupdate.c objupdate.c \ X logon.c logoff.c \ X cmd.c prvcmd.c \ X build.c mail.c see.c usrcmd.c who.c \ X play.c plinit.c unplay.c \ X update.c \ X updaln.c upddmg.c upddsh.c updmov.c updobjs.c updsys.c updtorp.c \ X bfuncs.c bits.c damage.c fixdir.c mutils.c vdisp.c remove.c rpt.c \ X output.c scrn.c XOBJECTS= sw.o globals.o lckmsg.o proctrap.o shutdown.o \ X alninit.o objinit.o crftupdate.o objupdate.o \ X logon.o logoff.o \ X cmd.o prvcmd.o \ X build.o mail.o see.o usrcmd.o who.o \ X play.o plinit.o unplay.o \ X update.o \ X updaln.o upddmg.o upddsh.o updmov.o updobjs.o updsys.o updtorp.o \ X bfuncs.o bits.o damage.o fixdir.o mutils.o vdisp.o remove.o rpt.o \ X output.o scrn.o X Xall : sw psw rsw dmpdbm upddbm tstsz X X.PRECIOUS: print send X Xprint : Makefile ${INCLUDES} ${SOURCES} psw.c psw.sh vmspsw.c rsw.c vmsrsw.c \ X tget.c dmpdbm.c upddbm.c tstsz.c swobj.init dbm.h dbm.c \ X vmsdelmbx.c X pr $? | ${LPR} X touch print X Xsend : Makefile ${INCLUDES} ${SOURCES} psw.c psw.sh vmspsw.c rsw.c vmsrsw.c \ X tget.c dmpdbm.c upddbm.c tstsz.c swobj.init doc dbm.h dbm.c \ X vmsdelmbx.c swnews X uucp $? 'obo586!~/sw/' X touch send X Xclean : X rm *.o sw psw rsw dmpdbm upddbm tstsz X Xsw : ${OBJECTS} X ${CC} ${CFLAGS} ${LDFLAGS} -o sw ${OBJECTS} -ltermlib -ldbm -lm X chmod u+s sw X Xpsw : psw.c spacewar.h uio2.h X ${CC} ${CFLAGS} ${LDFLAGS} psw.c -o psw X chmod u+s psw X Xrsw : rsw.c login.h uio.h universe.h spacewar.h X ${CC} ${CFLAGS} ${LDFLAGS} rsw.c -o rsw X Xdmpdbm : dmpdbm.c spacewar.h universe.h login.h sys.h crft.h mlbx.h \ X plyr.h ucmd.h bfuncs.o X ${CC} ${CFLAGS} ${LDFLAGS} dmpdbm.c bfuncs.o -ldbm -o dmpdbm X Xupddbm : upddbm.c spacewar.h universe.h login.h sys.h crft.h mlbx.h \ X plyr.h ucmd.h bfuncs.o X ${CC} ${CFLAGS} ${LDFLAGS} upddbm.c bfuncs.o -ldbm -o upddbm X Xtstsz : tstsz.c uio.h uio2.h spacewar.h X ${CC} ${CFLAGS} ${LDFLAGS} tstsz.c -o tstsz X tstsz X Xlint : ${SOURCES} psw.c rsw.c dmpdbm.c upddbm.c tstsz.c X lint ${CFLAGS} ${SOURCES} X lint ${CFLAGS} psw.c X lint ${CFLAGS} rsw.c X lint ${CFLAGS} dmpdbm.c bfuncs.c X lint ${CFLAGS} upddbm.c bfuncs.c X lint ${CFLAGS} tstsz.c X Xbfuncs.o : spacewar.h X Xbits.o : spacewar.h X Xsw.o : spacewar.h X Xproctrap.o : spacewar.h universe.h login.h uio2.h X Xglobals.o : universe.h torp.h sys.h obj.h login.h crft.h aln.h spacewar.h X Xlogon.o : spacewar.h universe.h login.h X Xlogoff.o : universe.h login.h spacewar.h X Xoutput.o : spacewar.h universe.h login.h flds.h sys.h X Xcmd.o : spacewar.h universe.h login.h uio.h plyr.h mlbx.h uio2.h X Xshutdown.o : spacewar.h universe.h login.h X Xmail.o : spacewar.h universe.h login.h mlbx.h plyr.h X Xbuild.o : universe.h login.h build.h sys.h crft.h obj.h spacewar.h X Xsee.o : universe.h login.h sys.h crft.h plyr.h spacewar.h X Xusrcmd.o : spacewar.h universe.h login.h ucmd.h X Xobjinit.o : spacewar.h universe.h obj.h X Xobjupdate.o : spacewar.h universe.h obj.h X Xalninit.o : spacewar.h universe.h sys.h aln.h obj.h build.h X Xprvcmd.o : spacewar.h universe.h login.h sys.h aln.h build.h obj.h crft.h torp.h X Xwho.o : spacewar.h universe.h login.h X Xplay.o : spacewar.h universe.h login.h sys.h crft.h flds.h build.h aln.h obj.h \ X torp.h ucmd.h X Xplinit.o : spacewar.h universe.h login.h sys.h crft.h obj.h aln.h torp.h build.h X Xupdobjs.o : spacewar.h universe.h obj.h X Xdamage.o : spacewar.h universe.h sys.h login.h crft.h aln.h flds.h build.h \ X obj.h torp.h X Xlckmsg.o : spacewar.h X Xfixdir.o : spacewar.h universe.h sys.h crft.h flds.h X Xcrftupdate.o : universe.h login.h sys.h crft.h spacewar.h X Xunplay.o : spacewar.h universe.h plyr.h login.h crft.h sys.h X Xrpt.o : universe.h login.h sys.h crft.h flds.h spacewar.h X Xremove.o : spacewar.h sys.h login.h crft.h obj.h torp.h universe.h flds.h aln.h X Xscrn.o : universe.h login.h flds.h spacewar.h sys.h crft.h build.h aln.h obj.h \ X torp.h X Xupdate.o : spacewar.h universe.h login.h sys.h aln.h build.h flds.h torp.h \ X crft.h X Xupddmg.o : spacewar.h universe.h sys.h login.h crft.h build.h aln.h flds.h \ X obj.h torp.h X Xupdsys.o : spacewar.h universe.h login.h sys.h obj.h aln.h crft.h build.h \ X flds.h torp.h X Xupddsh.o : spacewar.h universe.h login.h sys.h aln.h crft.h flds.h obj.h torp.h X Xupdmov.o : spacewar.h universe.h sys.h login.h obj.h crft.h aln.h torp.h \ X build.h flds.h X Xupdtorp.o : spacewar.h universe.h sys.h login.h crft.h aln.h torp.h obj.h X Xupdaln.o : spacewar.h universe.h sys.h aln.h build.h login.h crft.h torp.h \ X obj.h flds.h X Xvdisp.o : spacewar.h universe.h login.h sys.h aln.h crft.h obj.h torp.h END_OF_Makefile if test 4797 -ne `wc -c <Makefile`; then echo shar: \"Makefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f alninit.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"alninit.c\" else echo shar: Extracting \"alninit.c\" \(2244 characters\) sed "s/^X//" >alninit.c <<'END_OF_alninit.c' X/* X * Spacewar - set up aliens into the universe X * X * Copyright 1985 obo Systems, Inc. X * Copyright 1985 Dan Rosenblatt X */ X X#include "spacewar.h" X#include "universe.h" X#include "sys.h" X#include "aln.h" X#include "obj.h" X#include "build.h" X XVOID alninit() X{ X struct aln *paln=alnlst+MAXALN; X int i; X struct sysc *psysc; X struct sys *psys; X struct universe *puniv; X X#ifdef DEBUG X DBG("alninit()\n"); X#endif X X /* build all the aliens, one at a time */ X while (paln-- > alnlst) { X X /* random position, but not too far */ X /* from the plane of the ecliptic */ X paln->al_pstn[0] = SUB(MUL(FLOAT(RANDOM(100)),4000.),200000.); X paln->al_pstn[1] = SUB(MUL(FLOAT(RANDOM(100)),4000.),200000.); X paln->al_pstn[2] = SUB(MUL(FLOAT(RANDOM(100)),100.),5000.); X X /* no velocity or thrust */ X vinit(paln->al_vel); X vinit(paln->al_thr); X X /* not doing(attacking) anything */ X paln->al_dly = 0; X paln->al_lhit.ip_ptr = NULL; X paln->al_atck.ip_ptr = NULL; X paln->al_aeval = 0; X X /* choose a (random) hull type and give */ X /* random percentages of each subsystem */ X paln->al_htyp = RANDOM(6) + 4; /* see build.h */ X for (i=0;i < MSYS && i < MAXSYS;++i) { X X /* point to alien subsystem and configuration */ X psys = paln->al_sys + i; X psysc = &config[i][paln->al_htyp]; X if (!psysc->sc_cap) continue; /* not in this craft */ X X /* actual% = recommended% +/- 20 and within limits */ X if ((psys->s_pct = psysc->sc_rpct + RANDOM(40) - 20) > 100) X psys->s_pct = 100; X else if (psys->s_pct < 0) X psys->s_pct = 0; X X /* rest of subsystem */ X psys->s_edmg = psysc->sc_edmg; X psys->s_dmg = 0; X psys->s_lvl = psysc->sc_ilvl; X psys->s_cap = psysc->sc_cap; X if (i == ROCKETS) X psys->s_lvl = ((long)psys->s_lvl * (long)psys->s_pct) X / 100L; X else if (i == TORPS) X psys->s_lvl = (psys->s_cap * psys->s_lvl) / 100L; X } X X /* place into universe */ X puniv = univlst + MAXOBJ + (paln-alnlst); X puniv->uv_type = 'A'; X puniv->uv_pctr = paln->al_htyp + '0'; X puniv->uv_pstn = paln->al_pstn; X puniv->uv_mass = paln->al_sys[HULL].s_dmg; /* kludge */ X puniv->uv_rad = 1; X puniv->uv_ptr.uv_aln = paln; X paln->al_univ.ip_ptr = puniv; X } X#ifdef DEBUG X VDBG("alninit return\n"); X#endif X} END_OF_alninit.c if test 2244 -ne `wc -c <alninit.c`; then echo shar: \"alninit.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f build.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"build.h\" else echo shar: Extracting \"build.h\" \(5215 characters\) sed "s/^X//" >build.h <<'END_OF_build.h' X/* X * Spacewar - system configuration tables for player and alien ships X * includes system name and offset X * X * Copyright 1984 obo Systems, Inc. X * Copyright 1984 Dan Rosenblatt X */ X X#define MAXSYS 11 X#define MAXHTYP 9 X X#define HULL 0 X#define SOLARE 1 X#define ANTME 2 X#define WARP 3 X#define ROCKETS 4 X#define DILITH 5 X#define PHASERS 6 X#define SHIELDS 7 X#define TORPS 8 X#define DMGCON 9 X#define SECURITY 10 X X#ifndef BUILD Xextern X#endif Xchar *subsysnam[MAXSYS] X#ifdef BUILD X = { X "Hull", X "Solar E.", X "Antm. E.", X "Warp", X "Rockets", X "Dilith.", X "Phasers", X "Shields", X "Torps.", X "Dmg.Con.", X "Security" X} X#endif X; X X#ifndef BUILD Xextern X#endif Xstruct sysc { X long sc_bsp; /* system configuration base space */ X long sc_bcr; /* system configuration base crew */ X long sc_fsp; /* system configuration 100% space */ X long sc_fcr; /* system configuration 100% crew */ X char sc_edmg; /* system configuration ease of damage */ X short sc_ilvl; /* system configuration initial level */ X short sc_cap; /* system configuration capacity */ X char sc_rpct; /* system configuration recommended % */ X X} config[MAXSYS][MAXHTYP+1] X#ifdef BUILD X = { /* varies by system, hull */ X X/* Hull */{ X /* 0 */ {0}, X /* 1 */ {16500, 120, 0, 0, 40, 0, 15, 100}, X /* 2 */ {18000, 100, 0, 0, 40, 0, 12, 100}, X /* 3 */ {17500, 110, 0, 0, 40, 0, 9, 100}, X /* 4 */ {0, 0, 0, 0, 40, 0, 15, 100}, X /* 5 */ {0, 0, 0, 0, 35, 0, 12, 100}, X /* 6 */ {0, 0, 0, 0, 45, 0, 9, 100}, X /* 7 */ {0, 0, 0, 0, 40, 0, 10, 100}, X /* 8 */ {0, 0, 0, 0, 40, 0, 10, 100}, X /* 9 */ {0, 0, 0, 0, 40, 0, 10, 100} X }, X X/* Solar E. */{ X /* 0 */ {0}, X /* 1 */ {250, 1, 450, 4, 100, 0, 35, 30}, X /* 2 */ {250, 1, 1000, 10, 100, 0, 50, 40}, X /* 3 */ {250, 1, 550, 5, 100, 0, 40, 35}, X /* 4 */ {0, 0, 0, 0, 100, 0, 35, 30}, X /* 5 */ {0, 0, 0, 0, 100, 0, 50, 40}, X /* 6 */ {0, 0, 0, 0, 100, 0, 40, 35}, X /* 7 */ {0, 0, 0, 0, 100, 0, 20, 80}, X /* 8 */ {0, 0, 0, 0, 100, 0, 25, 75}, X /* 9 */ {0, 0, 0, 0, 100, 0, 25, 70} X }, X X/* Antm. E. */{ X /* 0 */ {0}, X /* 1 */ {500, 1, 2400, 8, 50, 0, 35, 100}, X /* 2 */ {500, 1, 1500, 5, 50, 0, 30, 100}, X /* 3 */ {500, 1, 3000, 10, 50, 0, 40, 100}, X /* 4 */ {0, 0, 0, 0, 70, 0, 50, 80}, X /* 5 */ {0, 0, 0, 0, 60, 0, 30, 100}, X /* 6 */ {0, 0, 0, 0, 65, 0, 40, 90}, X /* 7 */ {0, 0, 0, 0, 50, 0, 35, 70}, X /* 8 */ {0, 0, 0, 0, 50, 0, 45, 85}, X /* 9 */ {0, 0, 0, 0, 45, 0, 70, 100} X }, X X/* Warp */{ X /* 0 */ {0}, X /* 1 */ {1000, 10, 2000, 20, 70, 3000, 3000, 100}, X /* 2 */ {1000, 10, 2500, 25, 70, 4000, 4000, 100}, X /* 3 */ {1000, 10, 5000, 40, 70, 7000, 7000, 100}, X /* 4 */ {0, 0, 0, 0, 70, 3000, 3000, 100}, X /* 5 */ {0, 0, 0, 0, 70, 4000, 4000, 90}, X /* 6 */ {0, 0, 0, 0, 70, 6000, 6000, 80}, X /* 7 */ {0, 0, 0, 0, 50, 2000, 2000, 100}, X /* 8 */ {0, 0, 0, 0, 60, 4000, 4000, 60}, X /* 9 */ {0, 0, 0, 0, 80, 10000, 10000, 50} X }, X X/* Rockets */{ X /* 0 */ {0}, X /* 1 */ {200, 4, 5000, 20, 30, 7500, 15, 45}, X /* 2 */ {200, 4, 3750, 15, 30, 5625, 12, 30}, X /* 3 */ {200, 4, 2500, 10, 30, 3750, 9, 20}, X /* 4 */ {0, 0, 0, 0, 40, 10000, 15, 45}, X /* 5 */ {0, 0, 0, 0, 40, 10000, 12, 30}, X /* 6 */ {0, 0, 0, 0, 40, 10000, 9, 20}, X /* 7 */ {0, 0, 0, 0, 40, 10000, 20, 50}, X /* 8 */ {0, 0, 0, 0, 40, 10000, 25, 40}, X /* 9 */ {0, 0, 0, 0, 50, 10000, 8, 45} X }, X X/* Dilith. */{ X /* 0 */ {0}, X /* 1 */ {500, 4, 4000, 10, 10, 5000, 5000, 50}, X /* 2 */ {500, 4, 4000, 10, 10, 5000, 5000, 50}, X /* 3 */ {500, 4, 4000, 10, 10, 5000, 5000, 50}, X /* 4 */ {0, 0, 0, 0, 10, 5000, 5000, 60}, X /* 5 */ {0, 0, 0, 0, 15, 5500, 5500, 50}, X /* 6 */ {0, 0, 0, 0, 10, 4500, 4500, 70}, X /* 7 */ {0, 0, 0, 0, 15, 5000, 5000, 55}, X /* 8 */ {0, 0, 0, 0, 20, 6000, 6000, 70}, X /* 9 */ {0, 0, 0, 0, 20, 5800, 5800, 65} X }, X X/* Phasers */{ X /* 0 */ {0}, X /* 1 */ {500, 5, 2400, 8, 40, 0, 80, 70}, X /* 2 */ {500, 5, 2100, 7, 40, 0, 70, 80}, X /* 3 */ {500, 5, 3000, 10, 40, 0, 100, 100}, X /* 4 */ {0, 0, 0, 0, 40, 0, 150, 75}, X /* 5 */ {0, 0, 0, 0, 40, 0, 140, 80}, X /* 6 */ {0, 0, 0, 0, 40, 0, 160, 70}, X /* 7 */ {0, 0, 0, 0, 40, 0, 140, 60}, X /* 8 */ {0, 0, 0, 0, 45, 0, 170, 85}, X /* 9 */ {0, 0, 0, 0, 90, 0, 250, 100} X }, X X/* Shields */{ X /* 0 */ {0}, X /* 1 */ {1500, 2, 700, 7, 20, 50, 70, 100}, X /* 2 */ {1500, 2, 1000, 10, 20, 50, 85, 90}, X /* 3 */ {1500, 2, 500, 5, 20, 50, 75, 90}, X /* 4 */ {0, 0, 0, 0, 20, 20, 70, 100}, X /* 5 */ {0, 0, 0, 0, 20, 20, 85, 90}, X /* 6 */ {0, 0, 0, 0, 20, 20, 60, 80}, X /* 7 */ {0, 0, 0, 0, 20, 20, 70, 80}, X /* 8 */ {0, 0, 0, 0, 50, 10, 50, 100}, X /* 9 */ {0, 0, 0, 0, 80, 10, 90, 75} X }, X X/* Torps. */{ X /* 0 */ {0}, X /* 1 */ {1000, 6, 500, 5, 60, 35, 10, 20}, X /* 2 */ {1000, 6, 1000, 10, 60, 35, 20, 20}, X /* 3 */ {1000, 6, 600, 6, 60, 35, 12, 40} X }, X X/* Dmg.Con. */{ X /* 0 */ {0}, X /* 1 */ {0, 1, 30, 30, 20, 0, 100, 100}, X /* 2 */ {0, 1, 30, 30, 20, 0, 100, 100}, X /* 3 */ {0, 1, 30, 30, 20, 0, 100, 100}, X /* 4 */ {0, 0, 0, 0, 20, 0, 80, 100}, X /* 5 */ {0, 0, 0, 0, 20, 0, 70, 100}, X /* 6 */ {0, 0, 0, 0, 20, 0, 80, 100}, X /* 7 */ {0, 0, 0, 0, 20, 0, 70, 100}, X /* 8 */ {0, 0, 0, 0, 20, 0, 80, 100}, X /* 9 */ {0, 0, 0, 0, 20, 0, 80, 100} X }, X X/* Security */{ X /* 0 */ {0}, X /* 1 */ {0, 1, 30, 30, 20, 0, 100, 0}, X /* 2 */ {0, 1, 30, 30, 20, 0, 100, 0}, X /* 3 */ {0, 1, 30, 30, 20, 0, 100, 0} X } X} X#endif X; END_OF_build.h if test 5215 -ne `wc -c <build.h`; then echo shar: \"build.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f damage.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"damage.c\" else echo shar: Extracting \"damage.c\" \(5340 characters\) sed "s/^X//" >damage.c <<'END_OF_damage.c' X/* X * Spacewar - inflict damage (proximity based) X * reports damage to inflictee X * reports to and credits inflictor X * X * Copyright 1985 obo Systems, Inc. X * Copyright 1985 Dan Rosenblatt X */ X X#include "spacewar.h" X#ifndef VMS X#include <sys/types.h> X#else /* BSD SYSIII SYSV */ X#include <types.h> X#endif /* VMS */ X#include "universe.h" X#include "sys.h" X#include "login.h" X#include "crft.h" X#include "aln.h" X#include "flds.h" X#include "build.h" X#include "obj.h" X#include "torp.h" X XVOID damage(patck,ptrgt,rng,dmg,msg) Xstruct universe *patck,*ptrgt; Xdouble rng,dmg; Xchar *msg; X{ X register struct universe *puniv; X struct universe *plhit,*prvatck; X register struct sys *psys,*psysdmg; X struct crft *pcrft; X struct aln *paln; X struct torp *ptorp; X double vdist(),trgtdist; X int inflict,savinflict,totinflict=0,sh,ishulldmg,sysdmg; X char buf[80+1]; X dsplcmnt tmpdspl; X X#ifdef DEBUG X DBG("damage(#%3d,.,%f,%f,%s)\n",patck-univlst,rng,dmg,msg); X#endif X X /* is it from hull damage; last hit by */ X ishulldmg = (SUB(dmg,DIV(1.,690.)) <= 0.); X plhit = patck; X if (plhit && plhit->uv_type == 'T') X plhit = plhit->uv_ptr.uv_torp->tp_fby.ip_ptr; X X /******************************************/ X /* find all damageable stuff within range */ X /******************************************/ X for (puniv=univlst+MAXUNIVERSE;puniv-- > univlst;) { X if (!puniv->uv_type) continue; X if (puniv->uv_type == 'O') continue; X X tmpdspl = vdisp(puniv,ptrgt,'d'); X /*if (SUB(vdist(puniv->uv_pstn,ptrgt->uv_pstn),rng) > 0.) continue;*/ X if (SUB(tmpdspl.dst,rng) > 0.) continue; X X /*******************************/ X /* figure shielding protection */ X /*******************************/ X psys = NULL; X pcrft = NULL; X paln = NULL; X ptorp = NULL; X switch(puniv->uv_type) { X case 'T': X if (patck == puniv) continue; X ptorp = puniv->uv_ptr.uv_torp; X sh = 30; X if (plhit) ptorp->tp_lhit.ip_ptr = plhit; X break; X case 'A': X paln = puniv->uv_ptr.uv_aln; X psys = paln->al_sys; X sh = 3; X if (plhit) { X prvatck = paln->al_lhit.ip_ptr; X paln->al_lhit.ip_ptr = plhit; X if (plhit->uv_type != 'P' || X !plhit->uv_ptr.uv_crft->cr_dock.ip_ptr) { X paln->al_dly = 2; X paln->al_atck.ip_ptr = plhit; X } X } X break; X case 'P': X pcrft = puniv->uv_ptr.uv_crft; X psys = pcrft->cr_sys; X sh = 3; X if (plhit) pcrft->cr_lhit.ip_ptr = plhit; X break; X } X if (psys && psys[SHIELDS].s_cap) X if (!ishulldmg) {/* no shields if caused by hull dmg */ X int tmpsh; X tmpsh = psys[SHIELDS].s_lvl; X tmpsh *= psys[SHIELDS].s_pct; X tmpsh /= 100; X tmpsh *= psys[SHIELDS].s_cap; X tmpsh /= 100; X sh += tmpsh; X } X X /******************/ X /* inflict damage */ X /******************/ X /* compute damage to inflict */ X if (patck) { X tmpdspl = vdisp(patck,puniv,'d'); X trgtdist = /*vdist(patck->uv_pstn,puniv->uv_pstn)*/ tmpdspl.dst; X } else X trgtdist = 1.; X if (SUB(trgtdist,1.) < 0) trgtdist = 1.; X inflict = INT(DIV(MUL(125000.,dmg),trgtdist)) / (sh*sh); X if (inflict > 1000) inflict = 1000; X totinflict += savinflict = inflict; X X /* apply damage */ X if (psys) /* non-torp */ X while (inflict > 0) { X X /* randomly choose an existing system */ X psysdmg = psys + RANDOM(MSYS); X if (!psysdmg->s_cap) continue; X X /* 35<=sysdmg<80 */ X sysdmg = RANDOM(45) + 35; X if (sysdmg > inflict) sysdmg = inflict; X inflict -= sysdmg; X X /* actual damage affected by subsystem ease of damage */ X psysdmg->s_dmg += (sysdmg*psysdmg->s_edmg)/100; X if (psysdmg->s_dmg > 100 || psysdmg->s_dmg < 0) X psysdmg->s_dmg = 100; X X if (pcrft) X biton(pcrft->cr_chng,BIT_SDMG+ X (psysdmg-psys)*flds[FLD_SDMG].f_grpw); X if (psys == psysdmg) X puniv->uv_mass = psysdmg->s_dmg; X } X X else {/* torp */ X if (ptorp->tp_dmg + inflict >= 100) X ptorp->tp_dmg = 100; X else X ptorp->tp_dmg += inflict; X puniv->uv_mass = ptorp->tp_dmg; X } X X /* report damage inflicted to inflictee */ X if (pcrft) { X output(pcrft->cr_lgn,'B',0,0); X setrpt(pcrft); X sprintf(buf,"%s damage: %d",msg,savinflict); X rpt(pcrft,buf); X X /* report direction if not from hull damage and */ X /* not torpedo or torpedo fired-by still around */ X if (!ishulldmg && plhit) { X double tmpvec[3]; X vcopy(pcrft->cr_lhpstn,plhit->uv_pstn); X /*vdiff(plhit->uv_pstn,puniv->uv_pstn,tmpvec);*/ X tmpdspl = vdisp(plhit,puniv,'v'); X rttosp(/*tmpvec*/tmpdspl.vec,tmpvec); X sprintf(buf,"Attacker @%ld %.1f %.1f",INT(tmpvec[0]), X DIV(tmpvec[1],DEGTORAD),DIV(tmpvec[2],DEGTORAD)); X rpt(pcrft,buf); X } X fnshrpt(pcrft,1); X X /* alien attack evaluation */ X } else if (paln) { X X /* acccumulate damage caused by attacker */ X if (plhit) { X if (plhit != prvatck) paln->al_aeval = 0; X paln->al_aeval += savinflict; X } X } X } X X /* report to and credit inflictor */ X if (!ishulldmg && plhit && plhit->uv_type == 'P') { X pcrft = plhit->uv_ptr.uv_crft; X pcrft->cr_pnts += totinflict/10; X output(pcrft->cr_lgn,'B',0,0); X setrpt(pcrft); X sprintf(buf,"%s damage inflicted: %d",msg,totinflict); X rpt(pcrft,buf); X fnshrpt(pcrft,1); X } X#ifdef DEBUG X VDBG("damage return\n"); X#endif X} END_OF_damage.c if test 5340 -ne `wc -c <damage.c`; then echo shar: \"damage.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f psw.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"psw.c\" else echo shar: Extracting \"psw.c\" \(4127 characters\) sed "s/^X//" >psw.c <<'END_OF_psw.c' X/* X * Spacewar - program that a user runs to play spacewar X * start up the game if its not running X * set tty permissions so that spacewar can communicate X * notify spacewar of a new player X * pause in order to tie up the shell X * X * Copyright 1984 obo Systems, Inc. X * Copyright 1984 Dan Rosenblatt X */ X X#ifdef BSD X# include <sys/ioctl.h> X extern long lseek(); X#else /* SYSIII SYSV */ X# include <fcntl.h> X#endif /* BSD SYSIII SYSV */ X X#include <signal.h> X#include "spacewar.h" X#include "uio2.h" X Xstruct uio2 uio; Xint swpid,swlgnfd; Xchar *thistty; Xstatic VOID fixttyexit(),catchsig(); X Xmain() X{ X int i; X char *ttyname(); X static char waitmsg[]="\nJust a moment while the game cranks up ...\n"; X static char backmsg[]="Doesn't make sense to run in background\n"; X extern char **environ; X X /* if newsfile readable, show it */ X if ((i=open(SWNEWS,0)) >= 0) { X char buf[1024]; X int j; X while ((j=read(i,buf,sizeof(buf))) > 0) X write(2,buf,j); X close(i); X } X uio.uio2pid = getpid(); X X /* if spacewar not running, run it */ X#ifdef BSD X if (access(SWPIDFILE,0)) { X#else /* SYSIII SYSV */ X if (access(SWCOMFILE,0)) { X#endif /* BSD SYSIII SYSV */ Xtryagain: X write(2,waitmsg,strlen(waitmsg)); X switch(fork()) { X case -1: /* fork failed */ X perror("fork"); X exit(1); X case 0: /* child */ X#ifdef BSD X for (i=0;i < 20;ioctl(i++,FIOCLEX,NULL)); X ioctl(2,FIONCLEX,NULL); X#else /* SYSIII SYSV */ X for (i=0;i < 20;fcntl(i++,F_SETFD,1)); X fcntl(2,F_SETFD,0); X#endif /* BSD SYSIII SYSV */ X close(2); X lseek(open(SWERR,1),0L,2); X environ = NULL; X execle(SWGAME,"sw",(char *)0,(char *)0); X perror(SWGAME); X kill(uio.uio2pid,SIGKILL); /* inform parent */ X exit(1); X default: /* parent; wait for the game to get going */ X#ifdef BSD X while (access(SWPIDFILE,0)) X#else /* SYSIII SYSV */ X while (access(SWCOMFILE,0)) X#endif /* BSD SYSIII SYSV */ X sleep(2); X break; X } X } X X /* trap user signals, termination signal */ X /* (insure not running in background) */ X if (signal(SIGINT,catchsig) == SIG_IGN) { X write(2,backmsg,strlen(backmsg)); X exit(1); X } X signal(SIGHUP,catchsig); X signal(SIGQUIT,catchsig); X signal(SIGTERM,fixttyexit); X X#ifdef BSD X /* get pid of game to notify it of a new player */ X if ((i=open(SWPIDFILE,0)) < 0 || X read(i,&swpid,sizeof(swpid)) != sizeof(swpid) || X close(i)) { X perror(SWPIDFILE); X exit(1); X } X X /* open notification information file */ X if ((swlgnfd=open(SWLGNFILE,1)) < 0) { X perror(SWLGNFILE); X exit(1); X } X#else /* SYSIII SYSV */ X /* open communication file */ X if ((swlgnfd=open(SWCOMFILE,O_WRONLY|O_NDELAY)) < 0) { X perror("notify spacewar"); X write(2,"Restarting!\n",12); X unlink(SWCOMFILE); X goto tryagain; X /*perror(SWCOMFILE); X *exit(1); X */ X } X#endif /* BSD SYSIII SYSV */ X X /* get tty name and set permissions so */ X /* that the spacewar game can communicate */ X if (!(thistty = ttyname(0)) && !(thistty = ttyname(1))) { X perror("ttyname"); X exit(1); X } X strcpy(uio.uio2tty,thistty); X X#ifdef BSD X /* notify spacewar of new player's tty and this program's pid */ X if (lseek(swlgnfd,0L,2) < 0L || X write(swlgnfd,&uio,sizeof(uio)) != sizeof(uio)) { X perror(SWLGNFILE); X fixttyexit(1); X } X if (kill(swpid,SIGTRAP)) { X perror("notify spacewar"); X write(2,"Restarting!\n",12); X close(swlgnfd); X unlink(SWPIDFILE); X unlink(SWLGNFILE); X goto tryagain; X } X#else /* SYSIII SYSV */ X if (write(swlgnfd,&uio,sizeof(uio)) != sizeof(uio)) { X perror(SWCOMFILE); X fixttyexit(1); X } X#endif /* BSD SYSIII SYSV */ X X /* wait for notification so that shell is tied up */ X uio.uio2tty[0] = '\0'; X for (;;) pause(); X} X Xstatic VOID catchsig(sig) Xint sig; X{ X signal(sig,catchsig); X uio.uio2sig = sig; X X#ifdef BSD X if (lseek(swlgnfd,0L,2) < 0L || X write(swlgnfd,&uio,sizeof(uio)) != sizeof(uio)) { X perror(SWLGNFILE); X fixttyexit(1); X } X if (kill(swpid,SIGTRAP)) { X perror("notify spacewar"); X fixttyexit(1); X } X#else /* SYSIII SYSV */ X if (write(swlgnfd,&uio,sizeof(uio)) != sizeof(uio)) { X perror(SWCOMFILE); X fixttyexit(1); X } X#endif /* BSD SYSIII SYSV */ X} X Xstatic VOID fixttyexit(n) Xint n; X{ X exit(n); X} END_OF_psw.c if test 4127 -ne `wc -c <psw.c`; then echo shar: \"psw.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f sw.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"sw.c\" else echo shar: Extracting \"sw.c\" \(5105 characters\) sed "s/^X//" >sw.c <<'END_OF_sw.c' X/* X * Spacewar - main for spacewar game X * X * Copyright 1984 obo Systems, Inc. X * Copyright 1984 Dan Rosenblatt X */ X X#include <signal.h> X#include "spacewar.h" X Xint numpling; X X#ifdef BSD X# include <sys/ioctl.h> X static int sigtrap,swlgnfd; X#else /* VMS SYSIII SYSV */ X#ifdef VMS X# include <descrip.h> X# include <ssdef.h> X# include <psldef.h> X static $DESCRIPTOR(mlbx,SWCOMFILE); X extern short inmlbx; X#else /* SYSIII SYSV */ X# include <sys/types.h> X# include <sys/stat.h> X#endif /* VMS SYSIII SYSV */ X#endif /* BSD VMS SYSIII SYSV */ Xextern int doproctrap,doupdate; Xstatic int dbglvl; Xstatic VOID catchtrp(),catchalrm(); X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X extern VOID proctrap(),shutdown(),cmd(); X#ifdef VMS X int i; X#endif /* VMS */ X extern int errno; X#ifdef BSD X int swpidfd,thispid,pfd[2]; X#endif /* BSD */ X X if (argc > 1) dbglvl = atoi(argv[1]); X X /* insure running in background */ X#ifndef VMS X /*if (fork() > 0) exit(0);*/ X#endif /* VMS BSD SYSIII SYSV */ X X /* ignore interrupts, shutdown on terminate */ X /* break connection with controlling tty */ X /* close unneccesary files */ X#ifndef VMS X signal(SIGHUP,SIG_IGN); X signal(SIGINT,SIG_IGN); X signal(SIGQUIT,SIG_IGN); X signal(SIGTERM,shutdown); X#ifdef SIGTSTP X signal(SIGTSTP,SIG_IGN); X#endif X#ifdef SIGTTIN X signal(SIGTTIN,SIG_IGN); X#endif X#ifdef SIGTTOU X signal(SIGTTOU,SIG_IGN); X#endif X#ifdef TIOCNOTTY X ioctl(0,TIOCNOTTY,0); X close(open("/dev/console",1)); X#endif X setpgrp(getpid(),getpid()); X#endif X close(0); X close(1); X X /* set up objects and aliens */ X srand(time(0)); X objinit(); X alninit(); X X /* set up readsw pipe/named pipe/mailbox */ X#ifdef BSD X if (pipe(pfd) || pfd[0] != 0 || pfd[1] != 1) { X perror("pipe"); X exit(1); X } X X /* set up communication files */ X thispid = getpid(); X if ((swpidfd=creat(SWPIDFILE,0644)) < 0 || X write(swpidfd,&thispid,sizeof(thispid)) != sizeof(thispid) || X close(swpidfd)) { X perror(SWPIDFILE); X exit(1); X } X if ((swlgnfd=creat(SWLGNFILE,0666)) < 0 || close(swlgnfd) || X (swlgnfd=open(SWLGNFILE,0)) < 0) { X perror(SWLGNFILE); X if (unlink(SWPIDFILE)) perror(SWPIDFILE); X exit(1); X } X#else /* VMS SYSIII SYSV */ X#ifdef VMS X if ((i=sys$assign(&mlbx,&inmlbx,PSL$C_USER,0)) != SS$_NORMAL) { X perror("assign mlbx"); X#ifdef DEBUG X VDBG("sw assign()=%d, errno=%d\n",i,errno); X#endif X exit(1); X } X#else /* SYSIII SYSV */ X if (mknod(SWCOMFILE,0666+S_IFIFO,0) || X open(SWCOMFILE,0) != 0 || X open(SWCOMFILE,1) != 1) { X perror(SWCOMFILE); X exit(1); X } X#endif /* VMS SYSIII SYSV */ X#endif /* VMS BSD SYSIII SYSV */ X X /* open dbm(3) file */ X if (dbminit(SWDATABASE)) { X perror(SWDATABASE); X#ifdef BSD X if (unlink(SWLGNFILE)) perror(SWLGNFILE); X if (unlink(SWPIDFILE)) perror(SWPIDFILE); X#else /* VMS SYSIII SYSV */ X#ifndef VMS X if (unlink(SWCOMFILE)) perror(SWCOMFILE); X#endif /* VMS SYSIII SYSV */ X#endif /* VMS BSD SYSIII SYSV */ X exit(1); X } X X /* catch asynchronous event notification from playsw */ X#ifdef BSD X signal(SIGTRAP,catchtrp); X#endif /* BSD */ X X /* trap alarm to update universe */ X signal(SIGALRM,catchalrm); X X /*******************/ X /* MAIN PROCESSING */ X /*******************/ X X /* get and process commands and interrupts */ X for (;;) { X cmd(); X#ifdef BSD X if (sigtrap) { X doproctrap = 0; X proctrap(swlgnfd,&sigtrap); X doproctrap = 1; X } X#endif /* BSD */ X if (doupdate < 0) { X doproctrap = 0; X update(); X if (doproctrap == 0) doproctrap = 1; X doupdate = 1; X } X } X X} X Xfirstplyr() X{catchalrm();} X Xstatic VOID catchalrm() X{ X X#ifdef DEBUG X VDBG("catchalrm\n"); X#endif X#ifdef VMS X sys$cancel(inmlbx); X#endif /* VMS */ X signal(SIGALRM,catchalrm); X if (doproctrap > 0 && doupdate > 0) { X doproctrap = 0; X update(); X if (doproctrap == 0) doproctrap = 1; X } else X doupdate = -1; X if (numpling) X alarm(1); X} X X#ifdef BSD Xstatic VOID catchtrp() X{ X#ifdef DEBUG X VDBG("catchtrp [doproctrap=%d]\n",doproctrap); X#endif X ++sigtrap; X if (doproctrap > 0) { X doproctrap = 0; X proctrap(swlgnfd,&sigtrap); X doproctrap = 1; X } else X doproctrap = -1; X} X#endif /* BSD */ X X X#ifdef DEBUG X X#undef NULL X#include <stdio.h> X X#ifdef VMS X#include <varargs.h> XVOID DBG(va_alist) Xva_dcl X{ X va_list ap; X int nargs,i,a[8]; X char *fmt; X X va_start(ap); X va_count(nargs); X fmt = va_arg(ap,char *); X for (i=0;--nargs > 0;++i) X a[i] = va_arg(ap,int); X va_end(ap); X while (i < sizeof(a)/sizeof(a[0])) X a[i++] = -1; X if (dbglvl > 0) fprintf(stderr,fmt, X a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]); X} XVOID VDBG(va_alist) Xva_dcl X{ X va_list ap; X int nargs,i,a[8]; X char *fmt; X X va_start(ap); X va_count(nargs); X fmt = va_arg(ap,char *); X for (i=0;--nargs > 0;++i) X a[i] = va_arg(ap,int); X va_end(ap); X while (i < sizeof(a)/sizeof(a[0])) X a[i++] = -1; X if (dbglvl > 1) fprintf(stderr,fmt, X a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]); X} X#else X/*VARARGS1*/ XVOID DBG(fmt,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) Xchar *fmt; X{if (dbglvl > 0) fprintf(stderr,fmt,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);} X X/*VARARGS1*/ XVOID VDBG(fmt,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) Xchar *fmt; X{if (dbglvl > 1) fprintf(stderr,fmt,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);} X#endif X X#endif END_OF_sw.c if test 5105 -ne `wc -c <sw.c`; then echo shar: \"sw.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f upddbm.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"upddbm.c\" else echo shar: Extracting \"upddbm.c\" \(4553 characters\) sed "s/^X//" >upddbm.c <<'END_OF_upddbm.c' X/* X * Spacewar - update dbm(3) records X * for deleting old players and all associated records X * and for creating super and priviledged crafts X * X * Copyright 1985 obo Systems, Inc. X * Copyright 1985 Dan Rosenblatt X */ X X#ifndef VMS X#include <sys/types.h> X#include <dbm.h> X#else /* BSD SYSIII SYSV */ X#include <types.h> X#include "dbm.h" X#endif /* VMS */ X#include "spacewar.h" X#include "universe.h" X#include "login.h" X#include "sys.h" X#include "crft.h" X#include "mlbx.h" X#include "plyr.h" X#include "ucmd.h" X Xmain() X{ X datum srchkey,dbmkey,dbmdata; X struct crftkey crk; X static struct crftkey zcrk; X struct crft crd; X struct mlbxkey mbk; X struct plyrkey plk; X struct plyr pld; X struct ucmdkey uck; X struct syskey sk; X struct sys s; X char *asctime(),*ctime(),*gets(),buf[32],dnam[100][8+1],*pnam; X int i,nd=0,atoi(); X long atol(); X X if (dbminit(SWDATABASE)) { X perror(SWDATABASE); X exit(1); X } X X /* get all players */ X for (srchkey=firstkey();srchkey.dptr;srchkey=nextkey(srchkey)) { X if (srchkey.dptr[0] != PLYR) X continue; X X /* show player name, last login time, and # of logins */ X bcopy((char *)&plk,srchkey.dptr,sizeof(plk)); X printf("'%s' ",plk.pl_name); X dbmdata = fetch(srchkey); X if (!dbmdata.dptr) { X printf("- can't fetch\n"); X continue; X } X bcopy((char *)&pld,dbmdata.dptr,sizeof(pld)); X printf("{%.24s} %d ", X#ifdef VMS X ctime(&pld.pl_lstlgn), X#else /* BSD SYSIII SYSV */ X asctime(localtime(&pld.pl_lstlgn)), X#endif /* VMS BSD SYSIII SYSV */ X pld.pl_numlgn); X X /* prompt for delete or craft name to endow */ Xgetcrnam: printf("(d/craftname)>"); X gets(buf); X X /* save player name to delete */ X if (!strcmp(buf,"d")) X strcpy(dnam[nd++],plk.pl_name); X X /* try to get craft */ X else if (strlen(buf) > 1) { X crk = zcrk; X crk.cr_crftkey = CRAFT; X strcpy(crk.cr_plyr,plk.pl_name); X strcpy(crk.cr_name,buf); X dbmkey.dptr = (char *)&crk; X dbmkey.dsize = sizeof(crk); X dbmdata = fetch(dbmkey); X if (!dbmdata.dptr) { X printf("No such craft\n"); X goto getcrnam; /* horrendous */ X } X X bcopy((char *)&crd,dbmdata.dptr,dbmdata.dsize); X printf("[htyp=%d] flsp=%ld crew=%ld plvl=%d\n", X crd.cr_htyp,crd.cr_flsp,crd.cr_crew,crd.cr_plvl); X printf("flsp>"); X if (strlen(gets(buf)) > 0) crd.cr_flsp = atol(buf); X printf("crew>"); X if (strlen(gets(buf)) > 0) crd.cr_crew = atol(buf); X printf("plvl>"); X if (strlen(gets(buf)) > 0) crd.cr_plvl = atoi(buf); X dbmkey.dptr = (char *)&crk; X dbmdata.dptr = (char *)&crd; X if (store(dbmkey,dbmdata)) X printf("Couldn't update craft\n"); X } X } X X printf("\nStarting delete loop\n\n"); X X /* go through all records requesting ok to delete those matching dnam */ X for (srchkey=firstkey();srchkey.dptr;srchkey=nextkey(srchkey)) { X X switch(srchkey.dptr[0]) { X case CRAFT: X bcopy((char *)&crk,srchkey.dptr,sizeof(crk)); X pnam = crk.cr_plyr; X srchkey.dptr = (char *)&crk; X srchkey.dsize = sizeof(crk); X break; X case MLBX: X bcopy((char *)&mbk,srchkey.dptr,sizeof(mbk)); X pnam = mbk.mb_plyr; X srchkey.dptr = (char *)&mbk; X srchkey.dsize = sizeof(mbk); X break; X case PLYR: X bcopy((char *)&plk,srchkey.dptr,sizeof(plk)); X pnam = plk.pl_name; X srchkey.dptr = (char *)&plk; X srchkey.dsize = sizeof(plk); X break; X case SUBSYS: X bcopy((char *)&sk,srchkey.dptr,sizeof(sk)); X pnam = sk.s_plyr; X srchkey.dptr = (char *)&sk; X srchkey.dsize = sizeof(sk); X break; X case UCMD: X bcopy((char *)&uck,srchkey.dptr,sizeof(uck)); X pnam = uck.uc_plyr; X srchkey.dptr = (char *)&uck; X srchkey.dsize = sizeof(uck); X break; X default: X printf("Unknown key: '%c'\n",srchkey.dptr[0]); X if (delete(srchkey)) X printf("Can't delete\n"); X continue; X } X X /* only if the name matches one in the list */ X for (i=0;i < nd;++i) X if (!strcmp(pnam,dnam[i])) X break; X if (i >= nd) continue; X X switch(srchkey.dptr[0]) { X case CRAFT: X printf("craft '%s' '%s'",crk.cr_plyr,crk.cr_name); X break; X case MLBX: X printf("mlbx '%s' %d",mbk.mb_plyr,mbk.mb_mlbx); X break; X case PLYR: X printf("plyr '%s'",plk.pl_name); X break; X case SUBSYS: X printf("sys '%s' '%s' %d",sk.s_plyr,sk.s_crft, X sk.s_type); X break; X case UCMD: X printf("ucmd '%s' '%s' %d",uck.uc_plyr,uck.uc_name, X uck.uc_ucmd); X break; X } X printf(" (d/)>"); X if (!strcmp(gets(buf),"d") && delete(srchkey)) X printf("Can't delete\n"); X } X} END_OF_upddbm.c if test 4553 -ne `wc -c <upddbm.c`; then echo shar: \"upddbm.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f upddmg.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"upddmg.c\" else echo shar: Extracting \"upddmg.c\" \(5048 characters\) sed "s/^X//" >upddmg.c <<'END_OF_upddmg.c' X/* X * Spacewar - update damage from hull damage and do damage control X * hull %dmg>=60 more damage, >=80 destroys X * works for both crfts and alns X * works for torp dmg >= 100 X * X * Copyright 1985 obo Systems, Inc. X * Copyright 1985 Dan Rosenblatt X */ X X#include "spacewar.h" X#ifndef VMS X#include <sys/types.h> X#else /* BSD SYSIII SYSV */ X#include <types.h> X#endif /* VMS */ X#include "universe.h" X#include "sys.h" X#include "login.h" X#include "crft.h" X#include "build.h" X#include "aln.h" X#include "flds.h" X#include "obj.h" X#include "torp.h" X XVOID upddmg() X{ X struct universe *puniv; X register struct sys *psys,*pdmgcon; X register struct crft *pcrft,*phit; X struct aln *paln; X struct torp *ptorp; X struct login *plogin; X int i; X X#ifdef DEBUG X DBG("upddmg()\n"); X#endif X X for (puniv=univlst+MAXUNIVERSE;puniv-- > univlst;) { X X /**********/ X /* set up */ X /**********/ X switch(puniv->uv_type) { X case 'A': X paln = puniv->uv_ptr.uv_aln; X if (paln->al_lhit.ip_ptr && X paln->al_lhit.ip_ptr->uv_type == 'P') X phit = paln->al_lhit.ip_ptr->uv_ptr.uv_crft; X else X phit = NULL; X psys = paln->al_sys; X pcrft = NULL; X break; X case 'P': X pcrft = puniv->uv_ptr.uv_crft; X if (pcrft->cr_lhit.ip_ptr && X pcrft->cr_lhit.ip_ptr->uv_type == 'P') X phit = pcrft->cr_lhit.ip_ptr->uv_ptr.uv_crft; X else X phit = NULL; X psys = pcrft->cr_sys; X paln = NULL; X break; X case 'T': X ptorp = puniv->uv_ptr.uv_torp; X if (ptorp->tp_dmg >= 100) { X X /* hit by a player, credit and report destruction */ X if (ptorp->tp_lhit.ip_ptr && X ptorp->tp_lhit.ip_ptr->uv_type == 'P') { X phit = ptorp->tp_lhit.ip_ptr->uv_ptr.uv_crft; X phit->cr_pnts += 200; X output(phit->cr_lgn,'B',0,0); X setrpt(phit); X rpt(phit,"Torpedo destroyed by you"); X fnshrpt(phit,1); X } X X /* report destroyed torpedo to firing player */ X if (ptorp->tp_fby.ip_ptr && X ptorp->tp_fby.ip_ptr->uv_type == 'P') { X phit = ptorp->tp_fby.ip_ptr->uv_ptr.uv_crft; X output(phit->cr_lgn,'B',0,0); X setrpt(phit); X rpt(phit,"Your torpedo destroyed"); X fnshrpt(phit,1); X } X X /* remove torpedo */ X remove(ptorp->tp_univ); X } X continue; X default: X continue; X } X X /*******************************/ X /* hull damage >= 80% destroys */ X /*******************************/ X if (psys[HULL].s_dmg >= 80) { X X /* alien */ X if (paln) { X X /* hit by another player, credit and report destruction */ X if (phit) { X phit->cr_kill += 1; X output(phit->cr_lgn,'B',0,0); X setrpt(phit); X rpt(phit,"Alien destroyed by you"); X fnshrpt(phit,1); X } X remove(paln->al_univ); X X /* craft */ X } else { X pcrft->cr_dock.ip_ptr = NULL; /* assure destruction */ X pcrft->cr_sens[1] = 1; /* assure destruction */ X unplay(plogin=pcrft->cr_lgn); /* *pcrft gets zeroed out */ X output(plogin,'E',0,0); X output(plogin,'B',0,0); X output(plogin,'C',0,"You are destroyed (hull broke up)\n"); X output(plogin,'C',0,PROMPT); X output(plogin,0,0,0); X } X X /**************************************************************/ X /* hull damage >= 60% causes gradual damage to all subsystems */ X /**************************************************************/ X } else if (psys[HULL].s_dmg >= 60) X damage(NULL,puniv,1.,DIV(FLOAT(RANDOM(100)),69000.), X "Hull damage >=60%"); X X /******************/ X /* damage control */ X /******************/ X pdmgcon = psys + DMGCON; X X /* only if damage control subsystem is present */ X if (pdmgcon->s_cap) { X X /* not fixing a specific system */ X if (!pdmgcon->s_lvl) { X X /* reduce damage by 1% for randomly chosen subsystems */ X for (i=pdmgcon->s_pct*(100-pdmgcon->s_dmg)/1500+1;i-- > 0;) { X pdmgcon = psys + RANDOM(MSYS); X if (pdmgcon->s_dmg <= 0 || pdmgcon->s_dmg == 45) X continue; /* already as low as it can go */ X pdmgcon->s_dmg -= 1; X if (pcrft) X biton(pcrft->cr_chng, X BIT_SDMG+(pdmgcon-psys)*flds[FLD_SDMG].f_grpw); X if (pdmgcon == psys) X puniv->uv_mass = pdmgcon->s_dmg; X } X X /* fixing a specific system */ X } else { X i = pdmgcon->s_pct*(100-pdmgcon->s_dmg)/1500 + 1; X i = (i*2)/3; /* diminishing returns */ X pdmgcon = psys + pdmgcon->s_lvl - 1; X if (pdmgcon->s_cap) { /* only if subsystem is present */ X if (pdmgcon->s_dmg > 0 && pdmgcon->s_dmg != 45 && i) { X pdmgcon->s_dmg -= i; X biton(pcrft->cr_chng, X BIT_SDMG+(pdmgcon-psys)*flds[FLD_SDMG].f_grpw); X if (pdmgcon->s_dmg < 0) X pdmgcon->s_dmg = 0; X if (pdmgcon->s_dmg < 45 && pdmgcon->s_dmg+i > 45) X pdmgcon->s_dmg = 45; X } else { /* can't be fixed any further */ X psys[DMGCON].s_lvl = NULL; X biton(pcrft->cr_chng, X BIT_SLEVEL+DMGCON*flds[FLD_SLEVEL].f_grpw); X } X if (pdmgcon == psys) X puniv->uv_mass = pdmgcon->s_dmg; X } X } X } X } X X#ifdef DEBUG X VDBG("upddmg return\n"); X#endif X} END_OF_upddmg.c if test 5048 -ne `wc -c <upddmg.c`; then echo shar: \"upddmg.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f updsys.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"updsys.c\" else echo shar: Extracting \"updsys.c\" \(4397 characters\) sed "s/^X//" >updsys.c <<'END_OF_updsys.c' X/* X * Spacewar - update energy subsystems (solar, antm, dilith, shield, warp) X * works for both aliens and crafts X * X * Copyright 1985 obo Systems, Inc. X * Copyright 1985 Dan Rosenblatt X */ X X#include "spacewar.h" X#ifndef VMS X#include <sys/types.h> X#else /* BSD SYSIII SYSV */ X#include <types.h> X#endif /* VMS */ X#include "universe.h" X#include "login.h" X#include "sys.h" X#include "obj.h" X#include "aln.h" X#include "crft.h" X#include "build.h" X#include "flds.h" X#include "torp.h" X Xstatic long prtlvl(),strlvl(); X XVOID updsys() X{ X register struct universe *puniv; X register struct obj *pobj; X register struct sys *psys,*psh; X char *pchng; X double vdist(),ftmp; X long i,elvl; X dsplcmnt tmpdspl; X X#ifdef DEBUG X DBG("updsys()\n"); X#endif X X for (puniv=univlst+MAXUNIVERSE;puniv-- > univlst;) { X X /**********/ X /* set up */ X /**********/ X switch(puniv->uv_type) { X case 'A': X psys = puniv->uv_ptr.uv_aln->al_sys; X pchng = NULL; X break; X case 'P': X psys = puniv->uv_ptr.uv_crft->cr_sys; X pchng = puniv->uv_ptr.uv_crft->cr_chng; X break; X default: X continue; X } X elvl = 0L; X X /****************/ X /* solar energy */ X /****************/ X if (psys[SOLARE].s_cap) { X for (i=0,pobj=objlst+MAXOBJ;pobj-- > objlst;) { X if (pobj->oj_rep != '*') continue; X /*ftmp = vdist(univlst[pobj-objlst].uv_pstn,puniv->uv_pstn);*/ X tmpdspl = vdisp(&univlst[pobj-objlst],puniv,'d'); X ftmp = tmpdspl.dst; X i += INT(DIV(1.e9,SQUARE(ftmp))); X } X elvl += strlvl(psys,SOLARE,prtlvl(psys,SOLARE,i),pchng); X } X X /*********************/ X /* antimatter energy */ X /*********************/ X if (i=psys[ANTME].s_cap) X elvl += strlvl(psys,ANTME,prtlvl(psys,ANTME,i),pchng); X X /* dilithium storage - increase from solar and antimatter */ X /* no dilithium ==> energy flow but no storage */ X /* shields consume energy - reduce shields if not enough */ X /* remaining gets stored into dilithium (if present) */ X if (psys[DILITH].s_cap) X elvl += psys[DILITH].s_lvl; X if ((psh=psys+SHIELDS)->s_cap) { X X /* alien shields to 75+hulldamage+? if */ X /* attacking otherwise 25+hulldamage */ X if (!pchng) { X psh->s_lvl = 25 + puniv->uv_mass; X if (puniv->uv_ptr.uv_aln->al_atck.ip_ptr) X psh->s_lvl += 50 + puniv->uv_ptr.uv_aln->al_aeval/20; X if (psh->s_lvl > 100) psh->s_lvl = 100; X } X X /* energy required to maintain shields (gag awful !@#$%^&) */ X /* capacity reduced by %level and %subsystem, again reduced*/ X /* by some type of squaring of %damage; keep reducing lvl */ X /* until energy required does not exceed energy available */ X for (;;) { X i = psh->s_cap; X i *= psh->s_pct; X i *= psh->s_lvl; X i /= (100L*100L); X i *= 10201L; X i /= 10201L + (psh->s_dmg-202L)*psh->s_dmg; X if (i <= elvl) break; X psh->s_lvl -= 1; X if (pchng) X biton(pchng,BIT_SLEVEL+SHIELDS*flds[FLD_SLEVEL].f_grpw); X } X elvl -= i; X } X if (psys[DILITH].s_cap) X strlvl(psys,DILITH,elvl,pchng); X X /***************/ X /* warp energy */ X /***************/ X if (psys[WARP].s_cap) { X int savpct=psys[WARP].s_pct,savdmg=psys[WARP].s_dmg; X i = psys[WARP].s_cap; X i *= psys[WARP].s_pct; X i /= 100L*100L*2L; X i += psys[WARP].s_lvl; X X /* maximum level (capacity) unaffected by %lvl or %dmg */ X psys[WARP].s_pct = 100; X psys[WARP].s_dmg = 0; X strlvl(psys,WARP,i,pchng); X psys[WARP].s_pct = savpct; X psys[WARP].s_dmg = savdmg; X } X } X X#ifdef DEBUG X VDBG("updsys return\n"); X#endif X} X X/* pro-rate level for %, %dmg */ Xstatic long prtlvl(psys,isys,lvl) Xregister struct sys *psys; Xint isys; Xlong lvl; X{ X psys += isys; X if (psys->s_cap) { X lvl = (lvl*psys->s_pct)/100; X lvl = (lvl*(100-psys->s_dmg))/100; X } else X lvl = 0L; X return(lvl); X} X X/* limit lvl to capacity (capacity reduced by %dmg) */ X/* store new level and indicate if changed */ Xstatic long strlvl(psys,isys,lvl,pchng) Xstruct sys *psys; Xint isys; Xlong lvl; Xchar *pchng; X{ X long maxcap; X X psys += isys; X if (psys->s_cap) { X maxcap = psys->s_cap; X maxcap *= psys->s_pct; X maxcap *= 100L-psys->s_dmg; X maxcap /= 100L*100L; X if (lvl > maxcap) X lvl = maxcap; X if (lvl != psys->s_lvl) { X psys->s_lvl = lvl; X if (pchng) X biton(pchng,BIT_SLEVEL+isys*flds[FLD_SLEVEL].f_grpw); X } X } else X lvl = 0L; X return(lvl); X} END_OF_updsys.c if test 4397 -ne `wc -c <updsys.c`; then echo shar: \"updsys.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f usrcmd.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"usrcmd.c\" else echo shar: Extracting \"usrcmd.c\" \(3783 characters\) sed "s/^X//" >usrcmd.c <<'END_OF_usrcmd.c' X/* X * Spacewar - user-command (play) subsystem X * X * Copyright 1985 obo Systems, Inc. X * Copyright 1985 Dan Rosenblatt X */ X X#ifndef VMS X#include <sys/types.h> X#include <dbm.h> X#else /* BSD SYSIII SYSV */ X#include <types.h> X#include "dbm.h" X#endif /* VMS */ X#include "spacewar.h" X#include "universe.h" X#include "login.h" X#include "ucmd.h" X X#define UCMDPROMPT "\ncommand/L(ist)/.(quit)>" X XVOID usrcmd(plogin) Xregister struct login *plogin; X{ X struct ucmdkey *pucmdkey; X struct ucmdkey getuckey; X datum dbmkey,dbmdata; X char buf[40+1]; X extern char *malloc(); X X#ifdef DEBUG X DBG("usrcmd(#%d/%s)\n",plogin-loginlst,plogin->ln_name); X#endif X X /**************/ X /* first time */ X /**************/ X if (!strcmp(plogin->ln_input,".")) goto done; X if (!(pucmdkey = (struct ucmdkey *)plogin->ln_substat)) { X#ifdef DEBUG X VDBG("usrcmd: inp '%s'\n",plogin->ln_input); X#endif X X /* subtask prompt */ X if (!plogin->ln_input[0]) { X output(plogin,'C',0,UCMDPROMPT); X X /* one letter command - list all user-defined command names */ X } else if (!plogin->ln_input[1]) { X X strcpy(buf,"\n"); X dbmkey = firstkey(); X while (dbmkey.dptr) { X bcopy((char *)&getuckey,dbmkey.dptr,sizeof(getuckey)); X if (getuckey.uc_ucmdkey == UCMD && X !strcmp(getuckey.uc_plyr,plogin->ln_name) && X getuckey.uc_ucmd == 1) { X if (strlen(buf) + 1 + strlen(getuckey.uc_name) >= X sizeof(buf)) { X output(plogin,'C',0,buf); X strcpy(buf,"\n"); X } X strcat(buf,getuckey.uc_name); X strcat(buf," "); X } X dbmkey = nextkey(dbmkey); X } X if (strlen(buf) > 1) { X output(plogin,'C',0,buf); X output(plogin,'C',0,"\n"); X } X goto done; X X /* command name - show existing and set up for re-entry */ X } else { X if (!(pucmdkey = (struct ucmdkey *) X malloc(sizeof(struct ucmdkey)))) { X perror("usrcmd: out of memory"); X goto done; X } X plogin->ln_substat = (char *) pucmdkey; X X output(plogin,'C',0, X "\nThe currently defined command (if any) will be displayed.\n"); X output(plogin,'C',0, X "A single dot (.) at the first prompt will retain it.\n"); X X /* create subtask structure */ X binit((char *)pucmdkey,sizeof(*pucmdkey)); X pucmdkey->uc_ucmdkey = UCMD; X strcpy(pucmdkey->uc_plyr,plogin->ln_name); X plogin->ln_input[sizeof(pucmdkey->uc_name)-1] = NULL; X strcpy(pucmdkey->uc_name,plogin->ln_input); X pucmdkey->uc_ucmd = 1; X X /* show existing */ X dbmkey.dptr = (char *)pucmdkey; X dbmkey.dsize = sizeof(*pucmdkey); X dbmdata = fetch(dbmkey); X if (dbmdata.dptr) output(plogin,'C',0,"\n"); X while (dbmdata.dptr) { X output(plogin,'C',0,dbmdata.dptr); X output(plogin,'C',0,"\n"); X ++pucmdkey->uc_ucmd; X dbmdata = fetch(dbmkey); X } X X /* prompt for new */ X pucmdkey->uc_ucmd = 1; X output(plogin,'C',0,"\n>"); X } X X /***************/ X /* new command */ X /***************/ X } else { X X /* delete old stuff */ X if (pucmdkey->uc_ucmd == 1) { X dbmkey.dptr = (char *)pucmdkey; X dbmkey.dsize = sizeof(*pucmdkey); X while (!delete(dbmkey)) X ++pucmdkey->uc_ucmd; X pucmdkey->uc_ucmd = 1; X } X X /* insert new line and set up for next */ X if (plogin->ln_input[0]) { X dbmkey.dptr = (char *)pucmdkey; X dbmkey.dsize = sizeof(*pucmdkey); X dbmdata.dptr = plogin->ln_input; X dbmdata.dsize = strlen(plogin->ln_input) + 1; X if (store(dbmkey,dbmdata)) { X perror("usrcmd: can't store ucmd"); X goto done; X } X pucmdkey->uc_ucmd += 1; X } X output(plogin,'C',0,">"); X } X X output(plogin,0,0,0); X#ifdef DEBUG X VDBG("usrcmd return\n"); X#endif X return; X Xdone: plogin->ln_stat = NULL; X if (plogin->ln_substat) { X free(plogin->ln_substat); X plogin->ln_substat = NULL; X } X output(plogin,'C',0,PROMPT); X output(plogin,0,0,0); X#ifdef DEBUG X VDBG("usrcmd return\n"); X#endif X return; X} END_OF_usrcmd.c if test 3783 -ne `wc -c <usrcmd.c`; then echo shar: \"usrcmd.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f vmspsw.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"vmspsw.c\" else echo shar: Extracting \"vmspsw.c\" \(5088 characters\) sed "s/^X//" >vmspsw.c <<'END_OF_vmspsw.c' X/* X * Spacewar - program that a user runs to play spacewar - VMS ONLY! X * show newsfile X * start up the game if its not running including mailbox creation X * notify spacewar of a new player X * assign screen mailbox X * get plogin value for rsw X * spawn rsw X * set 'raw' mode X * read screen mailbox continually looking for shutdown msg X * X * Copyright 1985 obo Systems, Inc. X * Copyright 1985 Dan Rosenblatt X */ X X#include "spacewar.h" X#include "uio.h" X#include <signal.h> X#include <stdio.h> X X#include <descrip.h> X#include <ssdef.h> X#include <iodef.h> X#include <psldef.h> X#include <ttdef.h> X#include <prvdef.h> X Xmain() X{ X int i,j,rswpid; X static $DESCRIPTOR(swmlbx,SWCOMFILE); X short swchan,chan; X static char waitmsg[]="\nJust a moment while the game cranks up ...\n"; X static $DESCRIPTOR(swgame,SWGAME); X static $DESCRIPTOR(swerr,SWERR); X static $DESCRIPTOR(swname,"sw"); X struct dsc$descriptor_d mlbx; X int prv[2]; X struct uio uio; X char buf[128]; X extern int errno; X static $DESCRIPTOR(tty,"TT"); X short tchan; X unsigned short speed,parity,fill; X struct { X unsigned char class,type; X unsigned short width; X unsigned mode : 24; X unsigned char length; X } swtty,savtty; X X X /* if newsfile readable, show it */ X if ((i=open(SWNEWS,0)) >= 0) { X char buf[512]; X int j; X while ((j=read(i,buf,sizeof(buf))) > 0) X write(2,buf,j); X close(i); X } X X /* if spacewar not running, run it */ X if (sys$assign(&swmlbx,&swchan,PSL$C_USER,0) != SS$_NORMAL) { X write(2,waitmsg,strlen(waitmsg)); X if ((i=sys$crembx(1,&swchan,0,0,0,PSL$C_USER,&swmlbx)) != X SS$_NORMAL) { X perror("crembx 1"); X sprintf(buf,"vmspsw crembx()=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X exit(SS$_ABORT); X } X prv[0] = 1<<PRV$V_PRMMBX | 1<<PRV$V_SYSNAM; X prv[1] = 0; X if ((i=sys$creprc(0,&swgame,0,&swerr,&swerr,prv,0,&swname,15, X 0,0,512/*PRC$M_DETACH*/)) != SS$_NORMAL) { X perror(SWGAME); X sprintf(buf,"vmspsw creprc()=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X if ((i=sys$delmbx(swchan)) != SS$_NORMAL) { X perror("delete mbx"); X sprintf(buf,"vmspsw delmbx()=%d, errno=%d\n", X i,errno); X write(2,buf,strlen(buf)); X } X exit(SS$_ABORT); X } X } X X /* notify spacewar of a new player */ X sprintf(uio.uio_chrs,"sw%x",getpid()); X uio.uio_lgn = 0; X if ((i=sys$qiow(0,swchan,IO$_WRITEVBLK,0,0,0,&uio,sizeof(uio),0,0,0,0)) X != SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(WRITEVBLK)=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X exit(SS$_ABORT); X } X X /* assign the screen mailbox */ X mlbx.dsc$w_length = strlen(uio.uio_chrs); X mlbx.dsc$b_dtype = DSC$K_DTYPE_T; X mlbx.dsc$b_class = DSC$K_CLASS_S; X mlbx.dsc$a_pointer = uio.uio_chrs; X for (j=10;j-- > 0;) X if ((i=sys$assign(&mlbx,&chan,PSL$C_USER,0)) != SS$_NORMAL) { X if (j) { X sleep(1); X continue; X } X perror("assign mbx"); X sprintf(buf,"vmspsw assignmbx()=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X exit(SS$_ABORT); X } else X break; X X /* get plogin value for rsw */ X if ((i=sys$qiow(0,chan,IO$_READVBLK,0,0,0,buf,sizeof(buf),0,0,0,0)) != X SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(READVBLK)=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X } X X /* spawn rsw */ X switch(rswpid=vfork()) { X case -1: /* failed */ X perror("vfork"); X uio.uio_lgn = SIGHUP; X if ((i=sys$qiow(0,swchan,IO$_WRITEVBLK,0,0,0,&uio, X sizeof(uio),0,0,0,0)) != SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(WRITEVBLK)=%d, errno=%d\n", X i,errno); X write(2,buf,strlen(buf)); X } X exit(SS$_ABORT); X X case 0: /* child */ X execl(SWREAD,"vmsrsw",buf,uio.uio_chrs,0); X perror(SWREAD); X uio.uio_lgn = SIGHUP; X if ((i=sys$qiow(0,swchan,IO$_WRITEVBLK,0,0,0,&uio, X sizeof(uio),0,0,0,0)) != SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(WRITEVBLK)=%d, errno=%d\n", X i,errno); X write(2,buf,strlen(buf)); X } X exit(SS$_ABORT); X } X X /* set 'raw' mode */ X if ((i=sys$assign(&tty,&tchan,PSL$C_USER,0)) != SS$_NORMAL) { X sprintf(buf,"vmspsw assign()=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X } X if ((i=sys$qiow(0,tchan,IO$_SENSEMODE,0,0,0,&savtty,0,&speed,&fill, X &parity,0)) != SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(SENSE)=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X } X swtty = savtty; X swtty.mode |= TT$M_PASSALL+TT$M_NOECHO; X if ((i=sys$qiow(0,tchan,IO$_SETMODE,0,0,0,&swtty,0,speed,fill,parity, X 0)) != SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(SET)=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X } X X /* read screen mailbox continually looking for shutdown msg */ X for (;;) { X if ((i=sys$qiow(0,chan,IO$_READVBLK,0,0,0,buf,sizeof(buf), X 0,0,0,0)) != SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(READVBLK)=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X } X if (!strcmp(buf,"ShUtDoWn")) break; X write(1,buf,strlen(buf)); X } X kill(rswpid,SIGTERM); X X /* reset terminal */ X if ((i=sys$qiow(0,tchan,IO$_SETMODE,0,0,0,&savtty,0,speed,fill,parity, X 0)) != SS$_NORMAL) { X sprintf(buf,"vmspsw qiow(SET)=%d, errno=%d\n",i,errno); X write(2,buf,strlen(buf)); X } X X exit(SS$_NORMAL); X} END_OF_vmspsw.c if test 5088 -ne `wc -c <vmspsw.c`; then echo shar: \"vmspsw.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 4 \(of 6\). cp /dev/null ark4isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 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