Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site amdahl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!amdahl!gam From: gam@amdahl.UUCP (gam) Newsgroups: net.sources Subject: Re: hack: changes for SVR2 (2 of 3) Message-ID: <874@amdahl.UUCP> Date: Sun, 6-Jan-85 04:17:27 EST Article-I.D.: amdahl.874 Posted: Sun Jan 6 04:17:27 1985 Date-Received: Tue, 8-Jan-85 02:47:32 EST References: <873@amdahl.UUCP> Distribution: net Organization: Blue Mouse Trailer Resort, Hellmouth, CA Lines: 1037 : This is a shar archive. Extract with sh, not csh. echo x - hack.main.c sed -e 's/^X//' > hack.main.c << '!Funky!Stuff!' X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */ X X#include X#include X#include X#include "hack.h" X Xextern char *getlogin(); Xextern char plname[PL_NSIZ], pl_character[PL_CSIZ]; Xextern char *getenv(); X Xint (*afternmv)(); X Xint done1(); Xvoid hangup(); X Xchar safelock[] = "safelock"; Xxchar locknum; /* max num of players */ Xchar *catmore = "/usr/bin/pg -n -s -p '--More (page %d)--'"; Xchar SAVEF[PL_NSIZ + 5] = "save/"; Xchar perm[] = "perm"; Xchar *hname; /* name of the game (argv[0] of call) */ Xchar obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ X Xextern char *nomovemsg; Xextern long wailmsg; X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X int fd; X#ifdef NEWS X int nonews = 0; X#endif NEWS X char *dir; X X hname = argv[0]; X X /* X * See if we must change directory to the playground. X * (Perhaps hack runs suid and playground is inaccessible X * for the player.) X * The environment variable HACKDIR is overridden by a X * -d command line option. X */ X dir = getenv("HACKDIR"); X if(argc > 1 && !strncmp(argv[1], "-d", 2)) { X argc--; X argv++; X dir = argv[0]+2; X if(*dir == '=' || *dir == ':') dir++; X if(!*dir && argc > 1) { X argc--; X argv++; X dir = argv[0]; X } X if(!*dir) X error("Flag -d must be followed by a directory name."); X } X X /* X * Now we know the directory containing 'record' and X * may do a prscore(). X */ X if(argc > 1 && !strncmp(argv[1], "-s", 2)) { X if(dir) chdirx(dir); X prscore(argc, argv); X exit(0); X } X X /* X * It seems he really wants to play. Find the creation date of X * this game so as to avoid restoring outdated savefiles. X */ X gethdate(hname); X X /* X * We cannot do chdir earlier, otherwise gethdate will fail. X */ X if(dir) chdirx(dir); X X /* X * Who am i? Perhaps we should use $USER instead? X */ X (void) strncpy(plname, getlogin(), sizeof(plname)-1); X X /* X * Process options. X */ X while(argc > 1 && argv[1][0] == '-'){ X argv++; X argc--; X switch(argv[0][1]){ X#ifdef WIZARD X case 'w': X if(!strcmp(getlogin(), WIZARD)) X wizard = TRUE; X else printf("Sorry.\n"); X break; X#endif WIZARD X#ifdef NEWS X case 'n': X nonews++; X break; X#endif NEWS X case 'u': X if(argv[0][2]) X (void) strncpy(plname, argv[0]+2, sizeof(plname)-1); X else if(argc > 1) { X argc--; X argv++; X (void) strncpy(plname, argv[0], sizeof(plname)-1); X } else X printf("Player name expected after -u\n"); X break; X default: X printf("Unknown option: %s\n", *argv); X } X } X X if(argc > 1) X locknum = atoi(argv[1]); X if(argc > 2) X catmore = argv[2]; X#ifdef WIZARD X if(wizard) (void) strcpy(plname, "wizard"); else X#endif WIZARD X if(!*plname || !strncmp(plname, "player", 4)) askname(); X plnamesuffix(); /* strip suffix from name */ X X setbuf(stdout,obuf); X (void) setrand(0L); X startup(); X cls(); X (void) signal(SIGHUP, hangup); X#ifdef WIZARD X if(!wizard) { X#endif WIZARD X (void) signal(SIGQUIT,SIG_IGN); X (void) signal(SIGINT,SIG_IGN); X if(locknum) X lockcheck(); X else X (void) strcpy(lock,plname); X#ifdef WIZARD X } else { X register char *sfoo; X (void) strcpy(lock,plname); X if(sfoo = getenv("MAGIC")) X while(*sfoo) { X switch(*sfoo++) { X case 'n': (void) setrand((long)*sfoo++); X break; X } X } X if(sfoo = getenv("GENOCIDED")){ X if(*sfoo == '!'){ X extern struct permonst mons[CMNUM+2]; X extern char genocided[], fut_geno[]; X register struct permonst *pm = mons; X register char *gp = genocided; X X while(pm < mons+CMNUM+2){ X if(!index(sfoo, pm->mlet)) X *gp++ = pm->mlet; X pm++; X } X *gp = 0; X } else X (void) strcpy(genocided, sfoo); X (void) strcpy(fut_geno, genocided); X } X } X#endif WIZARD X u.uhp = 1; /* prevent RIP on early quits */ X u.ux = FAR; /* prevent nscr() */ X (void) strcat(SAVEF,plname); X if((fd = open(SAVEF,0)) >= 0 && X (uptodate(fd) || unlink(SAVEF) == 666)) { X (void) signal(SIGINT, (void (*)()) done1); X puts("Restoring old save file..."); X (void) fflush(stdout); X dorecover(fd); X flags.move = 0; X } else { X#ifdef NEWS X if(!nonews) X if((fd = open(NEWS,0)) >= 0) X outnews(fd); X#endif NEWS X flags.ident = 1; X init_objects(); X u_init(); X (void) signal(SIGINT, (void (*)()) done1); X glo(1); X mklev(); X u.ux = xupstair; X u.uy = yupstair; X (void) inshop(); X setsee(); X flags.botlx = 1; X makedog(); X seemons(); X docrt(); X pickup(); X read_engr_at(u.ux,u.uy); /* superfluous ? */ X flags.move = 1; X flags.cbreak = ON; X flags.echo = OFF; X } X setftty(); X#ifdef TRACK X initrack(); X#endif TRACK X for(;;) { X if(flags.move) { X#ifdef TRACK X settrack(); X#endif TRACK X if(moves%2 == 0 || X (!(Fast & ~INTRINSIC) && (!Fast || rn2(3)))) { X extern struct monst *makemon(); X movemon(); X if(!rn2(70)) X (void) makemon((struct permonst *)0, 0, 0); X } X if(Glib) glibr(); X timeout(); X ++moves; X if(u.uhp < 1) { X pline("You die..."); X done("died"); X } X if(u.uhp*10 < u.uhpmax && moves-wailmsg > 50){ X wailmsg = moves; X if(u.uhp == 1) X pline("You hear the wailing of the Banshee..."); X else X pline("You hear the howling of the CwnAnnwn..."); X } X if(u.uhp < u.uhpmax) { X if(u.ulevel > 9) { X if(Regeneration || !(moves%3)) { X flags.botl = 1; X u.uhp += rnd((int) u.ulevel-9); X if(u.uhp > u.uhpmax) X u.uhp = u.uhpmax; X } X } else if(Regeneration || X (!(moves%(22-u.ulevel*2)))) { X flags.botl = 1; X u.uhp++; X } X } X if(Teleportation && !rn2(85)) tele(); X if(Searching && multi >= 0) (void) dosearch(); X gethungry(); X invault(); X } X if(multi < 0) { X if(!++multi){ X pline(nomovemsg ? nomovemsg : X "You can move again."); X nomovemsg = 0; X if(afternmv) (*afternmv)(); X afternmv = 0; X } X } X flags.move = 1; X find_ac(); X#ifndef QUEST X if(!flags.mv || Blind) X#endif QUEST X { X seeobjs(); X seemons(); X nscr(); X } X if(flags.botl || flags.botlx) bot(); X if(multi > 0) { X#ifdef QUEST X if(flags.run >= 4) finddir(); X#endif QUEST X lookaround(); X if(!multi) { /* lookaround may clear multi */ X flags.move = 0; X continue; X } X if(flags.mv) { X if(multi 'Z' && c < 'a') || c > 'z') c = '_'; X if(ct < sizeof(plname)-1) plname[ct++] = c; X } X plname[ct] = 0; X if(ct == 0) askname(); X#ifdef QUEST X else printf("Hello %s, welcome to quest!\n", plname); X#else X else printf("Hello %s, welcome to hack!\n", plname); X#endif QUEST X} X Ximpossible(){ X pline("Program in disorder - perhaps you'd better Quit"); X} X X#ifdef NEWS Xint stopnews; X Xvoid Xstopnws(){ X (void) signal(SIGINT, SIG_IGN); X stopnews++; X} X Xoutnews(fd) int fd; { Xvoid (*prevsig)(); Xchar ch; X prevsig = signal(SIGINT, stopnws); X while(!stopnews && read(fd,&ch,1) == 1) X (void) putchar(ch); X (void) putchar('\n'); X (void) fflush(stdout); X (void) close(fd); X (void) signal(SIGINT, prevsig); X /* See whether we will ask TSKCFW: he might have told us already */ X if(!stopnews && pl_character[0]) X getret(); X} X#endif NEWS X Xchdirx(dir) char *dir; { X if(chdir(dir) < 0) { X perror(dir); X error("Cannot chdir to %s.", dir); X } X} !Funky!Stuff! echo x - hack.pri.c sed -e 's/^X//' > hack.pri.c << '!Funky!Stuff!' X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */ X X#include "hack.h" X#include Xxchar scrlx, scrhx, scrly, scrhy; /* corners of new area on screen */ X Xextern char *hu_stat[]; /* in eat.c */ X Xswallowed() X{ X char *ulook = "|@|"; X ulook[1] = u.usym; X X cls(); X curs(u.ux-1, u.uy+1); X fputs("/-\\", stdout); X curx = u.ux+2; X curs(u.ux-1, u.uy+2); X fputs(ulook, stdout); X curx = u.ux+2; X curs(u.ux-1, u.uy+3); X fputs("\\-/", stdout); X curx = u.ux+2; X u.udispl = 1; X u.udisx = u.ux; X u.udisy = u.uy; X} X X X/*VARARGS1*/ Xboolean panicking; X Xpanic(str,a1,a2,a3,a4,a5,a6) Xchar *str; X{ X if(panicking++) exit(1); /* avoid loops */ X home(); X puts(" Suddenly, the dungeon collapses."); X fputs(" ERROR: ",stdout); X printf(str,a1,a2,a3,a4,a5,a6); X if(fork()) X done("panic"); X else X abort(); /* generate core dump */ X} X Xatl(x,y,ch) Xregister x,y; X{ X register struct rm *crm = &levl[x][y]; X X if(x<0 || x>COLNO-1 || y<0 || y>ROWNO-1) X panic("at(%d,%d,%c_%o_)",x,y,ch,ch); X if(crm->seen && crm->scrsym == ch) return; X crm->scrsym = ch; X crm->new = 1; X on_scr(x,y); X} X Xon_scr(x,y) Xregister x,y; X{ X if(xscrhx) scrhx = x; X if(yscrhy) scrhy = y; X} X X/* call: (x,y) - display X (-1,0) - close (leave last symbol) X (-1,-1)- close (undo last symbol) X (-1,let)-open: initialize symbol X (-2,let)-change let X*/ X Xtmp_at(x,y) schar x,y; { Xstatic schar prevx, prevy; Xstatic char let; X if((int)x == -2){ /* change let call */ X let = y; X return; X } X if((int)x == -1 && (int)y >= 0){ /* open or close call */ X let = y; X prevx = -1; X return; X } X if(prevx >= 0 && cansee(prevx,prevy)) { X delay(); X prl(prevx, prevy); /* in case there was a monster */ X at(prevx, prevy, levl[prevx][prevy].scrsym); X } X if(x >= 0){ /* normal call */ X if(cansee(x,y)) at(x,y,let); X prevx = x; X prevy = y; X } else { /* close call */ X let = 0; X prevx = -1; X } X} X X/* like the previous, but the symbols are first erased on completion */ XTmp_at(x,y) schar x,y; { Xstatic char let; Xstatic xchar cnt; Xstatic coord tc[COLNO]; /* but watch reflecting beams! */ Xregister xx,yy; X if((int)x == -1) { X if(y > 0) { /* open call */ X let = y; X cnt = 0; X return; X } X /* close call (do not distinguish y==0 and y==-1) */ X while(cnt--) { X xx = tc[cnt].x; X yy = tc[cnt].y; X prl(xx, yy); X at(xx, yy, levl[xx][yy].scrsym); X } X cnt = let = 0; /* superfluous */ X return; X } X if((int)x == -2) { /* change let call */ X let = y; X return; X } X /* normal call */ X if(cansee(x,y)) { X if(cnt) delay(); X at(x,y,let); X tc[cnt].x = x; X tc[cnt].y = y; X if(++cnt >= COLNO) panic("Tmp_at overflow?"); X levl[x][y].new = 0; /* prevent pline-nscr erasing --- */ X } X} X Xat(x,y,ch) Xregister xchar x,y; Xchar ch; X{ X#ifndef lint X /* if xchar is unsigned, lint will complain about if(x < 0) */ X if(x < 0 || x > COLNO-1 || y < 0 || y > ROWNO-1) X panic("At gets 0%o at %d %d(%d %d)",ch,x,y,u.ux,u.uy); X#endif lint X if(!ch) { X home(); X printf("At gets null at %2d %2d.",x,y); X curx = ROWNO+1; X return; X } X y += 2; X curs(x,y); X (void) putchar(ch); X curx++; X} X Xprme(){ X if(!Invis) at(u.ux,u.uy,u.usym); X} X Xdocrt() X{ X register x,y; X register struct rm *room; X register struct monst *mtmp; X X if(u.uswallow) { X swallowed(); X return; X } X cls(); X if(!Invis){ X levl[(u.udisx = u.ux)][(u.udisy = u.uy)].scrsym = u.usym; X levl[u.udisx][u.udisy].seen = 1; X u.udispl = 1; X } else u.udispl = 0; X X /* %% - is this really necessary? */ X for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) X if(mtmp->mdispl && !(room = &levl[mtmp->mx][mtmp->my])->new && X !room->seen) X mtmp->mdispl = 0; X X for(y = 0; y < ROWNO; y++) X for(x = 0; x < COLNO; x++) X if((room = &levl[x][y])->new) { X room->new = 0; X at(x,y,room->scrsym); X } else if(room->seen) at(x,y,room->scrsym); X scrlx = COLNO; X scrly = ROWNO; X scrhx = scrhy = 0; X flags.botlx = 1; X bot(); X} X Xdocorner(xmin,ymax) register xmin,ymax; { X register x,y; X register struct rm *room; X if(u.uswallow) { /* Can be done more efficiently */ X swallowed(); X return; X } X for(y = 0; y < ymax; y++) { X curs(xmin,y+2); X cl_end(); X for(x = xmin; x < COLNO; x++) { X if((room = &levl[x][y])->new) { X room->new = 0; X at(x,y,room->scrsym); X } else if(room->seen) at(x,y,room->scrsym); X } X } X} X Xpru() X{ X if(u.udispl && (Invis || u.udisx != u.ux || u.udisy != u.uy)) X /* if(! levl[u.udisx][u.udisy].new) */ X if(!vism_at(u.udisx, u.udisy)) X newsym(u.udisx, u.udisy); X if(Invis) { X u.udispl = 0; X prl(u.ux,u.uy); X } else X if(!u.udispl || u.udisx != u.ux || u.udisy != u.uy) { X atl(u.ux, u.uy, u.usym); X u.udispl = 1; X u.udisx = u.ux; X u.udisy = u.uy; X } X levl[u.ux][u.uy].seen = 1; X} X X#ifndef NOWORM X#include "def.wseg.h" Xextern struct wseg *m_atseg; X#endif NOWORM X X/* print a position that is visible for @ */ Xprl(x,y) X{ X register struct rm *room; X register struct monst *mtmp; X register struct obj *otmp; X X if(x == u.ux && y == u.uy && !Invis) { X pru(); X return; X } X room = &levl[x][y]; X if((!room->typ) || (room->typmhide && X (!mtmp->minvis || See_invisible)) { X#ifndef NOWORM X if(m_atseg) X pwseg(m_atseg); X else X#endif NOWORM X pmon(mtmp); X } X else if(otmp = o_at(x,y)) X atl(x,y,otmp->olet); X else if(mtmp && (!mtmp->minvis || See_invisible)) { X /* must be a hiding monster, but not hiding right now */ X /* assume for the moment that long worms do not hide */ X pmon(mtmp); X } X else if(g_at(x,y,fgold)) atl(x,y,'$'); X else if(!room->seen || room->scrsym == ' ') { X room->new = room->seen = 1; X newsym(x,y); X on_scr(x,y); X } X room->seen = 1; X} X Xchar Xnews0(x,y) Xregister xchar x,y; X{ X register struct obj *otmp; X register struct gen *gtmp; X struct rm *room; X register char tmp; X X room = &levl[x][y]; X if(!room->seen) tmp = ' '; X else if(!Blind && (otmp = o_at(x,y))) tmp = otmp->olet; X else if(!Blind && g_at(x,y,fgold)) tmp = '$'; X else if(x == xupstair && y == yupstair) tmp = '<'; X else if(x == xdnstair && y == ydnstair) tmp = '>'; X else if((gtmp = g_at(x,y,ftrap)) && (gtmp->gflag & SEEN)) tmp = '^'; X else switch(room->typ) { X case SCORR: X case SDOOR: X tmp = room->scrsym; /* %% wrong after killing mimic ! */ X break; X case HWALL: X tmp = '-'; X break; X case VWALL: X tmp = '|'; X break; X case LDOOR: X case DOOR: X tmp = '+'; X break; X case CORR: X tmp = CORR_SYM; X break; X case ROOM: X if(room->lit || cansee(x,y) || Blind) tmp = '.'; X else tmp = ' '; X break; X default: tmp = ERRCHAR; X } X return(tmp); X} X Xnewsym(x,y) Xregister x,y; X{ X atl(x,y,news0(x,y)); X} X X/* used with wand of digging: fill scrsym and force display */ Xmnewsym(x,y) register x,y; { Xregister struct monst *mtmp = m_at(x,y); X if(!mtmp || (mtmp->minvis && !See_invisible) || X (mtmp->mhide && o_at(x,y))){ X levl[x][y].scrsym = news0(x,y); X levl[x][y].seen = 0; X } X} X Xnosee(x,y) Xregister x,y; X{ X register struct rm *room; X X room = &levl[x][y]; X if(room->scrsym == '.' && !room->lit && !Blind) { X room->scrsym = ' '; X room->new = 1; X on_scr(x,y); X } X} X X#ifndef QUEST Xprl1(x,y) Xregister x,y; X{ X if(u.dx) { X if(u.dy) { X prl(x-(2*u.dx),y); X prl(x-u.dx,y); X prl(x,y); X prl(x,y-u.dy); X prl(x,y-(2*u.dy)); X } else { X prl(x,y-1); X prl(x,y); X prl(x,y+1); X } X } else { X prl(x-1,y); X prl(x,y); X prl(x+1,y); X } X} X Xnose1(x,y) Xregister x,y; X{ X if(u.dx) { X if(u.dy) { X nosee(x,u.uy); X nosee(x,u.uy-u.dy); X nosee(x,y); X nosee(u.ux-u.dx,y); X nosee(u.ux,y); X } else { X nosee(x,y-1); X nosee(x,y); X nosee(x,y+1); X } X } else { X nosee(x-1,y); X nosee(x,y); X nosee(x+1,y); X } X} X#endif QUEST X Xvism_at(x,y) register x,y; { Xregister struct monst *mtmp; Xregister int csi = See_invisible; X return((x == u.ux && y == u.uy && (!Invis || csi)) ? 1 : X ((mtmp = m_at(x,y)) && (!mtmp->minvis || csi) && X (!mtmp->mhide || !o_at(mtmp->mx,mtmp->my))) X ? cansee(x,y) : 0); X} X X#ifdef NEWSCR Xpobj(obj) register struct obj *obj; { Xregister int show = (!obj->oinvis || See_invisible) && X cansee(obj->ox,obj->oy); X if(obj->odispl){ X if(obj->odx != obj->ox || obj->ody != obj->oy || !show) X if(!vism_at(obj->odx,obj->ody)){ X newsym(obj->odx, obj->ody); X obj->odispl = 0; X } X } X if(show && !vism_at(obj->ox,obj->oy)){ X atl(obj->ox,obj->oy,obj->olet); X obj->odispl = 1; X obj->odx = obj->ox; X obj->ody = obj->oy; X } X} X#endif NEWSCR X Xunpobj(obj) register struct obj *obj; { X/* if(obj->odispl){ X if(!vism_at(obj->odx, obj->ody)) X newsym(obj->odx, obj->ody); X obj->odispl = 0; X } X*/ X if(!vism_at(obj->ox,obj->oy)) X newsym(obj->ox,obj->oy); X} X Xseeobjs(){ Xregister struct obj *obj, *obj2; X for(obj = fobj; obj; obj = obj2) { X obj2 = obj->nobj; X if(obj->olet == FOOD_SYM && obj->otyp >= CORPSE X && obj->age + 250 < moves) X delobj(obj); X } X for(obj = invent; obj; obj = obj2) { X obj2 = obj->nobj; X if(obj->olet == FOOD_SYM && obj->otyp >= CORPSE X && obj->age + 250 < moves) X useup(obj); X } X} X Xseemons(){ Xregister struct monst *mtmp; X for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){ X pmon(mtmp); X#ifndef NOWORM X if(mtmp->wormno) wormsee(mtmp->wormno); X#endif NOWORM X } X} X Xpmon(mon) register struct monst *mon; { Xregister int show = X ((!mon->minvis || See_invisible) && X (!mon->mhide || !o_at(mon->mx,mon->my)) && X cansee(mon->mx,mon->my)) X || (Blind && Telepat); X if(mon->mdispl){ X if(mon->mdx != mon->mx || mon->mdy != mon->my || !show) X unpmon(mon); X } X if(show && !mon->mdispl){ X atl(mon->mx,mon->my, X mon->mimic ? mon->mimic : mon->data->mlet); X mon->mdispl = 1; X mon->mdx = mon->mx; X mon->mdy = mon->my; X } X} X Xunpmon(mon) register struct monst *mon; { X if(mon->mdispl){ X newsym(mon->mdx, mon->mdy); X mon->mdispl = 0; X } X} X Xnscr() X{ X register x,y; X register struct rm *room; X X if(u.uswallow || u.ux == FAR || flags.nscrinh) return; X pru(); X for(y = scrly; y <= scrhy; y++) X for(x = scrlx; x <= scrhx; x++) X if((room = &levl[x][y])->new) { X room->new = 0; X at(x,y,room->scrsym); X } X scrhx = scrhy = 0; X scrlx = COLNO; X scrly = ROWNO; X} X Xchar oldbot[100], newbot[100]; /* 100 >= COLNO */ Xbot() X{ Xregister char *ob = oldbot, *nb = newbot; Xregister int i; X if(flags.botlx) *ob = 0; X flags.botl = flags.botlx = 0; X (void) sprintf(newbot, "Level %-2d Gold %-5lu Hp %3d(%d) Ac %-2d Str ", X dlevel, u.ugold, u.uhp, u.uhpmax, u.uac); X if(u.ustr>18) { X if(u.ustr>117) (void) strcat(newbot,"18/**"); X else (void) sprintf(newbot + strlen(newbot), "18/%02d",u.ustr-18); X } else (void) sprintf(newbot + strlen(newbot), "%-2d ",u.ustr); X (void) sprintf(newbot + strlen(newbot), " Exp %2d/%-5lu ", u.ulevel,u.uexp); X (void) strcat(newbot, hu_stat[u.uhs]); X for(i = 1; idata->mlevel, mtmp->mgold, mtmp->mhp, mtmp->orig_hp, X mtmp->data->ac, (mtmp->data->damn + 1) * (mtmp->data->damd + 1)); X} X#endif WAN_PROBING X Xcls(){ X if(flags.topl == 1) X more(); X flags.topl = 0; X X clearscreen(); X X flags.botlx = 1; X} !Funky!Stuff! echo x - hack.sh sed -e 's/^X//' > hack.sh << '!Funky!Stuff!' X XHACK=/usr/games/HACK XHACKDIR=/usr/games/lib/hack/tmp XMAXNROFPLAYERS=6 XMORE="/usr/bin/pg -f -n -s -p '--More (page %d)--'" X Xcd $HACKDIR Xcase $1 in X -s*) X exec $HACK $@ X ;; X *) X# /bin/cat news X exec $HACK $HACKDIR $MAXNROFPLAYERS $MORE X ;; Xesac !Funky!Stuff! echo x - hack.stat.c sed -e 's/^X//' > hack.stat.c << '!Funky!Stuff!' X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */ X X#include X#include X#include "config.h" X Xextern char *index(); Xstruct stat buf,hbuf; X Xgethdate(name) char *name; { Xregister char *np; X if(stat(name, &hbuf)) X error("Cannot get status of %s.", X (np = index(name, '/')) ? np+1 : name); X} X Xuptodate(fd) { X if(fstat(fd, &buf)) { X pline("Cannot get status?"); X return(0); X } X if(buf.st_ctime < hbuf.st_ctime) { X pline("Saved level is out of date."); X return(0); X } X return(1); X} !Funky!Stuff! exit -- Gordon A. Moffett ...!{ihnp4,hplabs,sun}!amdahl!gam "Her name was McGill, and she called herself Lil, but everyone knew her as Nancy...."