Annotation of coherent/a/usr/spool/uucppublic/warp9.tar, revision 1.1

1.1     ! root        1: warp/README   644    171      5        7235  5121747671   5735                        Warp Kit, Version 7.0
        !             2: 
        !             3:                    Copyright (c) 1986, Larry Wall
        !             4: 
        !             5: You may copy the warp kit in whole or in part as long as you don't try to
        !             6: make money off it, or pretend that you wrote it.
        !             7: --------------------------------------------------------------------------
        !             8: 
        !             9: Warp is a real-time space war game that doesn't get boring very quickly.
        !            10: Read warp.doc and the manual page for more information.
        !            11: 
        !            12: Warp will probably not run on V7 systems that don't have a non-blocking read,
        !            13: or on machines with a small address space like the PDP-11.  Caveat Emptor.
        !            14: 
        !            15: Please read all the directions below before you proceed any further, and
        !            16: then follow them carefully.  Failure to do so may void your warranty. :-)
        !            17: 
        !            18: After you have unpacked your kit, you should have all the files listed
        !            19: in MANIFEST.
        !            20: 
        !            21:                            IMPORTANT
        !            22: 
        !            23: You must choose the uid that you want warp to run under, since warp runs
        !            24: setuid to protect its files.  Choose a uid (not root) that is used only
        !            25: by trustworthy persons.  If you do your make install as root, the installed
        !            26: version will be chowned to this uid.  Otherwise, you should login to your
        !            27: selected uid before proceeding.  The Configure script will ask you which
        !            28: uid you want warp to run under.
        !            29: 
        !            30: Installation
        !            31: 
        !            32: 1)  Run Configure.  This will figure out various things about your system.
        !            33:     Some things Configure will figure out for itself, other things it will
        !            34:     ask you about.  It will then proceed to make config.h, config.sh, and
        !            35:     Makefile.
        !            36: 
        !            37:     You might possibly have to trim # comments from the front of Configure
        !            38:     if your sh doesn't handle them, but all other # comments will be taken
        !            39:     care of.
        !            40: 
        !            41:     (If you don't have sh, you'll have to copy the sample file config.H to
        !            42:     config.h and edit the config.h to reflect your system's peculiarities.)
        !            43: 
        !            44: 2)  Glance through config.h to make sure system dependencies are correct.
        !            45:     Most of them should have been taken care of by running the Configure script.
        !            46: 
        !            47:     If you have any additional changes to make to the C definitions, they
        !            48:     can be done in the Makefile, or in config.h.  Bear in mind that they will
        !            49:     get undone next time you run Configure.
        !            50: 
        !            51: 3)  make depend
        !            52: 
        !            53:     This will look for all the includes and modify Makefile accordingly.
        !            54:     Configure will offer to do this for you.
        !            55: 
        !            56: 4)  make
        !            57: 
        !            58:     This will attempt to make warp in the current directory.
        !            59: 
        !            60: 5)  make install
        !            61: 
        !            62:     This will put warp into a public directory (normally /usr/games).
        !            63:     It will also try to put the man pages in a reasonable place.  It will not
        !            64:     nroff the man page, however.  You may need to be root to do this.  If
        !            65:     you are not root, you must own the directories in question and you should
        !            66:     ignore any messages about chown not working.
        !            67: 
        !            68: 6)  Read the manual entry before running warp.
        !            69: 
        !            70: 7)  Feel free to edit warp.news.
        !            71: 
        !            72: 8)  IMPORTANT!  Help save the world!  Communicate any problems and
        !            73:     suggested patches to me, [email protected] (Larry Wall), so we can
        !            74:     keep the world in sync.  If you have a problem, there's someone else
        !            75:     out there who either has had or will have the same problem.
        !            76: 
        !            77:     If possible, send in patches such that the patch program will apply them.
        !            78:     Context diffs are the best, then normal diffs.  Don't send ed scripts--
        !            79:     I've probably changed my copy since the version you have.
        !            80: 
        !            81:     Watch for warp patches in comp.sources.bugs.  Patches will generally be
        !            82:     in a form usable by the patch program.  If you are just now bringing up
        !            83:     warp and aren't sure how many patches there are, write to me and I'll
        !            84:     send any you don't have.  Your current patch level is shown in patchlevel.h.
        !            85: 
        !            86: 
        !            87: NEW FEATURES IN THIS RELEASE
        !            88: 
        !            89: Uses a Configure script for greater portability.
        !            90: Space Amoebas!!!
        !            91: Pirates
        !            92: Friendly Freighters
        !            93: Harry Mudd
        !            94: Damage
        !            95: Keyboard mapping
        !            96: hanged my copy since the version you have.
        !            97: 
        !            98:     Watch for warp patches in comp.sources.bugs.  Patches will generally be
        !            99:     in a form usable by the patch program.  If you are just now bringing up
        !           100:     warp and aren't sure how many patches there are, write to me and I'll
        !           101:     send any you don't have.  Your current patch level is shown in patchlevel.h.
        !           102: 
        !           103: 
        !           104: NEwarp/score.c   644    171      5       44335  5121747700   6347 /* $Header: score.c,v 7.0.1.2 86/10/20 12:06:56 lwall Exp $ */
        !           105: 
        !           106: /* $Log:       score.c,v $
        !           107:  * Revision 7.0.1.2  86/10/20  12:06:56  lwall
        !           108:  * Made all exits reset tty.
        !           109:  * 
        !           110:  * Revision 7.0.1.1  86/10/16  10:52:47  lwall
        !           111:  * Added Damage.  Fixed random bugs.
        !           112:  * 
        !           113:  * Revision 7.0  86/10/08  15:13:14  lwall
        !           114:  * Split into separate files.  Added amoebas and pirates.
        !           115:  * 
        !           116:  */
        !           117: 
        !           118: #include "EXTERN.h"
        !           119: #include "warp.h"
        !           120: #include "intrp.h"
        !           121: #include "object.h"
        !           122: #include "play.h"
        !           123: #include "sig.h"
        !           124: #include "term.h"
        !           125: #include "us.h"
        !           126: #include "util.h"
        !           127: #include "weapon.h"
        !           128: #include "INTERN.h"
        !           129: #include "score.h"
        !           130: 
        !           131: void
        !           132: score_init()
        !           133: {
        !           134:     Reg1 char *s;
        !           135:     Reg2 int i;
        !           136:     FILE *savfil;
        !           137: 
        !           138:     if (stat(SAVEDIR,&filestat)) {
        !           139:        printf("Cannot access %s\r\n",SAVEDIR);
        !           140:        finalize(1);
        !           141:     }
        !           142:     if (filestat.st_uid != geteuid()) {
        !           143: #ifdef GETPWENT
        !           144:        printf("Warp will not run right without being setuid.\r\n");
        !           145: #else
        !           146:        getpw(filestat.st_uid, spbuf);
        !           147:        s = index(spbuf, ':');
        !           148:        *s = '\0';
        !           149:        printf("Warp will not run right without being setuid to %s.\r\n",spbuf);
        !           150: #endif
        !           151:        finalize(1);
        !           152:     }
        !           153:     if ((filestat.st_mode & 0605) != 0605) {
        !           154:        printf("%s is not protected correctly (must be u+rw o+rx).\r\n",SAVEDIR);
        !           155:        finalize(1);
        !           156:     }
        !           157:     
        !           158: #ifdef SCOREFULL
        !           159:     interp(longlognam, sizeof longlognam, "%N");
        !           160:     for (i=strlen(longlognam); i<24; i++)
        !           161:        longlognam[i] = ' ';    /* make sure it is 24 long for strncmp */
        !           162:     longlognam[24] = '\0';
        !           163: #else
        !           164:     interp(longlognam, sizeof longlognam, "%L");
        !           165:     for (i=strlen(longlognam); i<8; i++)
        !           166:        longlognam[i] = ' ';    /* make sure it is 8 long for strncmp */
        !           167:     longlognam[8] = '\0';
        !           168: #endif
        !           169:     
        !           170:     if (scorespec)
        !           171:        wscore();
        !           172: 
        !           173:     Sprintf(savefilename, "save.%s", logname);
        !           174: 
        !           175:     savfil = experimenting ? NULL : fopen(savefilename,"r");
        !           176:     if (savfil != NULL && fgets(spbuf,100,savfil) != NULL) {
        !           177:        char tmpbuf[80];
        !           178: 
        !           179:        spbuf[strlen(spbuf)-1] = '\0';
        !           180:        if (fgets(tmpbuf,80,savfil) != NULL) {
        !           181:            int processnum;
        !           182: 
        !           183:            tmpbuf[strlen(tmpbuf)-1] = '\0';
        !           184:            printf("You seem to have left a game %s.\r\n",tmpbuf+9);
        !           185:            s = index(tmpbuf+9, ',');
        !           186:            *s = '\0';
        !           187:            processnum = atoi(s+11);
        !           188:            if (kill(processnum, SIGINT)) {
        !           189:                                        /* does process not exist? */
        !           190:                                        /* (warp ignores SIGINT) */
        !           191:                printf("\r\n\
        !           192: That process does not seem to exist anymore, so you'll have to start the\r\n");
        !           193:                printf(
        !           194: "last wave over.\r\n\n");
        !           195:                printf(
        !           196: "                      [type anything to continue]");
        !           197:                Fflush(stdout);
        !           198:                eat_typeahead();
        !           199:                getcmd(tmpbuf);
        !           200:                if (*tmpbuf == INTRCH)
        !           201:                    finalize(0);
        !           202:                printf("\r\n");
        !           203:            }
        !           204:            else {
        !           205:                if (strcmp(term+8,tmpbuf+23)) {
        !           206:                    printf(
        !           207: "That is not your current terminal--you are on %s.\r\n", term+5);
        !           208:                    printf("\r\nYour options:\r\n");
        !           209:                    printf("   1) Exit and find the terminal it's running on\r\n");
        !           210:                }
        !           211:                else {
        !           212:                    printf("\r\nYour options:\r\n");
        !           213:                    printf("   1) Exit and try to foreground it\r\n");
        !           214:                }
        !           215:                printf("   2) Let me terminate the other game\r\n\n");
        !           216:                printf("What do you want to do? ");
        !           217:                Fflush(stdout);
        !           218:                eat_typeahead();
        !           219:                getcmd(tmpbuf);
        !           220:                printf("\r\n");
        !           221:                if (*tmpbuf == INTRCH)
        !           222:                    finalize(0);
        !           223:                if (*tmpbuf == '1') {
        !           224:                    printf(
        !           225: "If you don't succeed, come back and do option 2 instead.  Good luck.\r\n");
        !           226:                    finalize(0);
        !           227:                }
        !           228:                printf(
        !           229: "Ok, hang on a few moments \r\n");
        !           230:                Fclose(savfil);
        !           231:                if (kill(processnum, SIGQUIT)) {
        !           232:                    printf("Unable to kill process #%d!\r\n",processnum);
        !           233:                    roundsleep(2);
        !           234:                }
        !           235:                else {
        !           236: #ifdef SIGCONT
        !           237:                    kill(processnum, SIGCONT);
        !           238: #endif
        !           239:                    for (i=15; i; --i) {
        !           240:                        sleep(1);
        !           241:                        if (kill(processnum,SIGINT))
        !           242:                                        /* does process not exist? */
        !           243:                                        /* (warp ignores SIGINT) */
        !           244:                            break;
        !           245:                    }
        !           246:                    didkill++;
        !           247:                }
        !           248:                savfil = fopen(savefilename,"r");
        !           249:                if (savfil != NULL) {
        !           250:                    Fgets(spbuf,100,savfil);
        !           251:                }
        !           252:            }
        !           253:        }
        !           254:     }
        !           255:     else
        !           256:        savfil = NULL;
        !           257:     if (savfil == NULL) {
        !           258:        totalscore = smarts = cumsmarts = wave = 0;
        !           259:        numents = 5;
        !           260:        numbases = 3;
        !           261:     }
        !           262:     else {
        !           263:        totalscore = atol(spbuf+9);
        !           264:        smarts = atoi(spbuf+20);
        !           265:        cumsmarts = atoi(spbuf+24);
        !           266:        numents = atoi(spbuf+30);
        !           267:        numbases = atoi(spbuf+33);
        !           268:        wave = atoi(spbuf+36);
        !           269:        apolspec = (spbuf[40] == 'a');
        !           270:        beginner   = (spbuf[41] == 'b');
        !           271:        crushspec  = (spbuf[42] == 'c');
        !           272:        gornspec   = (spbuf[43] == 'g');
        !           273:        massacre   = (spbuf[44] == 'm');
        !           274:        romspec    = (spbuf[45] == 'r');
        !           275:        tholspec   = (spbuf[46] == 't');
        !           276:        lowspeed   = (spbuf[47] == 'l') || lowspeed;
        !           277:        amoebaspec = (spbuf[48] == '&');
        !           278:        Fclose(savfil);
        !           279:     }
        !           280: 
        !           281:     if (!ismarts) {
        !           282:        ismarts = 1;
        !           283:        clear();
        !           284:        page(NEWSFILE,FALSE);
        !           285:        if (smarts) {
        !           286:            printf("\r\nSaved game: SCORE DIFF CUMDIFF ENTERPRISES BASES WAVE");
        !           287:            printf("\r\n          %7ld  %2d   %4d        %1d        %1d   %3d",
        !           288:                totalscore,smarts,cumsmarts,numents,numbases,wave);
        !           289:        }
        !           290:        printf("\r\nWould you like instructions? ");
        !           291:        Fflush(stdout);
        !           292:        eat_typeahead();
        !           293:        getcmd(buf);
        !           294:        printf("\r\n");
        !           295:        if (*buf == INTRCH)
        !           296:            finalize(0);
        !           297:        if (*buf == 'Y' || *buf == 'y') {
        !           298:            page(HELPFILE,FALSE);
        !           299:            printf("\r\nWould you like to play easy games for a while? ");
        !           300:            Fflush(stdout);
        !           301:            eat_typeahead();
        !           302:            getcmd(buf);
        !           303:            printf("\r\n");
        !           304:            if (*buf == 'Y' || *buf == 'y') {
        !           305:                beginner = TRUE;
        !           306:                lowspeed = TRUE;
        !           307:            }
        !           308:        }
        !           309:     }
        !           310:     if (!smarts)
        !           311:        smarts = ismarts;
        !           312: }
        !           313: 
        !           314: void
        !           315: wscore()
        !           316: {
        !           317:     clear();
        !           318:     printf("                             TOP WARPISTS\r\n\n");
        !           319:     printf("RANK  WHO                     AKA        SCORE DIFF  CUMDIFF  WHEN\r\n");
        !           320:     page(SCOREBOARD,TRUE);
        !           321:     printf("                     [Type anything to continue]");
        !           322:     Fflush(stdout);
        !           323:     getcmd(spbuf);
        !           324:     if (*spbuf == INTRCH)
        !           325:        finalize(0);
        !           326:     clear();
        !           327:     printf("                        TOP LOW-SPEED WARPISTS\r\n\n");
        !           328:     printf("RANK  WHO                     AKA        SCORE DIFF  CUMDIFF  WHEN\r\n");
        !           329:     page(LSCOREBOARD,TRUE);
        !           330:     printf("                     [Type anything to continue]");
        !           331:     Fflush(stdout);
        !           332:     getcmd(spbuf);
        !           333:     if (*spbuf == INTRCH)
        !           334:        finalize(0);
        !           335:     clear();
        !           336:     printf("                          TOP FUNNY WARPISTS\r\n\n");
        !           337:     printf("RANK  WHO                     AKA        SCORE DIFF  CUMDIFF  WHEN\r\n");
        !           338:     page(FSCOREBOARD,TRUE);
        !           339:     printf("                     [Type anything to continue]");
        !           340:     Fflush(stdout);
        !           341:     getcmd(spbuf);
        !           342:     if (*spbuf == INTRCH)
        !           343:        finalize(0);
        !           344:     clear();
        !           345:     printf("          GAMES SAVED OR IN PROGRESS\r\n\n");
        !           346:     printf("WHO           SCORE  DF   CDF  E  B  WV  FLAGS\r\n");
        !           347:     resetty();
        !           348:     Sprintf(spbuf,"/bin/cat %ssave.*",SAVEDIR);
        !           349: #ifndef lint
        !           350:     execl("/bin/sh", "sh", "-c", spbuf, 0);
        !           351: #endif
        !           352:     finalize(1);
        !           353: }
        !           354: 
        !           355: 
        !           356: void
        !           357: display_status()
        !           358: {
        !           359:     Reg1 int tmp;
        !           360:     static char *status_names[] = {"Impl", "Warp", "Base", "****" };
        !           361: 
        !           362:     if (oldstatus != status) {
        !           363:        Sprintf(spbuf,"%-4s",status_names[status]);
        !           364:        mvaddstr(0,0, spbuf);
        !           365:        oldstatus = status;
        !           366:     }
        !           367:     if (ent) {
        !           368:        if (ent->energy != oldeenergy) {
        !           369:            oldeenergy = ent->energy;
        !           370:            Sprintf(spbuf,"%4d",oldeenergy);
        !           371:            mvaddstr(0,8, spbuf);
        !           372:        }
        !           373:        if (etorp != oldetorp) {
        !           374:            Sprintf(spbuf,"%2d",etorp);
        !           375:            mvaddstr(0,13, spbuf);
        !           376:            oldetorp = etorp;
        !           377:        }
        !           378:     }
        !           379:     else {
        !           380:        if (etorp >= 0) {
        !           381:            etorp = -1;
        !           382:            mvaddstr(0,8,"*******");
        !           383:            damage = 0;
        !           384:        }
        !           385:     }
        !           386:     if (base) {
        !           387:        if (base->energy != oldbenergy) {
        !           388:            oldbenergy = base->energy;
        !           389:            Sprintf(spbuf,"%5d",oldbenergy);
        !           390:            mvaddstr(0,19, spbuf);
        !           391:        }
        !           392:        if (btorp != oldbtorp) {
        !           393:            Sprintf(spbuf,"%3d",btorp);
        !           394:            mvaddstr(0,25, spbuf);
        !           395:            oldbtorp = btorp;
        !           396:        }
        !           397:     }
        !           398:     else {
        !           399:        if (btorp >= 0) {
        !           400:            btorp = -1;
        !           401:            mvaddstr(0,19,"*********");
        !           402:        }
        !           403:     }
        !           404:     if (damage) {
        !           405:        if (!olddamage)
        !           406:            mvaddstr(0,42,"*** ");
        !           407:        if (damage > 1 || !damflag[dam]) {
        !           408:            do {
        !           409:                if (++dam == MAXDAMAGE)
        !           410:                    dam = 0;
        !           411:            } while (!damflag[dam]);
        !           412:        }
        !           413:        if (!--damflag[dam]) {
        !           414:            olddamage = damage;
        !           415:            damage--;
        !           416:            Sprintf(spbuf,"%s OK ***       ",dammess[dam]);
        !           417:            spbuf[15] = '\0';
        !           418:            mvaddstr(0,46,spbuf);
        !           419:        }
        !           420:        else if (dam == NOSHIELDS) {
        !           421:            olddamage = damage;
        !           422:            tmp = (34 - damflag[dam]) * 3 - rand_mod(3);
        !           423:            if (tmp < 0)
        !           424:                tmp = 0;
        !           425:            Sprintf(spbuf,"%d%% %s ***       ",tmp,dammess[dam]);
        !           426:            spbuf[15] = '\0';
        !           427:            mvaddstr(0,46,spbuf);
        !           428:        }
        !           429:        else if (dam != lastdam || !olddamage) {
        !           430:            olddamage = damage;
        !           431:            Sprintf(spbuf,"NO %s ***       ",dammess[dam]);
        !           432:            spbuf[15] = '\0';
        !           433:            mvaddstr(0,46,spbuf);
        !           434:        }
        !           435:        if (status < 2) {
        !           436:            if (dam == NOIMPULSE && !entmode)
        !           437:                status = entmode = 1;
        !           438:            if (dam == NOWARP && entmode)
        !           439:                status = entmode = 0;
        !           440:        }
        !           441:        tmp = damflag[dam] * damage;
        !           442:        Sprintf(spbuf,"%3d.%1d ETR",tmp/10,tmp%10);
        !           443:        mvaddstr(0,69,spbuf);
        !           444:        lastdam = dam;
        !           445:     }
        !           446:     else {
        !           447:        if (olddamage) {
        !           448:            Sprintf(spbuf,"Stars: %-3d Stardate",numstars);
        !           449:            mvaddstr(0,42,spbuf);
        !           450:            lastdam = -1;
        !           451:            olddamage = 0;
        !           452:            oldcurscore = -1;
        !           453:        }
        !           454:        else if (numstars != oldstrs) {
        !           455:            Sprintf(spbuf,"%-3d",numstars);
        !           456:            mvaddstr(0,49, spbuf);
        !           457:        }
        !           458:        oldstrs = numstars;
        !           459:     }
        !           460:     if (numenemies != oldenemies) {
        !           461:        Sprintf(spbuf,"%-3d",numenemies);
        !           462:        mvaddstr(0,38, spbuf);
        !           463:        oldenemies = numenemies;
        !           464:     }
        !           465:     if (tmp = timer%10) {
        !           466:        Sprintf(spbuf,"%1d",tmp);
        !           467:        mvaddstr(0,67, spbuf);
        !           468:     }
        !           469:     else {
        !           470:        Sprintf(spbuf,"%5d.%1d",timer/10+smarts*100,tmp);
        !           471:        mvaddstr(0,61, spbuf);
        !           472:     }
        !           473:     if ((!damage || !damflag[dam]) && curscore != oldcurscore) {
        !           474:        Sprintf(spbuf,"%9ld",curscore);
        !           475:        mvaddstr(0,69, spbuf);
        !           476:        oldcurscore = curscore;
        !           477:     }
        !           478: }
        !           479: 
        !           480: void
        !           481: wavescore()
        !           482: {
        !           483:     double power, effectscore, starscore, pi_over_2;
        !           484:     long bonuses;
        !           485:     long tmp;
        !           486:     FILE *mapfp;
        !           487:     int row;
        !           488:     double pow();
        !           489: #ifndef lint
        !           490:     double atan2();
        !           491: #endif
        !           492: 
        !           493:     clear();
        !           494:     if (curscore > possiblescore)
        !           495:        curscore = possiblescore;
        !           496:     pi_over_2 = 3.14159265 / 2.0;
        !           497:     power = pow((double)inumenemies+     /* total number of enemies */
        !           498:                        inumroms*2+      /* count roms 3 times */
        !           499:                        inumgorns+       /* count gorns 2 times */
        !           500:                        inumthols+       /* count thols 2 times */
        !           501:                        inumapollos*4+   /* count apollo 5 times */
        !           502:                        inumcrushes*3+   /* count crushers 4 times */
        !           503:                        inumamoebas*5    /* count amoebas 6 times */
        !           504:            , 0.50) *                    /* skew it a little */
        !           505:            (double)smarts;              /* average energy and intelligence */
        !           506:     if (inumstars < 350 && inumenemies > 5)
        !           507:            power += (350.0 - (double)inumstars) * ((double)inumenemies - 5.0);
        !           508:     if (inumstars > 850 && inumenemies > 2)
        !           509:            power += ((double)inumstars - 850.0) * ((double)inumenemies - 2.0);
        !           510: #ifndef lint
        !           511:     effectscore = ((double)curscore / possiblescore) *
        !           512:        atan2(power, (double) timer + 1.0) / pi_over_2;
        !           513: #else
        !           514:     effectscore = pi_over_2;
        !           515: #endif
        !           516:     if (inumstars)
        !           517:        starscore = (double) numstars / (double) inumstars;
        !           518:     else
        !           519:        starscore = 1.0;
        !           520:     wave++;
        !           521:     Sprintf(spbuf,"Wave = %d, Difficulty = %d, cumulative difficulty = %d",
        !           522:         wave, smarts, cumsmarts);
        !           523:     mvaddstr(1, 13+(smarts<10), spbuf);
        !           524:     mvaddstr( 4, 68, " BONUS");
        !           525:     Sprintf(spbuf,"Efficiency rating:       %1.8f (diff=%0.2f,time=%d)",
        !           526:         effectscore, power, timer + 1);
        !           527:     mvaddstr( 5,5, spbuf);
        !           528:     if (effectscore < 0.8)
        !           529:        bonuses = tmp = 0;
        !           530:     else
        !           531:        bonuses = tmp = (long) ((effectscore-0.8) * smarts * 1000);
        !           532:     Sprintf(spbuf, "%6ld", tmp);
        !           533:     mvaddstr( 5, 68, spbuf);
        !           534:     Sprintf(spbuf,"Star save ratio:         %1.8f (%d/%d)",
        !           535:        starscore, numstars, inumstars);
        !           536:     mvaddstr( 6,5, spbuf);
        !           537: #ifndef lint
        !           538:     bonuses += tmp = (long) (((double)curscore / possiblescore) *
        !           539:        (starscore*starscore) * smarts * 20);
        !           540: #endif
        !           541:     Sprintf(spbuf, "%6ld", tmp);
        !           542:     mvaddstr( 6, 68, spbuf);
        !           543:     row = 7;
        !           544:     if (inuminhab != numinhab) {
        !           545:        Sprintf(spbuf, "Inhabited stars depopulated:  %5d", inuminhab-numinhab);
        !           546:        mvaddstr(row,5, spbuf);
        !           547:        bonuses += tmp = (long) (inuminhab-numinhab) * -500;
        !           548:        Sprintf(spbuf, "%6ld", tmp);
        !           549:        mvaddstr(row, 68, spbuf);
        !           550:        row++;
        !           551:     }
        !           552:     if (inumfriends != numfriends) {
        !           553:        Sprintf(spbuf, "Friendly craft destroyed:     %5d",
        !           554:            inumfriends-numfriends);
        !           555:        mvaddstr(row,5, spbuf);
        !           556:        bonuses += tmp = (long) (inumfriends-numfriends) * -250;
        !           557:        Sprintf(spbuf, "%6ld", tmp);
        !           558:        mvaddstr(row, 68, spbuf);
        !           559:        row++;
        !           560:     }
        !           561:     if (deadmudds) {
        !           562:        mvaddstr(row,5,"For destroying Harry Mudd:");
        !           563:        bonuses += tmp = (long) rand_mod(deadmudds * 20 + 1) - deadmudds*10;
        !           564:        Sprintf(spbuf, "%6ld", tmp);
        !           565:        mvaddstr(row, 68, spbuf);
        !           566:        row++;
        !           567:     }
        !           568:     if (bombed_out) {
        !           569:        mvaddstr(row,5, "For running away from reality:");
        !           570:        bonuses += tmp = (long) -possiblescore/2;
        !           571:        Sprintf(spbuf, "%6ld", tmp);
        !           572:        mvaddstr(row, 68,  spbuf);
        !           573:        row++;
        !           574:     }
        !           575:     if (row < 9)
        !           576:        row++;
        !           577:     Sprintf(spbuf, "Enterprise: %-9s%5d remaining",
        !           578:        !ient?"":ent?"saved":"destroyed", numents);
        !           579:     mvaddstr(row,5, spbuf);
        !           580:     bonuses += tmp = ent && !bombed_out ? (smarts+1)*15 : 0;
        !           581:     Sprintf(spbuf, "%6ld", tmp);
        !           582:     mvaddstr(row, 68, spbuf);
        !           583:     row++;
        !           584:     Sprintf(spbuf, "Base: %-9s      %5d remaining",
        !           585:        !ibase?"":base?"saved":"destroyed", numbases);
        !           586:     mvaddstr(row,5, spbuf);
        !           587:     bonuses += tmp = base && !bombed_out ? (smarts+1)*10 : 0;
        !           588:     Sprintf(spbuf, "%6ld", tmp);
        !           589:     mvaddstr(row, 68,  spbuf);
        !           590:     if (beginner) {
        !           591:        mvaddstr(13+(row>11),19, "(Special games count only a tenth as much)");
        !           592:        curscore /= 10;
        !           593:        bonuses /= 10;
        !           594:     }
        !           595:     Sprintf(spbuf, "Previous point total:%10ld",lastscore);
        !           596:     mvaddstr(15,24, spbuf);
        !           597:     Sprintf(spbuf, "Points this round:   %10ld",curscore);
        !           598:     mvaddstr(16,24, spbuf);
        !           599:     Sprintf(spbuf, "Bonuses:             %10ld",bonuses);
        !           600:     mvaddstr(17,24, spbuf);
        !           601:     totalscore = lastscore + curscore + bonuses;
        !           602:     Sprintf(spbuf, "New point total:     %10ld",totalscore);
        !           603:     mvaddstr(18,24, spbuf);
        !           604:     if (lastscore / ENTBOUNDARY < totalscore / ENTBOUNDARY) {
        !           605:        mvaddstr(row-1,42,"+ 1 new");
        !           606:        numents++;
        !           607:     }
        !           608:     else if (numents>0 &&
        !           609:        lastscore / ENTBOUNDARY > totalscore / ENTBOUNDARY) {
        !           610:        mvaddstr(row-1,42,"- 1 obsolete");
        !           611:        numents--;
        !           612:     }
        !           613:     if (lastscore / BASEBOUNDARY < totalscore / BASEBOUNDARY) {
        !           614:        mvaddstr(row,42,"+ 1 new");
        !           615:        numbases++;
        !           616:     }
        !           617:     else if (numbases>0 &&
        !           618:        lastscore / BASEBOUNDARY > totalscore / BASEBOUNDARY) {
        !           619:        mvaddstr(row,42,"- 1 obsolete");
        !           620:        numbases--;
        !           621:     }
        !           622:     if (starscore < 0.8 && inumstars > 200 && numstars > 50) {
        !           623:        Sprintf(spbuf, "smap.%d",rand_mod(MAPS-PERMMAPS)+PERMMAPS);
        !           624:        if ((mapfp = fopen(spbuf,"w")) != NULL) {
        !           625:            Reg1 OBJECT *obj;
        !           626: 
        !           627:            fprintf(mapfp,"%d\n",numstars);
        !           628:            for (obj = root.next; obj != &root; obj = obj->next) {
        !           629:                if (obj->type == Star) {
        !           630:                    fprintf(mapfp,"%d %d\n",obj->posy,obj->posx);
        !           631:                }
        !           632:            }
        !           633:            Fclose(mapfp);
        !           634:        }
        !           635:     }
        !           636: }
        !           637: 
        !           638: void
        !           639: score()
        !           640: {
        !           641:     char tmp, *retval, cdate[30];
        !           642:     Reg1 FILE *logfd;
        !           643:     Reg2 FILE *outfd;
        !           644:     Reg3 int i;
        !           645:     long nowtime, time();
        !           646:     char *scoreboard;
        !           647: 
        !           648:     for (i=0; link(LOGFILE, LOCKFILE) == -1 && i<10; i++)
        !           649:        sleep(1);
        !           650:     nowtime = time((long *)0);
        !           651:     strcpy(cdate,ctime(&nowtime));
        !           652:     if ((logfd = fopen(LOGFILE,"a")) != NULL) {
        !           653:        fprintf(logfd,
        !           654:            "%-24s%-9s%7ld%c%2d %4d %s",
        !           655:            realname, logname, totalscore, c,smarts, cumsmarts, cdate);
        !           656:        Fclose(logfd);
        !           657:     }
        !           658:     strcpy(cdate+11,cdate+20);
        !           659:     if (beginner)
        !           660:        scoreboard = FSCOREBOARD;
        !           661:     else if (lowspeed)
        !           662:        scoreboard = LSCOREBOARD;
        !           663:     else
        !           664:        scoreboard = SCOREBOARD;
        !           665:     if (eaccess(scoreboard,0)) {
        !           666:        if ((logfd = fopen(scoreboard,"w")) != NULL)
        !           667:            Fclose(logfd);
        !           668:     }
        !           669:     if ((logfd = fopen(scoreboard,"r")) != NULL &&
        !           670:        (outfd = fopen(TMPSCOREBOARD,"w")) != NULL) {
        !           671:        for (i=0; i<20; i++) {
        !           672:            if ((retval = fgets(buf, 100, logfd)) == NULL)
        !           673:                break;
        !           674:            if (atol(buf+32) < totalscore)
        !           675:                break;
        !           676:            if (strnEQ(buf+COMPOFF,COMPNAME,COMPLEN)) {
        !           677:                i = 100;
        !           678:                break;
        !           679:            }
        !           680:            fprintf(outfd, "%s", buf);
        !           681:        }
        !           682:        if (i == 100) {
        !           683:            mvaddstr(20,21, "You did not better your previous score");
        !           684:            Fclose(outfd);
        !           685:            unlink(TMPSCOREBOARD);
        !           686:        }
        !           687:        else if (i < 20) {
        !           688:            fprintf(outfd, "%-24s%-8s%8ld%c %2d    %4d    %s",
        !           689:                realname, logname, totalscore, c,smarts, cumsmarts, cdate);
        !           690:            i++;
        !           691:            Sprintf(spbuf, "    Congratulations--you've placed %d%s",
        !           692:              i, i==1?"st":(i==2?"nd":(i==3?"rd":"th")));
        !           693:            if (retval != NULL) {
        !           694:                if (strnNE(buf+COMPOFF,COMPNAME,COMPLEN)) {
        !           695:                    fprintf(outfd, "%s", buf);
        !           696:                    i++;
        !           697:                }
        !           698:                else
        !           699:                    strcpy(spbuf,"Congratulations--you've bettered your score");
        !           700:                while (i<20) {
        !           701:                    if (fgets(buf, 100, logfd) == NULL)
        !           702:                        break;
        !           703:                    if (strnNE(buf+COMPOFF,COMPNAME,COMPLEN)) {
        !           704:                        fprintf(outfd, "%s", buf);
        !           705:                        i++;
        !           706:                    }
        !           707:                }
        !           708:            }
        !           709:            mvaddstr(20,19, spbuf);
        !           710:            Fclose(logfd);
        !           711:            Fclose(outfd);
        !           712:            while (unlink(scoreboard) == 0)
        !           713:                ;
        !           714:            link(TMPSCOREBOARD,scoreboard);
        !           715:            unlink(TMPSCOREBOARD);
        !           716:            logfd = fopen(scoreboard,"r");
        !           717:        }
        !           718:        else {
        !           719:            mvaddstr(20,22,"You did not place within the top 20");
        !           720:            Fclose(outfd);
        !           721:        }
        !           722:     }
        !           723:     else {
        !           724:        Sprintf(spbuf,"(Cannot access %s file, error %d)",
        !           725:            (logfd==NULL?"log":"tmp"),errno);
        !           726:        mvaddstr(20,22,spbuf);
        !           727:     }
        !           728:     move(23,0,0);
        !           729:     erase_eol();
        !           730:     mvaddstr(23,11,
        !           731:        "[Hit space for scoreboard, 'r' for new game, 'q' to quit]");
        !           732:     unlink(LOCKFILE);
        !           733:     Fflush(stdout);
        !           734:     eat_typeahead();
        !           735:     do {
        !           736:        getcmd(&tmp);
        !           737:     } while (tmp != INTRCH && tmp != BREAKCH && !index(" rqQ",tmp));
        !           738:     if (index("qQr",tmp)) {
        !           739:        justonemoretime = (tmp == 'r');
        !           740:        if (logfd != NULL)
        !           741:            Fclose(logfd);
        !           742:     }
        !           743:     else {
        !           744:        clear();
        !           745:        if (logfd != NULL) {
        !           746:            fseek(logfd, 0, 0);
        !           747:            if (beginner)
        !           748:                mvaddstr(0,31,"TOP FUNNY WARPISTS");
        !           749:            else if (lowspeed)
        !           750:                mvaddstr(0,29,"TOP LOW-SPEED WARPISTS");
        !           751:            else
        !           752:                mvaddstr(0,33,"TOP WARPISTS");
        !           753:            mvaddstr(2,0,"RANK  WHO                     AKA        SCORE DIFF  CUMDIFF  WHEN");
        !           754:            for (i=1; i<=20; i++) {
        !           755:                if (fgets(buf, 100, logfd) == NULL)
        !           756:                    break;
        !           757:                buf[strlen(buf)-1] = '\0';
        !           758:                Sprintf(spbuf, " %2d   %s", i, buf);
        !           759:                mvaddstr(i+2,0, spbuf);
        !           760:            }
        !           761:            Fclose(logfd);
        !           762:        }
        !           763:        roundsleep(1);
        !           764:        mvaddstr(23,25,"Would you like to play again?");
        !           765:        eat_typeahead();
        !           766:        do {
        !           767:            getcmd(&tmp);
        !           768:        } while (tmp != INTRCH && tmp != BREAKCH && !index("nNyY \n\r",tmp));
        !           769:        if (tmp == 'n' || tmp == 'N' || tmp == INTRCH || tmp == BREAKCH)
        !           770:            justonemoretime = FALSE;
        !           771:     }
        !           772: 
        !           773:     smarts = ismarts;
        !           774:     totalscore = cumsmarts = wave = 0;
        !           775:     numents = 5;
        !           776:     numbases = 3;
        !           777:     apolspec = FALSE;
        !           778:     beginner   = FALSE;
        !           779:     crushspec  = FALSE;
        !           780:     gornspec   = FALSE;
        !           781:     massacre   = (ismarts >= 40);
        !           782:     romspec    = FALSE;
        !           783:     tholspec   = FALSE;
        !           784: }
        !           785: 
        !           786: void
        !           787: save_game()
        !           788: {
        !           789:     FILE *savfil;
        !           790: 
        !           791:     if (experimenting)
        !           792:        return;
        !           793:     if ((savfil = fopen(savefilename,"w")) == NULL) {
        !           794:        resetty();
        !           795:        printf("Cannot save game\r\n");
        !           796:        finalize(1);
        !           797:     }
        !           798:     fprintf(savfil, "%-8s %10ld, %2d,%5d,%2d,%2d,%3d %c%c%c%c%c%c%c%c\n",
        !           799:        logname, totalscore, smarts, cumsmarts, numents, numbases, wave,
        !           800:        apolspec ? 'a' : ' ',
        !           801:        beginner   ? 'b' : ' ',
        !           802:        crushspec  ? 'c' : ' ',
        !           803:        gornspec   ? 'g' : ' ',
        !           804:        massacre   ? 'm' : ' ',
        !           805:        romspec    ? 'r' : ' ',
        !           806:        tholspec   ? 't' : ' ',
        !           807:        lowspeed   ? 'l' : ' ',
        !           808:        amoebaspec ? '&' : ' '
        !           809:     );
        !           810:     Fclose(savfil);
        !           811:     resetty();
        !           812:     if (panic)
        !           813:        finalize(0);
        !           814:     clear();
        !           815:     finalize(0);
        !           816: }
        !           817: f("Cannot save game\r\n");
        !           818:        finalize(1);
        !           819:     }
        !           820:     fprintf(savfil, "%-8s %10ld, %2d,%5d,%2d,%2d,%3d %c%c%c%c%c%c%c%c\n",
        !           821:        logname, totalscore, smarts, cumsmarts, numents, numbases, wave,
        !           822:        apolspec ? 'a' : ' ',
        !           823:        beginner   ? 'b' : ' ',
        !           824:        crushspec  ? 'c' : ' ',
        !           825:        gornspec   ? 'g' : ' ',
        !           826:        massawarp/term.c   644    171      5       43531  5121747710   6201 /* $Header: term.c,v 7.0.1.2 86/12/12 17:04:09 lwall Exp $ */
        !           827: 
        !           828: /* $Log:       term.c,v $
        !           829:  * Revision 7.0.1.2  86/12/12  17:04:09  lwall
        !           830:  * Baseline for net release.
        !           831:  * 
        !           832:  * Revision 7.0.1.1  86/10/16  10:53:20  lwall
        !           833:  * Added Damage.  Fixed random bugs.
        !           834:  * 
        !           835:  * Revision 7.0  86/10/08  15:14:02  lwall
        !           836:  * Split into separate files.  Added amoebas and pirates.
        !           837:  * 
        !           838:  */
        !           839: 
        !           840: #include "EXTERN.h"
        !           841: #include "warp.h"
        !           842: #include "bang.h"
        !           843: #include "intrp.h"
        !           844: #include "object.h"
        !           845: #include "play.h"
        !           846: #include "score.h"
        !           847: #include "sig.h"
        !           848: #include "us.h"
        !           849: #include "util.h"
        !           850: #include "weapon.h"
        !           851: #include "INTERN.h"
        !           852: #include "term.h"
        !           853: 
        !           854: int typeahead = FALSE;
        !           855: 
        !           856: char tcarea[TCSIZE];   /* area for "compiled" termcap strings */
        !           857: 
        !           858: /* guarantee capability pointer != Nullch */
        !           859: /* (I believe terminfo will ignore the &tmpaddr argument.) */
        !           860: 
        !           861: #define Tgetstr(key) ((tstr = tgetstr(key,&tmpaddr)) ? tstr : nullstr)
        !           862: 
        !           863: #ifdef PUSHBACK
        !           864: struct keymap {
        !           865:     char km_type[128];
        !           866:     union km_union {
        !           867:        struct keymap *km_km;
        !           868:        char *km_str;
        !           869:     } km_ptr[128];
        !           870: };
        !           871: 
        !           872: #define KM_NOTHIN 0
        !           873: #define KM_STRING 1
        !           874: #define KM_KEYMAP 2
        !           875: #define KM_BOGUS 3
        !           876: 
        !           877: #define KM_TMASK 3
        !           878: #define KM_GSHIFT 4
        !           879: #define KM_GMASK 7
        !           880: 
        !           881: typedef struct keymap KEYMAP;
        !           882: 
        !           883: KEYMAP *topmap INIT(Null(KEYMAP*));
        !           884: 
        !           885: void mac_init();
        !           886: KEYMAP *newkeymap();
        !           887: void pushstring();
        !           888: #endif
        !           889: 
        !           890: /* terminal initialization */
        !           891: 
        !           892: void
        !           893: term_init()
        !           894: {
        !           895:     savetty();                         /* remember current tty state */
        !           896: 
        !           897: #ifdef TERMIO
        !           898:     ospeed = _tty.c_cflag & CBAUD;     /* for tputs() */
        !           899:     ERASECH = _tty.c_cc[VERASE];       /* for finish_command() */
        !           900:     KILLCH = _tty.c_cc[VKILL];         /* for finish_command() */
        !           901: #else
        !           902:     ospeed = _tty.sg_ospeed;           /* for tputs() */
        !           903:     ERASECH = _tty.sg_erase;           /* for finish_command() */
        !           904:     KILLCH = _tty.sg_kill;             /* for finish_command() */
        !           905: #endif
        !           906: 
        !           907:     /* The following could be a table but I can't be sure that there isn't */
        !           908:     /* some degree of sparsity out there in the world. */
        !           909: 
        !           910:     switch (ospeed) {                  /* 1 second of padding */
        !           911: #ifdef BEXTA
        !           912:         case BEXTA:  just_a_sec = 1920; break;
        !           913: #else
        !           914: #ifdef B19200
        !           915:         case B19200: just_a_sec = 1920; break;
        !           916: #endif
        !           917: #endif
        !           918:         case B9600:  just_a_sec =  960; break;
        !           919:         case B4800:  just_a_sec =  480; break;
        !           920:         case B2400:  just_a_sec =  240; break;
        !           921:         case B1800:  just_a_sec =  180; break;
        !           922:         case B1200:  just_a_sec =  120; break;
        !           923:         case B600:   just_a_sec =   60; break;
        !           924:        case B300:   just_a_sec =   30; break;
        !           925:        /* do I really have to type the rest of this??? */
        !           926:         case B200:   just_a_sec =   20; break;
        !           927:         case B150:   just_a_sec =   15; break;
        !           928:         case B134:   just_a_sec =   13; break;
        !           929:         case B110:   just_a_sec =   11; break;
        !           930:         case B75:    just_a_sec =    8; break;
        !           931:         case B50:    just_a_sec =    5; break;
        !           932:         default:     just_a_sec =  960; break;
        !           933:                                        /* if we are running detached I */
        !           934:     }                                  /*  don't want to know about it! */
        !           935: }
        !           936: 
        !           937: /* set terminal characteristics */
        !           938: 
        !           939: void
        !           940: term_set(tcbuf)
        !           941: char *tcbuf;           /* temp area for "uncompiled" termcap entry */
        !           942: {
        !           943:     char *tmpaddr;                     /* must not be register */
        !           944:     Reg1 char *tstr;
        !           945:     char *tgetstr();
        !           946:     char *s;
        !           947:     int retval;
        !           948: 
        !           949: #ifdef PENDING
        !           950: #ifndef FIONREAD
        !           951: #ifndef RDCHK
        !           952:     /* do no delay reads on something that always gets closed on exit */
        !           953: 
        !           954:     devtty = open("/dev/tty",0);
        !           955:     if (devtty < 0) {
        !           956:        printf(cantopen,"/dev/tty");
        !           957:        finalize(1);
        !           958:     }
        !           959:     fcntl(devtty,F_SETFL,O_NDELAY);
        !           960: #endif
        !           961: #endif
        !           962: #endif
        !           963:     
        !           964:     /* get all that good termcap stuff */
        !           965: 
        !           966: #ifdef HAVETERMLIB
        !           967:     retval = tgetent(tcbuf,getenv("TERM"));    /* get termcap entry */
        !           968:     if (retval < 1) {
        !           969: #ifdef VERBOSE
        !           970:        printf("No termcap %s found.\n", retval ? "file" : "entry");
        !           971: #else
        !           972:        fputs("Termcap botch\n",stdout);
        !           973: #endif
        !           974:        finalize(1);
        !           975:     }
        !           976:     tmpaddr = tcarea;                  /* set up strange tgetstr pointer */
        !           977:     s = Tgetstr("pc");                 /* get pad character */
        !           978:     PC = *s;                           /* get it where tputs wants it */
        !           979:     if (!tgetflag("bs")) {             /* is backspace not used? */
        !           980:        BC = Tgetstr("bc");             /* find out what is */
        !           981:        if (BC == nullstr)              /* terminfo grok's 'bs' but not 'bc' */
        !           982:            BC = Tgetstr("le");
        !           983:     } else
        !           984:        BC = "\b";                      /* make a backspace handy */
        !           985:     UP = Tgetstr("up");                        /* move up a line */
        !           986:     ND = Tgetstr("nd");                        /* non-destructive move cursor right */
        !           987:     DO = Tgetstr("do");                        /* move cursor down */
        !           988:     if (!*DO)
        !           989:        DO = Tgetstr("nl");
        !           990:     CL = Tgetstr("cl");                        /* get clear string */
        !           991:     CE = Tgetstr("ce");                        /* clear to end of line string */
        !           992:     CM = Tgetstr("cm");                        /* cursor motion - PWP */
        !           993:     HO = Tgetstr("ho");                        /* home cursor if no CM - PWP */
        !           994:     CD = Tgetstr("cd");                        /* clear to end of display - PWP */
        !           995:     SO = Tgetstr("so");                        /* begin standout */
        !           996:     SE = Tgetstr("se");                        /* end standout */
        !           997:     if ((SG = tgetnum("sg"))<0)
        !           998:        SG = 0;                         /* blanks left by SG, SE */
        !           999:     US = Tgetstr("us");                        /* start underline */
        !          1000:     UE = Tgetstr("ue");                        /* end underline */
        !          1001:     if ((UG = tgetnum("ug"))<0)
        !          1002:        UG = 0;                         /* blanks left by US, UE */
        !          1003:     if (*US)
        !          1004:        UC = nullstr;                   /* UC must not be NULL */
        !          1005:     else
        !          1006:        UC = Tgetstr("uc");             /* underline a character */
        !          1007:     if (!*US && !*UC) {                        /* no underline mode? */
        !          1008:        US = SO;                        /* substitute standout mode */
        !          1009:        UE = SE;
        !          1010:        UG = SG;
        !          1011:     }
        !          1012:     LINES = tgetnum("li");             /* lines per page */
        !          1013:     COLS = tgetnum("co");              /* columns on page */
        !          1014:     AM = tgetflag("am");               /* terminal wraps automatically? */
        !          1015:     XN = tgetflag("xn");               /* then eats next newline? */
        !          1016:     VB = Tgetstr("vb");
        !          1017:     if (!*VB)
        !          1018:        VB = "\007";
        !          1019:     CR = Tgetstr("cr");
        !          1020:     if (!*CR) {
        !          1021:        if (tgetflag("nc") && *UP) {
        !          1022:            CR = safemalloc((MEM_SIZE)strlen(UP)+2);
        !          1023:            Sprintf(CR,"%s\r",UP);
        !          1024:        }
        !          1025:        else
        !          1026:            CR = "\r";
        !          1027:     }
        !          1028: #else
        !          1029:     ??????                             /* Roll your own... */
        !          1030: #endif
        !          1031:     if (LINES <= 0)
        !          1032:        LINES = 24;
        !          1033:     if (COLS <= 0)
        !          1034:        COLS = 80;
        !          1035: 
        !          1036:     BCsize = comp_tc(bsptr,BC,1);
        !          1037:     BC = bsptr;
        !          1038: 
        !          1039:     if (!*ND)                          /* not defined? */
        !          1040:        NDsize = 1000;                  /* force cursor addressing */
        !          1041:     else {
        !          1042:        NDsize = comp_tc(cmbuffer,ND,1);
        !          1043:        myND = malloc((unsigned)NDsize);
        !          1044:        movc3(NDsize,cmbuffer,myND);
        !          1045:        if (debugging) {
        !          1046:            int scr;
        !          1047: 
        !          1048:            printf("ND");
        !          1049:            for (scr=0; scr<NDsize; scr++)
        !          1050:                printf(" %d",myND[scr]);
        !          1051:            printf("\n");
        !          1052:        }
        !          1053:     }
        !          1054: 
        !          1055:     if (!*UP)                          /* not defined? */
        !          1056:        UPsize = 1000;                  /* force cursor addressing */
        !          1057:     else {
        !          1058:        UPsize = comp_tc(cmbuffer,UP,1);
        !          1059:        myUP = malloc((unsigned)UPsize);
        !          1060:        movc3(UPsize,cmbuffer,myUP);
        !          1061:        if (debugging) {
        !          1062:            int scr;
        !          1063: 
        !          1064:            printf("UP");
        !          1065:            for (scr=0; scr<UPsize; scr++)
        !          1066:                printf(" %d",myUP[scr]);
        !          1067:            printf("\n");
        !          1068:        }
        !          1069:     }
        !          1070: 
        !          1071:     if (!*DO) {                                /* not defined? */
        !          1072:        myDO = DO = "\n";               /* assume a newline */
        !          1073:        DOsize = 1;
        !          1074:     }
        !          1075:     else {
        !          1076:        DOsize = comp_tc(cmbuffer,DO,1);
        !          1077:        myDO = malloc((unsigned)DOsize);
        !          1078:        movc3(DOsize,cmbuffer,myDO);
        !          1079:        if (debugging) {
        !          1080:            int scr;
        !          1081: 
        !          1082:            printf("DO");
        !          1083:            for (scr=0; scr<DOsize; scr++)
        !          1084:                printf(" %d",myDO[scr]);
        !          1085:            printf("\n");
        !          1086:        }
        !          1087:     }
        !          1088:     if (debugging)
        !          1089:        Fgets(cmbuffer,(sizeof cmbuffer),stdin);
        !          1090: 
        !          1091:     CMsize = comp_tc(cmbuffer,tgoto(CM,20,20),0);
        !          1092:     if (PC != '\0') {
        !          1093:        char *p;
        !          1094: 
        !          1095:        for (p=filler+(sizeof filler)-1;!*p;--p)
        !          1096:            *p = PC;
        !          1097:     }
        !          1098:     charsperhalfsec = ospeed >= B9600 ? 480 :
        !          1099:                      ospeed == B4800 ? 240 :
        !          1100:                      ospeed == B2400 ? 120 :
        !          1101:                      ospeed == B1200 ? 60 :
        !          1102:                      ospeed == B600 ? 30 :
        !          1103:              /* speed is 300 (?) */   15;
        !          1104: 
        !          1105:     gfillen = ospeed >= B9600 ? (sizeof filler) :
        !          1106:              ospeed == B4800 ? 13 :
        !          1107:              ospeed == B2400 ? 7 :
        !          1108:              ospeed == B1200 ? 4 :
        !          1109:                                1+BCsize;
        !          1110:     if (ospeed < B2400)
        !          1111:        lowspeed = TRUE;
        !          1112: 
        !          1113:     strcpy(term,ttyname(2));
        !          1114: 
        !          1115:     if (!*CM || !BCsize)
        !          1116:        no_can_do("dumb");
        !          1117:     if (!scorespec && (LINES < 24 || COLS < 80))
        !          1118:        no_can_do("puny");
        !          1119: 
        !          1120:     crmode();
        !          1121:     raw();
        !          1122:     noecho();                          /* turn off echo */
        !          1123:     nonl();
        !          1124: 
        !          1125: #ifdef PUSHBACK
        !          1126:     mac_init(tcbuf);
        !          1127: #endif
        !          1128: }
        !          1129: 
        !          1130: #ifdef PUSHBACK
        !          1131: void
        !          1132: mac_init(tcbuf)
        !          1133: char *tcbuf;
        !          1134: {
        !          1135:     char tmpbuf[1024];
        !          1136: 
        !          1137:     tmpfp = fopen(filexp(getval("WARPMACRO",WARPMACRO)),"r");
        !          1138:     if (tmpfp != Nullfp) {
        !          1139:        while (fgets(tcbuf,1024,tmpfp) != Nullch) {
        !          1140:            mac_line(tcbuf,tmpbuf,(sizeof tmpbuf));
        !          1141:        }
        !          1142:        Fclose(tmpfp);
        !          1143:     }
        !          1144: }
        !          1145: 
        !          1146: void
        !          1147: mac_line(line,tmpbuf,tbsize)
        !          1148: char *line;
        !          1149: char *tmpbuf;
        !          1150: int tbsize;
        !          1151: {
        !          1152:     Reg1 char *s;
        !          1153:     Reg2 char *m;
        !          1154:     Reg3 KEYMAP *curmap;
        !          1155:     Reg4 int ch;
        !          1156:     Reg5 int garbage = 0;
        !          1157:     static char override[] = "\r\nkeymap overrides string\r\n";
        !          1158: 
        !          1159:     if (topmap == Null(KEYMAP*))
        !          1160:        topmap = newkeymap();
        !          1161:     if (*line == '#' || *line == '\n')
        !          1162:        return;
        !          1163:     if (line[ch = strlen(line)-1] == '\n')
        !          1164:        line[ch] = '\0';
        !          1165:     m = dointerp(tmpbuf,tbsize,line," \t");
        !          1166:     if (!*m)
        !          1167:        return;
        !          1168:     while (*m == ' ' || *m == '\t') m++;
        !          1169:     for (s=tmpbuf,curmap=topmap; *s; s++) {
        !          1170:        ch = *s & 0177;
        !          1171:        if (s[1] == '+' && isdigit(s[2])) {
        !          1172:            s += 2;
        !          1173:            garbage = (*s & KM_GMASK) << KM_GSHIFT;
        !          1174:        }
        !          1175:        else
        !          1176:            garbage = 0;
        !          1177:        if (s[1]) {
        !          1178:            if ((curmap->km_type[ch] & KM_TMASK) == KM_STRING) {
        !          1179:                puts(override);
        !          1180:                free(curmap->km_ptr[ch].km_str);
        !          1181:                curmap->km_ptr[ch].km_str = Nullch;
        !          1182:            }
        !          1183:            curmap->km_type[ch] = KM_KEYMAP + garbage;
        !          1184:            if (curmap->km_ptr[ch].km_km == Null(KEYMAP*))
        !          1185:                curmap->km_ptr[ch].km_km = newkeymap();
        !          1186:            curmap = curmap->km_ptr[ch].km_km;
        !          1187:        }
        !          1188:        else {
        !          1189:            if ((curmap->km_type[ch] & KM_TMASK) == KM_KEYMAP)
        !          1190:                puts(override);
        !          1191:            else {
        !          1192:                curmap->km_type[ch] = KM_STRING + garbage;
        !          1193:                curmap->km_ptr[ch].km_str = savestr(m);
        !          1194:            }
        !          1195:        }
        !          1196:     }
        !          1197: }
        !          1198: 
        !          1199: KEYMAP*
        !          1200: newkeymap()
        !          1201: {
        !          1202:     Reg1 int i;
        !          1203:     Reg2 KEYMAP *map;
        !          1204: 
        !          1205: #ifndef lint
        !          1206:     map = (KEYMAP*)safemalloc(sizeof(KEYMAP));
        !          1207: #else
        !          1208:     map = Null(KEYMAP*);
        !          1209: #endif /* lint */
        !          1210:     for (i=127; i>=0; --i) {
        !          1211:        map->km_ptr[i].km_km = Null(KEYMAP*);
        !          1212:        map->km_type[i] = KM_NOTHIN;
        !          1213:     }
        !          1214:     return map;
        !          1215: }
        !          1216: 
        !          1217: #endif
        !          1218: 
        !          1219: /* print out a file, stopping at form feeds */
        !          1220: 
        !          1221: void
        !          1222: page(filename,num)
        !          1223: char *filename;
        !          1224: bool num;
        !          1225: {
        !          1226:     int linenum = 1;
        !          1227: 
        !          1228:     tmpfp = fopen(filename,"r");
        !          1229:     if (tmpfp != NULL) {
        !          1230:        while (fgets(spbuf,(sizeof spbuf),tmpfp) != NULL) {
        !          1231:            if (*spbuf == '\f') {
        !          1232:                printf("[Type anything to continue] ");
        !          1233:                Fflush(stdout);
        !          1234:                getcmd(spbuf);
        !          1235:                printf("\r\n");
        !          1236:                if (*spbuf == INTRCH)
        !          1237:                    finalize(0);
        !          1238:                if (*spbuf == 'q' || *spbuf == 'Q')
        !          1239:                    break;
        !          1240:            }
        !          1241:            else {
        !          1242:                if (num)
        !          1243:                    printf("%3d   %s\r",linenum++,spbuf);
        !          1244:                else
        !          1245:                    printf("%s\r",spbuf);
        !          1246:            }
        !          1247:        }
        !          1248:        Fclose(tmpfp);
        !          1249:     }
        !          1250: }
        !          1251: 
        !          1252: void
        !          1253: move(y, x, chadd)
        !          1254: int y, x;
        !          1255: int chadd;
        !          1256: {
        !          1257:     Reg1 int ydist;
        !          1258:     Reg2 int xdist;
        !          1259:     Reg3 int i;
        !          1260:     Reg4 char *s;
        !          1261: 
        !          1262:     ydist = y - real_y;
        !          1263:     xdist = x - real_x;
        !          1264:     i = ydist * (ydist < 0 ? -UPsize : DOsize) +
        !          1265:         xdist * (xdist < 0 ? -BCsize : NDsize);
        !          1266:     beg_qwrite();
        !          1267:     if (i <= CMsize) {
        !          1268:        if (ydist < 0)
        !          1269:            for (; ydist; ydist++)
        !          1270:                for (i=UPsize,s=myUP; i; i--)
        !          1271:                    qaddch(*s++);
        !          1272:        else
        !          1273:            for (; ydist; ydist--)
        !          1274:                for (i=DOsize,s=myDO; i; i--)
        !          1275:                    qaddch(*s++);
        !          1276:        if (xdist < 0)
        !          1277:            for (; xdist; xdist++)
        !          1278:                for (i=BCsize,s=BC; i; i--)
        !          1279:                    qaddch(*s++);
        !          1280:        else
        !          1281:            for (; xdist; xdist--)
        !          1282:                for (i=NDsize,s=myND; i; i--)
        !          1283:                    qaddch(*s++);
        !          1284:     }
        !          1285:     else {
        !          1286:        tputs(tgoto(CM,x,y),0,cmstore);
        !          1287:     }
        !          1288:     real_y = y;
        !          1289:     real_x = x;
        !          1290:     if (chadd) {
        !          1291:        qaddch(chadd);
        !          1292:     }
        !          1293:     if (maxcmstring != cmbuffer)
        !          1294:        end_qwrite();
        !          1295: }
        !          1296: 
        !          1297: void
        !          1298: do_tc(s,l)
        !          1299: char *s;
        !          1300: int l;
        !          1301: {
        !          1302:     beg_qwrite();
        !          1303:     tputs(s,l,cmstore);
        !          1304:     end_qwrite();
        !          1305: }
        !          1306: 
        !          1307: int
        !          1308: comp_tc(dest,s,l)
        !          1309: char *dest;
        !          1310: char *s;
        !          1311: int l;
        !          1312: {
        !          1313:     maxcmstring = dest;
        !          1314:     tputs(s,l,cmstore);
        !          1315:     return(maxcmstring-dest);
        !          1316: }
        !          1317: 
        !          1318: void
        !          1319: helper()
        !          1320: {
        !          1321:     clear();
        !          1322:     mvaddstr(0,4,"h or 4          left");
        !          1323:     mvaddstr(1,4,"j or 2          down                Use with SHIFT to fire torpedoes.");
        !          1324:     mvaddstr(2,4,"k or 8          up                  Use with CTRL or FUNCT to fire");
        !          1325:     mvaddstr(3,4,"l or 6          right                   phasers or turbolasers.");
        !          1326:     mvaddstr(4,4,"b or 1          down and left       Use preceded by 'a' or 'r' for");
        !          1327:     mvaddstr(5,4,"n or 3          down and right          attractors or repulsors.");
        !          1328:     mvaddstr(6,4,"y or 7          up and left         Use normally for E or B motion.");
        !          1329:     mvaddstr(7,4,"u or 9          up and right");
        !          1330:     mvaddstr(8,4,"");
        !          1331:     mvaddstr(9,4,"del or %        fire photon torpedoes in every (reasonable) direction.");
        !          1332:     mvaddstr(10,4,"s               stop all torpedoes.");
        !          1333:     mvaddstr(11,4,"S or 0          stop the Enterprise when in warp mode.");
        !          1334:     mvaddstr(12,4,"d/D             destruct all torpedoes/current vessel.");
        !          1335:     mvaddstr(13,4,"i/w             switch to Enterprise & put into impulse/warp mode.");
        !          1336:     mvaddstr(14,4,"c/v             switch to Enterprise & make cloaked/visible.");
        !          1337:     mvaddstr(15,4,"p               switch to Base.");
        !          1338:     mvaddstr(16,4,"o               toggle to other vessel (from E to B, or vice versa.)");
        !          1339:     mvaddstr(17,4,"z               zap (suppress) blasts near Enterprise next cycle");
        !          1340:     mvaddstr(18,4,"");
        !          1341:     mvaddstr(19,4,"^R      refresh the screen.              ^Z      suspend the game.");
        !          1342:     mvaddstr(20,4,"q       exit this round (if you haven't typed q within 10 cycles).");
        !          1343:     mvaddstr(21,4,"Q       exit this game.");
        !          1344:     mvaddstr(22,4,"");
        !          1345:     mvaddstr(23,4,"                   [Hit space to continue]");
        !          1346:     Fflush(stdout);
        !          1347:     do {
        !          1348:        getcmd(spbuf);
        !          1349:     } while (*spbuf != ' ');
        !          1350:     rewrite();
        !          1351:     
        !          1352: }
        !          1353: 
        !          1354: void
        !          1355: rewrite()
        !          1356: {
        !          1357:     Reg1 int x;
        !          1358:     Reg2 int y;
        !          1359:     Reg3 OBJECT *obj;
        !          1360: 
        !          1361:     clear();
        !          1362:     for (y=0; y<YSIZE; y++) {
        !          1363:        for (x=0; x<XSIZE; x++) {
        !          1364:            if (numamoebas && amb[y][x] != ' ')
        !          1365:                mvaddc(y+1,x*2,amb[y][x]);
        !          1366:            if (obj=occupant[y][x]) {
        !          1367:                if (obj->image != ' ')
        !          1368:                    mvaddc(y+1,x*2,obj->image);
        !          1369:            }
        !          1370:        }
        !          1371:     }
        !          1372:     Sprintf(spbuf,
        !          1373:     "%-4s E: %4d %2d B: %5d %3d Enemies: %-3d Stars: %-3d Stardate%5d.%1d %9ld",
        !          1374:        "   ", 0, 0, 0, 0, 0, 0, timer/10+smarts*100, timer%10, 0L);
        !          1375:     mvaddstr(0,0,spbuf);
        !          1376:     oldeenergy = oldbenergy = oldcurscore =
        !          1377:     oldstatus = oldetorp = oldbtorp = oldstrs = oldenemies = -1;
        !          1378:                                        /* force everything to fill in */
        !          1379:     if (damage)
        !          1380:        olddamage = 0;
        !          1381:     if (!ent)
        !          1382:        etorp = 0;
        !          1383:     if (!base)
        !          1384:        btorp = 0;
        !          1385:     display_status();
        !          1386: }
        !          1387: 
        !          1388: char
        !          1389: cmstore(ch)
        !          1390: Reg1 char ch;
        !          1391: {
        !          1392:     *maxcmstring++ = ch;
        !          1393: }
        !          1394: 
        !          1395: /* discard any characters typed ahead */
        !          1396: 
        !          1397: void
        !          1398: eat_typeahead()
        !          1399: {
        !          1400: #ifdef PUSHBACK
        !          1401:     if (!typeahead && nextin==nextout) /* cancel only keyboard stuff */
        !          1402: #else
        !          1403:     if (!typeahead)
        !          1404: #endif
        !          1405:     {
        !          1406: #ifdef PENDING
        !          1407:        while (input_pending())
        !          1408:            Read_tty(buf,sizeof(buf));
        !          1409: #else /* this is probably v7, with no rdchk() */
        !          1410:        ioctl(_tty_ch,TIOCSETP,&_tty);
        !          1411: #endif
        !          1412:     }
        !          1413: }
        !          1414: 
        !          1415: void
        !          1416: settle_down()
        !          1417: {
        !          1418:     dingaling();
        !          1419:     Fflush(stdout);
        !          1420:     sleep(1);
        !          1421: #ifdef PUSHBACK
        !          1422:     nextout = nextin;                  /* empty circlebuf */
        !          1423: #endif
        !          1424:     eat_typeahead();
        !          1425: }
        !          1426: 
        !          1427: #ifdef PUSHBACK
        !          1428: /* read a character from the terminal, with multi-character pushback */
        !          1429: 
        !          1430: int
        !          1431: read_tty(addr,size)
        !          1432: char *addr;
        !          1433: int size;      /* ignored for now */
        !          1434: {
        !          1435: #ifdef lint
        !          1436:     size = size;
        !          1437: #endif
        !          1438:     if (nextout != nextin) {
        !          1439:        *addr = circlebuf[nextout++];
        !          1440:        nextout %= PUSHSIZE;
        !          1441:        return 1;
        !          1442:     }
        !          1443:     else {
        !          1444:        size = read(0,addr,1);
        !          1445:        if (size < 0)
        !          1446:            sig_catcher(SIGHUP);
        !          1447:        if (metakey) {
        !          1448:            if (*addr & 0200) {
        !          1449:                pushchar(*addr & 0177);
        !          1450:                *addr = '\001';
        !          1451:            }
        !          1452:        }
        !          1453:        else
        !          1454:            *addr &= 0177;
        !          1455:        return 1;
        !          1456:     }
        !          1457: }
        !          1458: 
        !          1459: #ifdef PENDING
        !          1460: #ifndef FIONREAD
        !          1461: #ifndef RDCHK
        !          1462: int
        !          1463: circfill()
        !          1464: {
        !          1465:     Reg1 int howmany;
        !          1466:     Reg2 int i;
        !          1467: 
        !          1468:     assert (nextin == nextout);
        !          1469:     howmany = read(devtty,circlebuf+nextin,metakey?1:PUSHSIZE-nextin);
        !          1470:     if (howmany > 0) {
        !          1471:        if (metakey) {
        !          1472:            if (circlebuf[nextin] & 0200) {
        !          1473:                circlebuf[nextin] &= 0177;
        !          1474:                pushchar('\001');
        !          1475:            }
        !          1476:        }
        !          1477:        else
        !          1478:            for (i = howmany+nextin-1; i >= nextin; i--)
        !          1479:                circlebuf[i] &= 0177;
        !          1480:        nextin += howmany;
        !          1481:        nextin %= PUSHSIZE;     /* may end up 1 if metakey */
        !          1482:     }
        !          1483:     return howmany;
        !          1484: }
        !          1485: #endif /* RDCHK */
        !          1486: #endif /* FIONREAD */
        !          1487: #endif /* PENDING */
        !          1488: 
        !          1489: void
        !          1490: pushchar(ch)
        !          1491: char ch;
        !          1492: {
        !          1493:     nextout--;
        !          1494:     if (nextout < 0)
        !          1495:        nextout = PUSHSIZE - 1;
        !          1496:     if (nextout == nextin) {
        !          1497:        fputs("\r\npushback buffer overflow\r\n",stdout);
        !          1498:        sig_catcher(0);
        !          1499:     }
        !          1500:     circlebuf[nextout] = ch;
        !          1501: }
        !          1502: 
        !          1503: #else /* PUSHBACK */
        !          1504: #ifndef read_tty
        !          1505: /* read a character from the terminal, with hacks for O_NDELAY reads */
        !          1506: 
        !          1507: int
        !          1508: read_tty(addr,size)
        !          1509: char *addr;
        !          1510: int size;
        !          1511: {
        !          1512:     if (is_input) {
        !          1513:        *addr = pending_ch;
        !          1514:        is_input = FALSE;
        !          1515:        return 1;
        !          1516:     }
        !          1517:     else {
        !          1518:        size = read(0,addr,size);
        !          1519:        if (size < 0)
        !          1520:            sig_catcher(SIGHUP);
        !          1521:        if (metakey) {
        !          1522:            if (*addr & 0200) {
        !          1523:                pending_ch = *addr & 0177;
        !          1524:                is_input = TRUE;
        !          1525:                *addr = '\001';
        !          1526:            }
        !          1527:        }
        !          1528:        else
        !          1529:            *addr &= 0177;
        !          1530:        return size;
        !          1531:     }
        !          1532: }
        !          1533: #endif /* read_tty */
        !          1534: #endif /* PUSHBACK */
        !          1535: 
        !          1536: int
        !          1537: read_nd(buff, siz)
        !          1538: char *buff;
        !          1539: int siz;
        !          1540: {
        !          1541:     if (!input_pending())
        !          1542:        return 0;
        !          1543: 
        !          1544:     getcmd(buff);
        !          1545:     return 1;
        !          1546: }
        !          1547: 
        !          1548: /* get a character into a buffer */
        !          1549: 
        !          1550: void
        !          1551: getcmd(whatbuf)
        !          1552: Reg3 char *whatbuf;
        !          1553: {
        !          1554: #ifdef PUSHBACK
        !          1555:     Reg1 KEYMAP *curmap;
        !          1556:     Reg2 int i;
        !          1557:     bool no_macros; 
        !          1558:     int times = 0;                     /* loop detector */
        !          1559:     char scrchar;
        !          1560: 
        !          1561: tryagain:
        !          1562:     curmap = topmap;
        !          1563: /*    no_macros = (whatbuf != buf && nextin == nextout);  */
        !          1564:     no_macros = FALSE;
        !          1565: #endif
        !          1566:     for (;;) {
        !          1567:        errno = 0;
        !          1568:        if (read_tty(whatbuf,1) < 0 && !errno)
        !          1569:            errno = EINTR;
        !          1570: #ifdef read_tty
        !          1571:        if (metakey) {
        !          1572:            if (*whatbuf & 0200) {
        !          1573:                *what_buf &= 037;       /* punt and hope they don't notice */
        !          1574:            }
        !          1575:        }
        !          1576:        else
        !          1577:            *whatbuf &= 0177;
        !          1578: #endif /* read_tty */
        !          1579:        if (errno && errno != EINTR) {
        !          1580:            perror(readerr);
        !          1581:            sig_catcher(0);
        !          1582:        }
        !          1583: #ifdef PUSHBACK
        !          1584:        if (*whatbuf & 0200 || no_macros) {
        !          1585:            *whatbuf &= 0177;
        !          1586:            goto got_canonical;
        !          1587:        }
        !          1588:        if (curmap == Null(KEYMAP*))
        !          1589:            goto got_canonical;
        !          1590:        for (i = (curmap->km_type[*whatbuf] >> KM_GSHIFT) & KM_GMASK; i; --i){
        !          1591:            Read_tty(&scrchar,1);
        !          1592:        }
        !          1593:        switch (curmap->km_type[*whatbuf] & KM_TMASK) {
        !          1594:        case KM_NOTHIN:                 /* no entry? */
        !          1595:            if (curmap == topmap)       /* unmapped canonical */
        !          1596:                goto got_canonical;
        !          1597:            settle_down();
        !          1598:            goto tryagain;
        !          1599:        case KM_KEYMAP:                 /* another keymap? */
        !          1600:            curmap = curmap->km_ptr[*whatbuf].km_km;
        !          1601:            assert(curmap != Null(KEYMAP*));
        !          1602:            break;
        !          1603:        case KM_STRING:                 /* a string? */
        !          1604:            pushstring(curmap->km_ptr[*whatbuf].km_str);
        !          1605:            if (++times > 20) {         /* loop? */
        !          1606:                fputs("\r\nmacro loop?\r\n",stdout);
        !          1607:                settle_down();
        !          1608:            }
        !          1609:            no_macros = FALSE;
        !          1610:            goto tryagain;
        !          1611:        }
        !          1612: #else
        !          1613:        *whatbuf &= 0177;
        !          1614:        break;
        !          1615: #endif
        !          1616:     }
        !          1617: 
        !          1618: got_canonical:
        !          1619: #ifndef TERMIO
        !          1620:     if (*whatbuf == '\r')
        !          1621:        *whatbuf = '\n';
        !          1622: #endif
        !          1623:     if (whatbuf == buf)
        !          1624:        whatbuf[1] = FINISHCMD;         /* tell finish_command to work */
        !          1625: }
        !          1626: 
        !          1627: #ifdef PUSHBACK
        !          1628: void
        !          1629: pushstring(str)
        !          1630: char *str;
        !          1631: {
        !          1632:     Reg1 int i;
        !          1633:     char tmpbuf[PUSHSIZE];
        !          1634:     Reg2 char *s = tmpbuf;
        !          1635: 
        !          1636:     assert(str != Nullch);
        !          1637:     interp(s,PUSHSIZE,str);
        !          1638:     for (i = strlen(s)-1; i >= 0; --i) {
        !          1639:        s[i] ^= 0200; 
        !          1640:        pushchar(s[i]);
        !          1641:     }
        !          1642: }
        !          1643: #endif
        !          1644: = FALSE;
        !          1645:            goto tryagain;
        !          1646:        }
        !          1647: #else
        !          1648:        *whatbuf &= 0177;
        !          1649:        break;
        !          1650: #endif
        !          1651:     }
        !          1652: 
        !          1653: got_canonical:
        !          1654: #ifndef TERMIO
        !          1655:     if (*whatbuf == '\r')
        !          1656:        *whatbuf = '\n';
        !          1657: #endif
        !          1658:     if warp/util.c   644    171      5       12314  5121747713   6205 /* $Header: util.c,v 7.0.1.2 86/10/20 12:07:46 lwall Exp $ */
        !          1659: 
        !          1660: /* $Log:       util.c,v $
        !          1661:  * Revision 7.0.1.2  86/10/20  12:07:46  lwall
        !          1662:  * Made all exits reset tty.
        !          1663:  * 
        !          1664:  * Revision 7.0.1.1  86/10/16  10:54:02  lwall
        !          1665:  * Added Damage.  Fixed random bugs.
        !          1666:  * 
        !          1667:  * Revision 7.0  86/10/08  15:14:31  lwall
        !          1668:  * Split into separate files.  Added amoebas and pirates.
        !          1669:  * 
        !          1670:  */
        !          1671: 
        !          1672: #include "EXTERN.h"
        !          1673: #include "warp.h"
        !          1674: #include "ndir.h"
        !          1675: #include "object.h"
        !          1676: #include "sig.h"
        !          1677: #include "term.h"
        !          1678: #include "INTERN.h"
        !          1679: #include "util.h"
        !          1680: 
        !          1681: void
        !          1682: util_init()
        !          1683: {
        !          1684:     ;
        !          1685: }
        !          1686: 
        !          1687: void
        !          1688: movc3(len,src,dest)
        !          1689: #ifdef vax
        !          1690: char *dest, *src;
        !          1691: int len;
        !          1692: {
        !          1693:     asm("movc3 4(ap),*8(ap),*12(ap)");
        !          1694: }
        !          1695: #else
        !          1696: Reg1 char *dest;
        !          1697: Reg2 char *src;
        !          1698: Reg3 int len;
        !          1699: {
        !          1700:     if (dest <= src) {
        !          1701:        for (; len; len--) {
        !          1702:            *dest++ = *src++;
        !          1703:        }
        !          1704:     }
        !          1705:     else {
        !          1706:        dest += len;
        !          1707:        src += len;
        !          1708:        for (; len; len--) {
        !          1709:            *--dest = *--src;
        !          1710:        }
        !          1711:     }
        !          1712: }
        !          1713: #endif
        !          1714: 
        !          1715: void
        !          1716: no_can_do(what)
        !          1717: char *what;
        !          1718: {
        !          1719:     fprintf(stderr,"Sorry, your terminal is too %s to play warp.\r\n",what);
        !          1720:     finalize(1);
        !          1721: }
        !          1722: 
        !          1723: int
        !          1724: exdis(maxnum)
        !          1725: int maxnum;
        !          1726: {
        !          1727:     double temp, temp2;
        !          1728:     double exp();
        !          1729:     double log();
        !          1730: 
        !          1731:     temp = (double) maxnum;
        !          1732: #ifndef lint
        !          1733:     temp2 = (double) myrand();
        !          1734: #else
        !          1735:     temp2 = 0.0;
        !          1736: #endif
        !          1737: #if RANDBITS == 15
        !          1738:     return (int) exp(temp2 * log(temp)/0x7fff);
        !          1739: #else
        !          1740: #if RANDBITS == 16
        !          1741:     return (int) exp(temp2 * log(temp)/0xffff);
        !          1742: #else
        !          1743:     return (int) exp(temp2 * log(temp)/0x7fffffff);
        !          1744: #endif
        !          1745: #endif
        !          1746: }
        !          1747: 
        !          1748: static char nomem[] = "warp: out of memory!\r\n";
        !          1749: 
        !          1750: /* paranoid version of malloc */
        !          1751: 
        !          1752: char *
        !          1753: safemalloc(size)
        !          1754: MEM_SIZE size;
        !          1755: {
        !          1756:     char *ptr;
        !          1757:     char *malloc();
        !          1758: 
        !          1759:     ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */
        !          1760:     if (ptr != Nullch)
        !          1761:        return ptr;
        !          1762:     else {
        !          1763:        fputs(nomem,stdout);
        !          1764:        sig_catcher(0);
        !          1765:     }
        !          1766:     /*NOTREACHED*/
        !          1767: }
        !          1768: 
        !          1769: /* safe version of string copy */
        !          1770: 
        !          1771: char *
        !          1772: safecpy(to,from,len)
        !          1773: char *to;
        !          1774: Reg2 char *from;
        !          1775: Reg1 int len;
        !          1776: {
        !          1777:     Reg3 char *dest = to;
        !          1778: 
        !          1779:     if (from != Nullch) 
        !          1780:        for (len--; len && (*dest++ = *from++); len--) ;
        !          1781:     *dest = '\0';
        !          1782:     return to;
        !          1783: }
        !          1784: 
        !          1785: /* copy a string up to some (non-backslashed) delimiter, if any */
        !          1786: 
        !          1787: char *
        !          1788: cpytill(to,from,delim)
        !          1789: Reg2 char *to;
        !          1790: Reg1 char *from;
        !          1791: Reg3 int delim;
        !          1792: {
        !          1793:     for (; *from; from++,to++) {
        !          1794:        if (*from == '\\' && from[1] == delim)
        !          1795:            from++;
        !          1796:        else if (*from == delim)
        !          1797:            break;
        !          1798:        *to = *from;
        !          1799:     }
        !          1800:     *to = '\0';
        !          1801:     return from;
        !          1802: }
        !          1803: 
        !          1804: /* return ptr to little string in big string, NULL if not found */
        !          1805: 
        !          1806: char *
        !          1807: instr(big, little)
        !          1808: char *big, *little;
        !          1809: 
        !          1810: {
        !          1811:     Reg3 char *t;
        !          1812:     Reg1 char *s;
        !          1813:     Reg2 char *x;
        !          1814: 
        !          1815:     for (t = big; *t; t++) {
        !          1816:        for (x=t,s=little; *s; x++,s++) {
        !          1817:            if (!*x)
        !          1818:                return Nullch;
        !          1819:            if (*s != *x)
        !          1820:                break;
        !          1821:        }
        !          1822:        if (!*s)
        !          1823:            return t;
        !          1824:     }
        !          1825:     return Nullch;
        !          1826: }
        !          1827: 
        !          1828: /* effective access */
        !          1829: 
        !          1830: #ifdef SETUIDGID
        !          1831: int
        !          1832: eaccess(filename, mod)
        !          1833: char *filename;
        !          1834: int mod;
        !          1835: {
        !          1836:     int protection, euid;
        !          1837:     
        !          1838:     mod &= 7;                          /* remove extraneous garbage */
        !          1839:     if (stat(filename, &filestat) < 0)
        !          1840:        return -1;
        !          1841:     euid = geteuid();
        !          1842:     if (euid == ROOTID)
        !          1843:        return 0;
        !          1844:     protection = 7 & (filestat.st_mode >>
        !          1845:       (filestat.st_uid == euid ? 6 :
        !          1846:         (filestat.st_gid == getegid() ? 3 : 0)
        !          1847:       ));
        !          1848:     if ((mod & protection) == mod)
        !          1849:        return 0;
        !          1850:     errno = EACCES;
        !          1851:     return -1;
        !          1852: }
        !          1853: #endif
        !          1854: 
        !          1855: /*
        !          1856:  * Get working directory
        !          1857:  */
        !          1858: 
        !          1859: #ifdef GETWD
        !          1860: #define        dot     "."
        !          1861: #define        dotdot  ".."
        !          1862: 
        !          1863: static char    *name;
        !          1864: 
        !          1865: static DIR     *dirp;
        !          1866: static int     off;
        !          1867: static struct  stat    d, dd;
        !          1868: static struct  direct  *dir;
        !          1869: 
        !          1870: char *
        !          1871: getwd(np)
        !          1872: char *np;
        !          1873: {
        !          1874:        long rdev, rino;
        !          1875: 
        !          1876:        *np++ = '/';
        !          1877:        *np = 0;
        !          1878:        name = np;
        !          1879:        off = -1;
        !          1880:        stat("/", &d);
        !          1881:        rdev = d.st_dev;
        !          1882:        rino = d.st_ino;
        !          1883:        for (;;) {
        !          1884:                stat(dot, &d);
        !          1885:                if (d.st_ino==rino && d.st_dev==rdev)
        !          1886:                        goto done;
        !          1887:                if ((dirp = opendir(dotdot)) == Null(DIR *))
        !          1888:                        prexit("getwd: cannot open ..\r\n");
        !          1889:                stat(dotdot, &dd);
        !          1890:                chdir(dotdot);
        !          1891:                if(d.st_dev == dd.st_dev) {
        !          1892:                        if(d.st_ino == dd.st_ino)
        !          1893:                                goto done;
        !          1894:                        do
        !          1895:                                if ((dir = readdir(dirp)) == Null(struct direct *))
        !          1896:                                        prexit("getwd: read error in ..\r\n");
        !          1897:                        while (dir->d_ino != d.st_ino);
        !          1898:                }
        !          1899:                else do {
        !          1900:                                if ((dir = readdir(dirp)) == Null(struct direct *))
        !          1901:                                        prexit("getwd: read error in ..\r\n");
        !          1902:                                stat(dir->d_name, &dd);
        !          1903:                        } while(dd.st_ino != d.st_ino || dd.st_dev != d.st_dev);
        !          1904:                cat();
        !          1905:                closedir(dirp);
        !          1906:        }
        !          1907: done:
        !          1908:        name--;
        !          1909:        if (chdir(name) < 0) {
        !          1910:                printf("getwd: can't cd back to %s\r\n",name);
        !          1911:                sig_catcher(0);
        !          1912:        }
        !          1913:        return (name);
        !          1914: }
        !          1915: 
        !          1916: void
        !          1917: cat()
        !          1918: {
        !          1919:        Reg1 int i;
        !          1920:        Reg2 int j;
        !          1921: 
        !          1922:        i = -1;
        !          1923:        while (dir->d_name[++i] != 0);
        !          1924:        if ((off+i+2) > 1024-1)
        !          1925:                return;
        !          1926:        for(j=off+1; j>=0; --j)
        !          1927:                name[j+i+1] = name[j];
        !          1928:        if (off >= 0)
        !          1929:                name[i] = '/';
        !          1930:        off=i+off+1;
        !          1931:        name[off] = 0;
        !          1932:        for(--i; i>=0; --i)
        !          1933:                name[i] = dir->d_name[i];
        !          1934: }
        !          1935: 
        !          1936: void
        !          1937: prexit(cp)
        !          1938: char *cp;
        !          1939: {
        !          1940:        write(2, cp, strlen(cp));
        !          1941:        sig_catcher(0);
        !          1942: }
        !          1943: #else
        !          1944: char *
        !          1945: getwd(np)                      /* shorter but slower */
        !          1946: char *np;
        !          1947: {
        !          1948:     FILE *popen();
        !          1949:     FILE *pipefp = popen("/bin/pwd","r");
        !          1950: 
        !          1951:     if (pipefp == Nullfp) {
        !          1952:        printf("Can't run /bin/pwd\r\n");
        !          1953:        finalize(1);
        !          1954:     }
        !          1955:     Fgets(np,512,pipefp);
        !          1956:     np[strlen(np)-1] = '\0';   /* wipe out newline */
        !          1957:     pclose(pipefp);
        !          1958:     return np;
        !          1959: }
        !          1960: #endif
        !          1961: 
        !          1962: /* copy a string to a safe spot */
        !          1963: 
        !          1964: char *
        !          1965: savestr(str)
        !          1966: char *str;
        !          1967: {
        !          1968:     Reg1 char *newaddr = safemalloc((MEM_SIZE)(strlen(str)+1));
        !          1969: 
        !          1970:     strcpy(newaddr,str);
        !          1971:     return newaddr;
        !          1972: }
        !          1973: 
        !          1974: char *
        !          1975: getval(nam,def)
        !          1976: char *nam,*def;
        !          1977: {
        !          1978:     char *val;
        !          1979: 
        !          1980:     if ((val = getenv(nam)) == Nullch || !*val)
        !          1981:        val = def;
        !          1982:     return val;
        !          1983: }
        !          1984: efp == Nullfp) {
        !          1985:        printf("Can't run /bin/pwd\r\n");
        !          1986:        finalize(1);
        !          1987:     }
        !          1988:     Fgets(np,512,pipefp);
        !          1989:     np[strlen(np)-1] = '\0';   /* wipe out newline */
        !          1990:     pclose(pipefp);
        !          1991:     return np;
        !          1992: }
        !          1993: #endif
        !          1994: 
        !          1995: /* copy a string to a safe spot */
        !          1996: 
        !          1997: char *
        !          1998: savestr(str)
        !          1999: char *str;
        !          2000: {
        !          2001:     Reg1 char *newaddr = safemalloc((MEM_SIZwarp/intrp.h   644    171      5        1275  5121747714   6356 /* $Header: intrp.h,v 7.0.1.1 86/12/12 16:59:45 lwall Exp $
        !          2002:  *
        !          2003:  * $Log:       intrp.h,v $
        !          2004:  * Revision 7.0.1.1  86/12/12  16:59:45  lwall
        !          2005:  * Baseline for net release.
        !          2006:  * 
        !          2007:  * Revision 7.0  86/10/08  15:12:27  lwall
        !          2008:  * Split into separate files.  Added amoebas and pirates.
        !          2009:  * 
        !          2010:  */
        !          2011: 
        !          2012: EXT char *origdir INIT(Nullch);                /* cwd when warp invoked */
        !          2013: EXT char *homedir INIT(Nullch);                /* login directory */
        !          2014: EXT char *dotdir INIT(Nullch);         /* where . files go */
        !          2015: EXT char *logname INIT(Nullch);                /* login id */
        !          2016: EXT char *hostname INIT(Nullch);       /* host name */
        !          2017: EXT char *realname INIT(Nullch);       /* real name from /etc/passwd */
        !          2018: 
        !          2019: void    intrp_init();
        !          2020: char   *filexp();
        !          2021: char   *dointerp();
        !          2022: void   interp();
        !          2023: char   *getrealname();
        !          2024:   15:12:27  lwall
        !          2025:  * Split into separate files.  Added amoebas and pirates.
        !          2026:  * 
        !          2027:  */
        !          2028: 
        !          2029: EXT char *origdir INIT(Nullch);                /* cwd when warp invoked */
        !          2030: EXT char *homedir INIT(Nullch);                /* login directory */
        !          2031: EXT char *dotdir INIT(Nullch);         /* where . files go */
        !          2032: EXT char *logname INIT(Nullch);                /* login id */
        !          2033: EXT char *hostname warp/Configure   755    171      5      130734  5121750001   6742 #! /bin/sh
        !          2034: #
        !          2035: # If these # comments don't work, trim them.  Don't worry about any other
        !          2036: # shell scripts, Configure will trim # comments from them for you.
        !          2037: #
        !          2038: # (If you are trying to port this package to a machine without sh, I would
        !          2039: # suggest you cut out the prototypical config.h from the end of Configure
        !          2040: # and edit it to reflect your system.  Some packages may include samples
        !          2041: # of config.h for certain machines, so you might look for one of those.)
        !          2042: #
        !          2043: # $Header: Configure,v 7.0.1.2 86/12/12 16:44:05 lwall Exp $
        !          2044: #
        !          2045: # Yes, you may rip this off to use in other distribution packages.
        !          2046: # (Note: this Configure script was generated automatically.  Rather than
        !          2047: # working with this copy of Configure, you may wish to get metaconfig.)
        !          2048: 
        !          2049: : sanity checks
        !          2050: PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
        !          2051: export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
        !          2052: 
        !          2053: if test ! -t 0; then
        !          2054:     echo "Say 'sh Configure', not 'sh <Configure'"
        !          2055:     exit 1
        !          2056: fi
        !          2057: 
        !          2058: (alias) >/dev/null 2>&1 && \
        !          2059:     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
        !          2060:     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
        !          2061: 
        !          2062: if test ! -d ../UU; then
        !          2063:     if test ! -d UU; then
        !          2064:        mkdir UU
        !          2065:     fi
        !          2066:     cd UU
        !          2067: fi
        !          2068: 
        !          2069: d_eunice=''
        !          2070: eunicefix=''
        !          2071: define=''
        !          2072: loclist=''
        !          2073: expr=''
        !          2074: sed=''
        !          2075: echo=''
        !          2076: cat=''
        !          2077: rm=''
        !          2078: mv=''
        !          2079: cp=''
        !          2080: tail=''
        !          2081: tr=''
        !          2082: mkdir=''
        !          2083: sort=''
        !          2084: uniq=''
        !          2085: grep=''
        !          2086: trylist=''
        !          2087: test=''
        !          2088: inews=''
        !          2089: egrep=''
        !          2090: more=''
        !          2091: pg=''
        !          2092: Mcc=''
        !          2093: vi=''
        !          2094: mailx=''
        !          2095: Log=''
        !          2096: Header=''
        !          2097: cc=''
        !          2098: contains=''
        !          2099: cpp=''
        !          2100: d_charsprf=''
        !          2101: d_fcntl=''
        !          2102: d_ftime=''
        !          2103: d_gethname=''
        !          2104: d_douname=''
        !          2105: d_phostname=''
        !          2106: d_getpwent=''
        !          2107: d_havetlib=''
        !          2108: termlib=''
        !          2109: d_index=''
        !          2110: d_ioctl=''
        !          2111: d_normsig=''
        !          2112: jobslib=''
        !          2113: d_portable=''
        !          2114: d_rdchk=''
        !          2115: d_scorfl=''
        !          2116: d_sgndchr=''
        !          2117: d_termio=''
        !          2118: d_usendir=''
        !          2119: d_libndir=''
        !          2120: ndirc=''
        !          2121: ndiro=''
        !          2122: d_whoami=''
        !          2123: hostname=''
        !          2124: phostname=''
        !          2125: mydomain=''
        !          2126: libc=''
        !          2127: libnm=''
        !          2128: mansrc=''
        !          2129: manext=''
        !          2130: models=''
        !          2131: split=''
        !          2132: small=''
        !          2133: medium=''
        !          2134: large=''
        !          2135: huge=''
        !          2136: ccflags=''
        !          2137: ldflags=''
        !          2138: n=''
        !          2139: c=''
        !          2140: nametype=''
        !          2141: d_passnames=''
        !          2142: d_berknames=''
        !          2143: d_usgnames=''
        !          2144: passcat=''
        !          2145: package=''
        !          2146: prefshell=''
        !          2147: randbits=''
        !          2148: registers=''
        !          2149: reg1=''
        !          2150: reg2=''
        !          2151: reg3=''
        !          2152: reg4=''
        !          2153: reg5=''
        !          2154: reg6=''
        !          2155: reg7=''
        !          2156: reg8=''
        !          2157: reg9=''
        !          2158: reg10=''
        !          2159: reg11=''
        !          2160: reg12=''
        !          2161: reg13=''
        !          2162: reg14=''
        !          2163: reg15=''
        !          2164: reg16=''
        !          2165: rootid=''
        !          2166: spitshell=''
        !          2167: shsharp=''
        !          2168: sharpbang=''
        !          2169: startsh=''
        !          2170: voidflags=''
        !          2171: bin=''
        !          2172: chowner=''
        !          2173: privlib=''
        !          2174: CONFIG=''
        !          2175: 
        !          2176: : set package name
        !          2177: package=warp
        !          2178: 
        !          2179: echo " "
        !          2180: echo "Beginning of configuration questions for $package kit."
        !          2181: : Eunice requires " " instead of "", can you believe it
        !          2182: echo " "
        !          2183: 
        !          2184: define='define'
        !          2185: undef='/*undef'
        !          2186: libpth='/usr/lib /usr/local/lib /lib'
        !          2187: smallmach='pdp11 i8086 z8000 i80286 iAPX286'
        !          2188: rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
        !          2189: trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
        !          2190: attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
        !          2191: attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
        !          2192: attrlist="$attrlist ns32000 ns16000 iAPX286"
        !          2193: pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib"
        !          2194: defvoidused=7
        !          2195: 
        !          2196: : some greps do not return status, grrr.
        !          2197: echo "grimblepritz" >grimble
        !          2198: if grep blurfldyick grimble >/dev/null 2>&1 ; then
        !          2199:     contains=contains
        !          2200: elif grep grimblepritz grimble >/dev/null 2>&1 ; then
        !          2201:     contains=grep
        !          2202: else
        !          2203:     contains=contains
        !          2204: fi
        !          2205: rm -f grimble
        !          2206: : the following should work in any shell
        !          2207: case "$contains" in
        !          2208: contains*)
        !          2209:     echo " "
        !          2210:     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
        !          2211:     cat >contains <<'EOSS'
        !          2212: grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
        !          2213: EOSS
        !          2214: chmod 755 contains
        !          2215: esac
        !          2216: 
        !          2217: : first determine how to suppress newline on echo command
        !          2218: echo "Checking echo to see how to suppress newlines..."
        !          2219: (echo "hi there\c" ; echo " ") >.echotmp
        !          2220: if $contains c .echotmp >/dev/null 2>&1 ; then
        !          2221:     echo "...using -n."
        !          2222:     n='-n'
        !          2223:     c=''
        !          2224: else
        !          2225:     cat <<'EOM'
        !          2226: ...using \c
        !          2227: EOM
        !          2228:     n=''
        !          2229:     c='\c'
        !          2230: fi
        !          2231: echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
        !          2232: read ans
        !          2233: rm -f .echotmp
        !          2234: 
        !          2235: : now set up to do reads with possible shell escape and default assignment
        !          2236: cat <<EOSC >myread
        !          2237: ans='!'
        !          2238: while expr "X\$ans" : "X!" >/dev/null; do
        !          2239:     read ans
        !          2240:     case "\$ans" in
        !          2241:     !)
        !          2242:        sh
        !          2243:        echo " "
        !          2244:        echo $n "\$rp $c"
        !          2245:        ;;
        !          2246:     !*)
        !          2247:        set \`expr "X\$ans" : "X!\(.*\)\$"\`
        !          2248:        sh -c "\$*"
        !          2249:        echo " "
        !          2250:        echo $n "\$rp $c"
        !          2251:        ;;
        !          2252:     esac
        !          2253: done
        !          2254: rp='Your answer:'
        !          2255: case "\$ans" in
        !          2256: '') ans="\$dflt";;
        !          2257: esac
        !          2258: EOSC
        !          2259: 
        !          2260: : general instructions
        !          2261: cat <<EOH
        !          2262:  
        !          2263: This installation shell script will examine your system and ask you questions
        !          2264: to determine how $package and any auxiliary files should be installed.  If you
        !          2265: get stuck on a question, you may use a ! shell escape to start a subshell or
        !          2266: execute a command.  Many of the questions will have default answers in
        !          2267: square brackets--typing carriage return will give you the default.
        !          2268: 
        !          2269: On some of the questions which ask for file or directory names you are
        !          2270: allowed to use the ~name construct to specify the login directory belonging
        !          2271: to "name", even if you don't have a shell which knows about that.  Questions
        !          2272: where this is allowed will be marked "(~name ok)".
        !          2273: 
        !          2274: EOH
        !          2275: rp="[Type carriage return to continue]"
        !          2276: echo $n "$rp $c"
        !          2277: . myread
        !          2278: cat <<EOH
        !          2279: 
        !          2280: Much effort has been expended to ensure that this shell script will run
        !          2281: on any Unix system.  If despite that it blows up on you, your best bet is
        !          2282: to edit Configure and run it again.  (Trying to install this package
        !          2283: without having run Configure may be well nigh impossible.)  Also, let me
        !          2284: ([email protected]) know how I blew it.
        !          2285: 
        !          2286: This installation script affects things in two ways: 1) it may do direct
        !          2287: variable substitutions on some of the files included in this kit, and
        !          2288: 2) it builds a config.h file for inclusion in C programs.  You may edit
        !          2289: any of these files as the need arises after running this script.
        !          2290: 
        !          2291: If you make a mistake on a question, there is no easy way to back up to it
        !          2292: currently.  The easiest thing to do is to edit config.sh and rerun all the
        !          2293: SH files.  Configure will offer to let you do this before it runs the SH files.
        !          2294: 
        !          2295: EOH
        !          2296: rp="[Type carriage return to continue]"
        !          2297: echo $n "$rp $c"
        !          2298: . myread
        !          2299: 
        !          2300: : get old answers, if there is a config file out there
        !          2301: if test -f ../config.sh; then
        !          2302:     echo " "
        !          2303:     dflt=y
        !          2304:     rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
        !          2305:     echo $n "$rp $c"
        !          2306:     . myread
        !          2307:     case "$ans" in
        !          2308:     n*) echo "OK, I'll ignore it.";;
        !          2309:     *)  echo "Fetching default answers from your old config.sh file..."
        !          2310:        tmp="$n"
        !          2311:        ans="$c"
        !          2312:         . ../config.sh
        !          2313:        n="$tmp"
        !          2314:        c="$ans"
        !          2315:        ;;
        !          2316:     esac
        !          2317: fi
        !          2318: 
        !          2319: : find out where common programs are
        !          2320: echo " "
        !          2321: echo "Locating common programs..."
        !          2322: cat <<EOSC >loc
        !          2323: $startsh
        !          2324: case \$# in
        !          2325: 0) exit 1;;
        !          2326: esac
        !          2327: thing=\$1
        !          2328: shift
        !          2329: dflt=\$1
        !          2330: shift
        !          2331: for dir in \$*; do
        !          2332:     case "\$thing" in
        !          2333:     .)
        !          2334:        if test -d \$dir/\$thing; then
        !          2335:            echo \$dir
        !          2336:            exit 0
        !          2337:        fi
        !          2338:        ;;
        !          2339:     *)
        !          2340:        if test -f \$dir/\$thing; then
        !          2341:            echo \$dir/\$thing
        !          2342:            exit 0
        !          2343:        fi
        !          2344:        ;;
        !          2345:     esac
        !          2346: done
        !          2347: echo \$dflt
        !          2348: exit 1
        !          2349: EOSC
        !          2350: chmod 755 loc
        !          2351: $eunicefix loc
        !          2352: loclist="
        !          2353: expr
        !          2354: sed
        !          2355: echo
        !          2356: cat
        !          2357: rm
        !          2358: mv
        !          2359: cp
        !          2360: tr
        !          2361: mkdir
        !          2362: sort
        !          2363: uniq
        !          2364: grep
        !          2365: "
        !          2366: trylist="
        !          2367: test
        !          2368: egrep
        !          2369: Mcc
        !          2370: "
        !          2371: for file in $loclist; do
        !          2372:     xxx=`loc $file $file $pth`
        !          2373:     eval $file=$xxx
        !          2374:     eval _$file=$xxx
        !          2375:     case "$xxx" in
        !          2376:     /*)
        !          2377:        echo $file is in $xxx.
        !          2378:        ;;
        !          2379:     *)
        !          2380:        echo "I don't know where $file is.  I hope it's in everyone's PATH."
        !          2381:        ;;
        !          2382:     esac
        !          2383: done
        !          2384: echo " "
        !          2385: echo "Don't worry if any of the following aren't found..."
        !          2386: ans=offhand
        !          2387: for file in $trylist; do
        !          2388:     xxx=`loc $file $file $pth`
        !          2389:     eval $file=$xxx
        !          2390:     eval _$file=$xxx
        !          2391:     case "$xxx" in
        !          2392:     /*)
        !          2393:        echo $file is in $xxx.
        !          2394:        ;;
        !          2395:     *)
        !          2396:        echo "I don't see $file out there, $ans."
        !          2397:        ans=either
        !          2398:        ;;
        !          2399:     esac
        !          2400: done
        !          2401: case "$egrep" in
        !          2402: egrep)
        !          2403:     echo "Substituting grep for egrep."
        !          2404:     egrep=$grep
        !          2405:     ;;
        !          2406: esac
        !          2407: case "$test" in
        !          2408: test)
        !          2409:     echo "Hopefully test is built into your sh."
        !          2410:     ;;
        !          2411: /bin/test)
        !          2412:     echo " "
        !          2413:     dflt=n
        !          2414:     rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)"
        !          2415:     echo $n "$rp $c"
        !          2416:     . myread
        !          2417:     case "$ans" in
        !          2418:     y*) test=test ;;
        !          2419:     esac
        !          2420:     ;;
        !          2421: *)
        !          2422:     test=test
        !          2423:     ;;
        !          2424: esac
        !          2425: case "$echo" in
        !          2426: echo)
        !          2427:     echo "Hopefully echo is built into your sh."
        !          2428:     ;;
        !          2429: /bin/echo)
        !          2430:     echo " "
        !          2431:     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
        !          2432:     $echo $n "hi there$c" >foo1
        !          2433:     echo $n "hi there$c" >foo2
        !          2434:     if cmp foo1 foo2 >/dev/null 2>&1; then
        !          2435:        echo "They are compatible.  In fact, they may be identical."
        !          2436:     else
        !          2437:        case "$n" in
        !          2438:        '-n') n='' c='\c' ans='\c' ;;
        !          2439:        *) n='-n' c='' ans='-n' ;;
        !          2440:        esac
        !          2441:        cat <<FOO
        !          2442: They are not compatible!  You are probably running ksh on a non-USG system.
        !          2443: I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
        !          2444: have echo built in and we may have to run some Bourne shell scripts.  That
        !          2445: means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
        !          2446: 
        !          2447: FOO
        !          2448:        rp="Your cursor should be here-->"
        !          2449:        $echo $n "$rp$c"
        !          2450:        . myread
        !          2451:     fi
        !          2452:     $rm -f foo1 foo2
        !          2453:     ;;
        !          2454: *)
        !          2455:     : cross your fingers
        !          2456:     echo=echo
        !          2457:     ;;
        !          2458: esac
        !          2459: rmlist="$rmlist loc"
        !          2460: 
        !          2461: : get list of predefined functions in a handy place
        !          2462: echo " "
        !          2463: if test -f /lib/libc.a; then
        !          2464:     echo "Your C library is in /lib/libc.a.  You're normal."
        !          2465:     libc=/lib/libc.a
        !          2466: else
        !          2467:     ans=`loc libc.a blurfl/dyick $libpth`
        !          2468:     if test -f $ans; then
        !          2469:        echo "Your C library is in $ans, of all places."
        !          2470:        libc=ans
        !          2471:     else
        !          2472:        if test -f "$libc"; then
        !          2473:            echo "Your C library is in $libc, like you said before."
        !          2474:        else
        !          2475:            cat <<EOM
        !          2476:  
        !          2477: I can't seem to find your C library.  I've looked in the following places:
        !          2478: 
        !          2479:        $libpth
        !          2480: 
        !          2481: None of these seems to contain your C library.  What is the full name
        !          2482: EOM
        !          2483:            dflt=None
        !          2484:            $echo $n "of your C library? $c"
        !          2485:            rp='C library full name?'
        !          2486:            . myread
        !          2487:            libc="$ans"
        !          2488:        fi
        !          2489:     fi
        !          2490: fi
        !          2491: echo " "
        !          2492: $echo $n "Extracting names from $libc for later perusal...$c"
        !          2493: if ar t $libc > libc.list; then
        !          2494:     echo "done"
        !          2495: else
        !          2496:     echo " "
        !          2497:     echo "The archiver doesn't think $libc is a reasonable library."
        !          2498:     echo "Trying nm instead..."
        !          2499:     if nm -g $libc > libc.list; then
        !          2500:        echo "done"
        !          2501:     else
        !          2502:        echo "That didn't work either.  Giving up."
        !          2503:        exit 1
        !          2504:     fi
        !          2505: fi
        !          2506: rmlist="$rmlist libc.list"
        !          2507: 
        !          2508: : make some quick guesses about what we are up against
        !          2509: echo " "
        !          2510: $echo $n "Hmm...  $c"
        !          2511: if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
        !          2512:     echo "Looks kind of like a BSD system, but we'll see..."
        !          2513:     echo exit 0 >bsd
        !          2514:     echo exit 1 >usg
        !          2515:     echo exit 1 >v7
        !          2516: elif $contains fcntl libc.list >/dev/null 2>&1 ; then
        !          2517:     echo "Looks kind of like a USG system, but we'll see..."
        !          2518:     echo exit 1 >bsd
        !          2519:     echo exit 0 >usg
        !          2520:     echo exit 1 >v7
        !          2521: else
        !          2522:     echo "Looks kind of like a version 7 system, but we'll see..."
        !          2523:     echo exit 1 >bsd
        !          2524:     echo exit 1 >usg
        !          2525:     echo exit 0 >v7
        !          2526: fi
        !          2527: if $contains vmssystem libc.list >/dev/null 2>&1 ; then
        !          2528:     cat <<'EOI'
        !          2529: There is, however, a strange, musty smell in the air that reminds me of
        !          2530: something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
        !          2531: EOI
        !          2532:     echo "exit 0" >eunice
        !          2533:     eunicefix=unixtovms
        !          2534:     d_eunice="$define"
        !          2535: : it so happens the Eunice I know will not run shell scripts in Unix format
        !          2536: else
        !          2537:     echo " "
        !          2538:     echo "Congratulations.  You aren't running Eunice."
        !          2539:     eunicefix=':'
        !          2540:     d_eunice="$undef"
        !          2541:     echo "exit 1" >eunice
        !          2542: fi
        !          2543: if test -f /xenix; then
        !          2544:     echo "Actually, this looks more like a XENIX system..."
        !          2545:     echo "exit 0" >xenix
        !          2546: else
        !          2547:     echo " "
        !          2548:     echo "It's not Xenix..."
        !          2549:     echo "exit 1" >xenix
        !          2550: fi
        !          2551: chmod 755 xenix
        !          2552: if test -f /venix; then
        !          2553:     echo "Actually, this looks more like a VENIX system..."
        !          2554:     echo "exit 0" >venix
        !          2555: else
        !          2556:     echo " "
        !          2557:     if xenix; then
        !          2558:        : null
        !          2559:     else
        !          2560:        echo "Nor is it Venix..."
        !          2561:     fi
        !          2562:     echo "exit 1" >venix
        !          2563: fi
        !          2564: chmod 755 bsd usg v7 eunice venix xenix
        !          2565: $eunicefix bsd usg v7 eunice venix xenix
        !          2566: rmlist="$rmlist bsd usg v7 eunice venix xenix"
        !          2567: 
        !          2568: : see if sh knows # comments
        !          2569: echo " "
        !          2570: echo "Checking your sh to see if it knows about # comments..."
        !          2571: if sh -c '#' >/dev/null 2>&1 ; then
        !          2572:     echo "Your sh handles # comments correctly."
        !          2573:     shsharp=true
        !          2574:     spitshell=cat
        !          2575:     echo " "
        !          2576:     echo "Okay, let's see if #! works on this system..."
        !          2577:     echo "#!/bin/echo hi" > try
        !          2578:     $eunicefix try
        !          2579:     chmod 755 try
        !          2580:     try > today
        !          2581:     if test -s today; then
        !          2582:        echo "It does."
        !          2583:        sharpbang='#!'
        !          2584:     else
        !          2585:        echo "#! /bin/echo hi" > try
        !          2586:        $eunicefix try
        !          2587:        chmod 755 try
        !          2588:        try > today
        !          2589:        if test -s today; then
        !          2590:            echo "It does."
        !          2591:            sharpbang='#! '
        !          2592:        else
        !          2593:            echo "It doesn't."
        !          2594:            sharpbang=': use '
        !          2595:        fi
        !          2596:     fi
        !          2597: else
        !          2598:     echo "Your sh doesn't grok # comments--I will strip them later on."
        !          2599:     shsharp=false
        !          2600:     echo "exec grep -v '^#'" >spitshell
        !          2601:     chmod 755 spitshell
        !          2602:     $eunicefix spitshell
        !          2603:     spitshell=`pwd`/spitshell
        !          2604:     echo "I presume that if # doesn't work, #! won't work either!"
        !          2605:     sharpbang=': use '
        !          2606: fi
        !          2607: 
        !          2608: : figure out how to guarantee sh startup
        !          2609: echo " "
        !          2610: echo "Checking out how to guarantee sh startup..."
        !          2611: startsh=$sharpbang'/bin/sh'
        !          2612: echo "Let's see if '$startsh' works..."
        !          2613: cat >try <<EOSS
        !          2614: $startsh
        !          2615: set abc
        !          2616: test "$?abc" != 1
        !          2617: EOSS
        !          2618: 
        !          2619: chmod 755 try
        !          2620: $eunicefix try
        !          2621: if try; then
        !          2622:     echo "Yup, it does."
        !          2623: else
        !          2624:     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
        !          2625: fi
        !          2626: rm -f try today
        !          2627: 
        !          2628: : find out how to find out full name
        !          2629: echo " "
        !          2630: case "$d_berknames" in
        !          2631: "$define")
        !          2632:     dflt=y;;
        !          2633: "$undef")
        !          2634:     dflt=n;;
        !          2635: *)
        !          2636:     if bsd; then
        !          2637:        dflt=y
        !          2638:     else
        !          2639:        dflt=n
        !          2640:     fi
        !          2641:     ;;
        !          2642: esac
        !          2643: echo "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
        !          2644: $echo $n "thing after ':' in GCOS field)? [$dflt] $c"
        !          2645: rp="Berkeley/V7 format full name? [$dflt]"
        !          2646: . myread
        !          2647: case "$ans" in
        !          2648:   y*)
        !          2649:     d_passnames="$define"
        !          2650:     d_berknames="$define"
        !          2651:     d_usgnames="$undef"
        !          2652:     nametype=bsd
        !          2653:     ;;
        !          2654:   *)
        !          2655:     echo " "
        !          2656:     case "$d_usgnames" in
        !          2657:     "$define")
        !          2658:        dflt=y;;
        !          2659:     "$undef")
        !          2660:        dflt=n;;
        !          2661:     *)
        !          2662:        if usg; then
        !          2663:            dflt=y
        !          2664:        else
        !          2665:            dflt=n
        !          2666:        fi
        !          2667:        ;;
        !          2668:     esac
        !          2669:     echo "Does your passwd file keep full names in USG format (name sandwiched"
        !          2670:     $echo $n "between a '-' and a '(')? [$dflt] $c"
        !          2671:     rp="USG format full name? [$dflt]"
        !          2672:     . myread
        !          2673:     case "$ans" in
        !          2674:       n*)
        !          2675:        echo "Full name will be taken from ~/.fullname"
        !          2676:        d_passnames="$undef"
        !          2677:        d_berknames="$undef"
        !          2678:        d_usgnames="$undef"
        !          2679:        nametype=other
        !          2680:        ;;
        !          2681:       *)
        !          2682:        d_passnames="$define"
        !          2683:        d_berknames="$undef"
        !          2684:        d_usgnames="$define"
        !          2685:        nametype=usg
        !          2686:        ;;
        !          2687:     esac
        !          2688:     ;;
        !          2689: esac
        !          2690: 
        !          2691: : see if we have to deal with yellow pages
        !          2692: if $test -d /usr/etc/yp; then
        !          2693:     if $contains '^\+:' /etc/passwd; then
        !          2694:        dflt=y
        !          2695:     else
        !          2696:        dflt=n
        !          2697:     fi
        !          2698:     rp="Are you getting the passwd file via yellow pages? [$dflt]"
        !          2699:     $echo $n "$rp $c"
        !          2700:     . myread
        !          2701:     case "$ans" in
        !          2702:     y*) passcat='ypcat passwd';;
        !          2703:     *) passcat='cat /etc/passwd';;
        !          2704:     esac
        !          2705: else
        !          2706:     passcat='cat /etc/passwd'
        !          2707: fi
        !          2708: 
        !          2709: : see if sprintf is declared as int or pointer to char
        !          2710: echo " "
        !          2711: if $contains 'char.*sprintf' /usr/include/stdio.h >/dev/null 2>&1 ; then
        !          2712:     echo "Your sprintf() returns (char*)."
        !          2713:     d_charsprf="$define"
        !          2714: else
        !          2715:     echo "Your sprintf() returns (int)."
        !          2716:     d_charsprf="$undef"
        !          2717: fi
        !          2718: 
        !          2719: : now get the host name
        !          2720: echo " "
        !          2721: echo "Figuring out host name..."
        !          2722: echo 'Maybe "hostname" will work...'
        !          2723: if ans=`sh -c hostname 2>&1` ; then
        !          2724:     hostname=$ans
        !          2725:     phostname=hostname
        !          2726: else
        !          2727:     echo 'Oh, dear.  Maybe "/etc/systemid" will work...'
        !          2728:     if ans=`sh -c '/etc/systemid' 2>&1` ; then
        !          2729:        hostname=$ans
        !          2730:        phostname='/etc/systemid'
        !          2731:        if xenix; then
        !          2732:            echo "Whadyaknow.  Xenix always was a bit strange..."
        !          2733:        else
        !          2734:            echo "What is a non-Xenix system doing with /etc/systemid?"
        !          2735:        fi
        !          2736:     else
        !          2737:        echo 'No, maybe "uuname -l" will work...'
        !          2738:        if ans=`sh -c 'uuname -l' 2>&1` ; then
        !          2739:            hostname=$ans
        !          2740:            phostname='uuname -l'
        !          2741:        else
        !          2742:            echo 'Strange.  Maybe "uname -n" will work...'
        !          2743:            if ans=`sh -c 'uname -n' 2>&1` ; then
        !          2744:                hostname=$ans
        !          2745:                phostname='uname -n'
        !          2746:            else
        !          2747:                echo 'Oh well, maybe I can mine it out of whoami.h...'
        !          2748:                if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
        !          2749:                    hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
        !          2750:                    phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
        !          2751:                else
        !          2752:                    case "$hostname" in
        !          2753:                    '') echo "Does this machine have an identity crisis or something?"
        !          2754:                        phostname=''
        !          2755:                        ;;
        !          2756:                    *)  echo "Well, you said $hostname before...";;
        !          2757:                    esac
        !          2758:                fi
        !          2759:            fi
        !          2760:        fi
        !          2761:     fi
        !          2762: fi
        !          2763: : you do not want to know about this
        !          2764: set $hostname
        !          2765: hostname=$1
        !          2766: 
        !          2767: : translate upper to lower if necessary
        !          2768: case "$hostname" in
        !          2769:     *[A-Z]*)
        !          2770:        hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
        !          2771:        echo "(Normalizing case in your host name)"
        !          2772:        ;;
        !          2773: esac
        !          2774: 
        !          2775: : verify guess
        !          2776: if $test "$hostname" ; then
        !          2777:     dflt=y
        !          2778:     echo 'Your host name appears to be "'$hostname'".'
        !          2779:     $echo $n "Is this correct? [$dflt] $c"
        !          2780:     rp="Sitename is $hostname? [$dflt]"
        !          2781:     . myread
        !          2782:     case "$ans" in
        !          2783:       y*)  ;;
        !          2784:       *)      hostname='' ;;
        !          2785:     esac
        !          2786: fi
        !          2787: 
        !          2788: : bad guess or no guess
        !          2789: while $test "X$hostname" = X ; do
        !          2790:     dflt=''
        !          2791:     rp="Please type the (one word) name of your host:"
        !          2792:     $echo $n "$rp $c"
        !          2793:     . myread
        !          2794:     hostname="$ans"
        !          2795: done
        !          2796: 
        !          2797: echo " "
        !          2798: case "$hostname" in
        !          2799: *.*)
        !          2800:     dflt=`expr "X$hostname" : "X[^.]*\(\..*\)"`
        !          2801:     hostname=`expr "X$hostname" : "X\([^.]*\)\."`
        !          2802:     echo "(Trimming domain name from host name--host name is now $hostname)"
        !          2803:     ;;
        !          2804: *)
        !          2805:     dflt='.uucp'
        !          2806:     ;;
        !          2807: esac
        !          2808: rp="What is your domain name? [$dflt]"
        !          2809: $echo $n "$rp $c"
        !          2810: . myread
        !          2811: case "$ans" in
        !          2812: '') ;;
        !          2813: .*) ;;
        !          2814: *) ans=".$ans";;
        !          2815: esac
        !          2816: mydomain="$ans"
        !          2817: 
        !          2818: : a little sanity check here
        !          2819: case "$phostname" in
        !          2820: '') ;;
        !          2821: *)  case `$phostname` in
        !          2822:     $hostname$mydomain|$hostname) ;;
        !          2823:     *)
        !          2824:        case "$phostname" in
        !          2825:        sed*)
        !          2826:            echo "(That doesn't agree with your whoami.h file, by the way.)"
        !          2827:            ;;
        !          2828:        *)
        !          2829:            echo "(That doesn't agree with your $phostname command, by the way.)"
        !          2830:            ;;
        !          2831:        esac
        !          2832:        phostname=''
        !          2833:        ;;
        !          2834:     esac
        !          2835:     ;;
        !          2836: esac
        !          2837: 
        !          2838: : decide how portable to be
        !          2839: case "$d_portable" in
        !          2840: "$define") dflt=y;;
        !          2841: *)     dflt=n;;
        !          2842: esac
        !          2843: $cat <<'EOH'
        !          2844:  
        !          2845: I can set things up so that your shell scripts and binaries are more portable,
        !          2846: at what may be a noticable cost in performance.  In particular, if you
        !          2847: ask to be portable, the following happens:
        !          2848: 
        !          2849:      1) shell scripts will rely on the PATH variable rather than using
        !          2850:        the paths derived above.
        !          2851:      2) ~username interpretations will be done at run time rather than
        !          2852:        by Configure.
        !          2853:      3) the system name will be determined at run time, if at all possible.
        !          2854: 
        !          2855: EOH
        !          2856: rp="Do you expect to run these scripts and binaries on multiple machines? [$dflt]"
        !          2857: $echo $n "$rp $c"
        !          2858: . myread
        !          2859: case "$ans" in
        !          2860:     y*) d_portable="$define"
        !          2861:        for file in $loclist; do
        !          2862:            eval $file=$file
        !          2863:        done
        !          2864:        ;;
        !          2865:     *)  d_portable="$undef" ;;
        !          2866: esac
        !          2867: 
        !          2868: : see if there is a whoami file
        !          2869: echo " "
        !          2870: if $test -r /usr/include/whoami.h ; then
        !          2871:     d_whoami="$define"
        !          2872:     echo "whoami.h found."
        !          2873: else
        !          2874:     d_whoami="$undef"
        !          2875: fi
        !          2876: 
        !          2877: : see how we will look up host name
        !          2878: echo " "
        !          2879: d_douname="$undef"
        !          2880: d_gethname="$undef"
        !          2881: d_phostname="$undef"
        !          2882: 
        !          2883: if xenix; then
        !          2884:     echo " "
        !          2885:     echo "(Assuming Xenix uname() is broken.)"
        !          2886: elif $contains gethostname libc.list >/dev/null 2>&1 ; then
        !          2887:     echo "gethostname() found."
        !          2888:     d_gethname="$define"
        !          2889:     ans=gethostname
        !          2890: elif $contains uname libc.list >/dev/null 2>&1 ; then
        !          2891:     echo "uname() found."
        !          2892:     d_douname="$define"
        !          2893:     ans=uname
        !          2894: fi
        !          2895: 
        !          2896: case "$d_douname$d_gethname" in
        !          2897: *define*)
        !          2898:     dflt=n
        !          2899:     cat <<EOM
        !          2900:  
        !          2901: Every now and then someone has a $ans() that lies about the hostname
        !          2902: but can't be fixed for political or economic reasons.  Would you like to
        !          2903: EOM
        !          2904:     rp="pretend $ans() isn't there and maybe compile in the hostname? [$dflt]"
        !          2905:     $echo $n "$rp $c"
        !          2906:     . myread
        !          2907:     case "$ans" in
        !          2908:     y*) d_douname="$undef" d_gethname="$undef"
        !          2909:        $echo $n "Okay... $c"
        !          2910:        ;;
        !          2911:     esac
        !          2912:     ;;
        !          2913: esac
        !          2914: 
        !          2915: case "$d_douname$d_gethname" in
        !          2916: *define*) ;;
        !          2917: *)
        !          2918:     case "$phostname" in
        !          2919:       '') ;;
        !          2920:       *)
        !          2921:        $cat <<EOT
        !          2922:  
        !          2923: There is no gethostname() or uname() on this system.  You have two
        !          2924: possibilities at this point:
        !          2925: 
        !          2926: 1)  You can have your host name ($hostname) compiled into $package, which
        !          2927:     lets $package start up faster, but makes your binaries non-portable, or
        !          2928: 2)  you can have $package use a
        !          2929:        
        !          2930:        popen("$phostname","r")
        !          2931: 
        !          2932:     which will start slower but be more portable.
        !          2933: 
        !          2934: Option 1 will give you the option of using whoami.h if you have one.  If you
        !          2935: want option 2 but with a different command, you can edit config.sh at the
        !          2936: end of this shell script.
        !          2937: 
        !          2938: EOT
        !          2939:        case "$d_phostname" in
        !          2940:        "$define") dflt=n;;
        !          2941:        "$undef")  dflt=y;;
        !          2942:        '')
        !          2943:            case "$d_portable" in
        !          2944:            "$define") dflt=n ;;
        !          2945:            *)      dflt=y ;;
        !          2946:            esac
        !          2947:            ;;
        !          2948:        esac
        !          2949:        rp="Do you want your host name compiled in? [$dflt]"
        !          2950:        $echo $n "$rp $c"
        !          2951:        . myread
        !          2952:        case "$ans" in
        !          2953:          n*) d_phostname="$define" ;;
        !          2954:          *)  phostname=''
        !          2955:              d_phostname="$undef"
        !          2956:              ;;
        !          2957:        esac
        !          2958:        ;;
        !          2959:     esac
        !          2960:     case "$phostname" in
        !          2961:       '')
        !          2962:        case "$d_whoami" in
        !          2963:          "$define")
        !          2964:            dflt=y
        !          2965:            $cat <<EOM
        !          2966:  
        !          2967: No hostname function--you can either use the whoami.h file, which has this line:
        !          2968: 
        !          2969:        `grep sysname /usr/include/whoami.h`
        !          2970: 
        !          2971: or you can have the name we came up with earlier ($hostname) hardwired in.
        !          2972: EOM
        !          2973:            rp="Use whoami.h to get hostname? [$dflt]"
        !          2974:            $echo $n "$rp $c"
        !          2975:            . myread
        !          2976:            case "$ans" in
        !          2977:            n*) d_whoami="$undef";;
        !          2978:            esac
        !          2979:            ;;
        !          2980:          "$undef")
        !          2981:            echo 'No hostname function and no whoami.h--hardwiring "'$hostname'".'
        !          2982:            ;;
        !          2983:        esac
        !          2984:        ;;
        !          2985:     esac
        !          2986:     ;;
        !          2987: esac
        !          2988: 
        !          2989: : see if this is an fcntl system
        !          2990: echo " "
        !          2991: if $test -r /usr/include/fcntl.h ; then
        !          2992:     d_fcntl="$define"
        !          2993:     echo "fcntl.h found."
        !          2994: else
        !          2995:     d_fcntl="$undef"
        !          2996:     echo "No fcntl.h found, but that's ok."
        !          2997: fi
        !          2998: 
        !          2999: : see if ftime exists
        !          3000: echo " "
        !          3001: if $contains ftime libc.list >/dev/null 2>&1; then
        !          3002:     echo 'ftime() found.'
        !          3003:     d_ftime="$define"
        !          3004: else
        !          3005:     echo 'ftime() not found--timing may be less accurate.'
        !          3006:     d_ftime="$undef"
        !          3007: fi
        !          3008: 
        !          3009: : see if there is a getpw
        !          3010: echo " "
        !          3011: if $contains getpw.o libc.list >/dev/null 2>&1 ; then
        !          3012:     echo "getpw() found."
        !          3013:     d_getpwent="$undef"
        !          3014: else
        !          3015:     echo "No getpw() found--will use getpwent() instead."
        !          3016:     d_getpwent="$define"
        !          3017: fi
        !          3018: 
        !          3019: : set up shell script to do ~ expansion
        !          3020: cat >filexp <<EOSS
        !          3021: $startsh
        !          3022: : expand filename
        !          3023: case "\$1" in
        !          3024: ~/*|~)
        !          3025:     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
        !          3026:     ;;
        !          3027: ~*)
        !          3028:     if $test -f /bin/csh; then
        !          3029:        /bin/csh -f -c "glob \$1"
        !          3030:        echo ""
        !          3031:     else
        !          3032:        name=\`$expr x\$1 : '..\([^/]*\)'\`
        !          3033:        dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
        !          3034:        if $test ! -d "\$dir"; then
        !          3035:            me=\`basename \$0\`
        !          3036:            echo "\$me: can't locate home directory for: \$name" >&2
        !          3037:            exit 1
        !          3038:        fi
        !          3039:        case "\$1" in
        !          3040:        */*)
        !          3041:            echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
        !          3042:            ;;
        !          3043:        *)
        !          3044:            echo \$dir
        !          3045:            ;;
        !          3046:        esac
        !          3047:     fi
        !          3048:     ;;
        !          3049: *)
        !          3050:     echo \$1
        !          3051:     ;;
        !          3052: esac
        !          3053: EOSS
        !          3054: chmod 755 filexp
        !          3055: $eunicefix filexp
        !          3056: 
        !          3057: : where do we get termlib routines from
        !          3058: echo " "
        !          3059: ans=`loc libcurses.a x $libpth`
        !          3060: case "$ans" in
        !          3061: /*)
        !          3062:     ar t $ans >grimble
        !          3063:     if $contains tputs.o grimble >/dev/null 2>&1; then
        !          3064:        termlib='-lcurses'
        !          3065:        d_havetlib="$define"
        !          3066:        echo "Terminfo library found."
        !          3067:     else
        !          3068:        ans=x
        !          3069:     fi
        !          3070:     ;;
        !          3071: esac
        !          3072: case "$ans" in
        !          3073: x)
        !          3074:     ans=`loc libtermlib.a x $libpth`
        !          3075:     case "$ans" in
        !          3076:     /usr/lib*|/lib*)
        !          3077:        termlib='-ltermlib'
        !          3078:        d_havetlib="$define"
        !          3079:        echo "Termlib library found."
        !          3080:        ;;
        !          3081:     /*)
        !          3082:        termlib="$ans"
        !          3083:        d_havetlib="$define"
        !          3084:        echo "Termlib library found."
        !          3085:        ;;
        !          3086:     *)
        !          3087:        ans=`loc libtermcap.a x $libpth`
        !          3088:        case "$ans" in
        !          3089:        /usr/lib*|/lib*)
        !          3090:            termlib='-ltermcap'
        !          3091:            d_havetlib="$define"
        !          3092:            echo "Termcap library found."
        !          3093:            ;;
        !          3094:        /*)
        !          3095:            termlib="$ans"
        !          3096:            d_havetlib="$define"
        !          3097:            echo "Termcap library found."
        !          3098:            ;;
        !          3099:        *)
        !          3100:            case "$termlib" in
        !          3101:            '')
        !          3102:                dflt=y
        !          3103:                rp="Your system appears to NOT have termlib-style routines.  Is this true? [$dflt]"
        !          3104:                $echo $n "$rp $c"
        !          3105:                . myread
        !          3106:                case "$ans" in
        !          3107:                    n*|f*) d_havetlib="$define"
        !          3108:                          echo "Then where are the termlib-style routines kept (specify either -llibname"
        !          3109:                          $echo $n " or full pathname (~name ok))? $c"
        !          3110:                          rp='Specify termlib:'
        !          3111:                          . myread
        !          3112:                          termlib=`filexp $ans`
        !          3113:                          ;;
        !          3114:                    *)    d_havetlib="$undef"
        !          3115:                          termlib=''
        !          3116:                          echo "You will have to play around with term.c then."
        !          3117:                          ;;
        !          3118:                esac
        !          3119:                echo " "
        !          3120:                ;;
        !          3121:            *)  echo "You said termlib was $termlib before."
        !          3122:                ;;
        !          3123:            esac
        !          3124:            ;;
        !          3125:        esac
        !          3126:        ;;
        !          3127:     esac
        !          3128:     ;;
        !          3129: esac
        !          3130: 
        !          3131: : index or strcpy
        !          3132: echo " "
        !          3133: dflt=y
        !          3134: if $contains index libc.list >/dev/null 2>&1 ; then
        !          3135:     echo "Your system appears to use index() and rindex() rather than strchr()"
        !          3136:     $echo $n "and strrchr().  Is this correct? [$dflt] $c"
        !          3137:     rp='index() rather than strchr()? [$dflt]'
        !          3138:     . myread
        !          3139:     case "$ans" in
        !          3140:        n*|f*) d_index="$define" ;;
        !          3141:        *)     d_index="$undef" ;;
        !          3142:     esac
        !          3143: else
        !          3144:     echo "Your system appears to use strchr() and strrchr() rather than index()"
        !          3145:     $echo $n "and rindex().  Is this correct? [$dflt] $c"
        !          3146:     rp='strchr() rather than index()? [$dflt]'
        !          3147:     . myread
        !          3148:     case "$ans" in
        !          3149:        n*|f*) d_index="$undef" ;;
        !          3150:        *)     d_index="$define" ;;
        !          3151:     esac
        !          3152: fi
        !          3153: 
        !          3154: : see if ioctl defs are in sgtty/termio or sys/ioctl
        !          3155: echo " "
        !          3156: if $test -r /usr/include/sys/ioctl.h ; then
        !          3157:     d_ioctl="$define"
        !          3158:     echo "sys/ioctl.h found."
        !          3159: else
        !          3160:     d_ioctl="$undef"
        !          3161:     echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
        !          3162: fi
        !          3163: 
        !          3164: : see if there are directory access routines out there
        !          3165: echo " "
        !          3166: if $test -r /usr/include/ndir.h && \
        !          3167:       ( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then
        !          3168:     echo "Ndir library found."
        !          3169:     if $test -r /usr/lib/libndir.a; then
        !          3170:        ndirlib='-lndir'
        !          3171:     else
        !          3172:        ndirlib="/usr/local/lib/libndir.a"
        !          3173:     fi
        !          3174:     d_libndir="$define"
        !          3175:     d_usendir="$undef"
        !          3176:     ndirc=''
        !          3177:     ndiro=''
        !          3178: else
        !          3179:     ndirlib=''
        !          3180:     d_libndir="$undef"
        !          3181:     if bsd && $contains readdir libc.list >/dev/null 2>&1 ; then
        !          3182:        echo "No ndir library found, but you have readdir() so we'll use that."
        !          3183:        d_usendir="$undef"
        !          3184:        ndirc=''
        !          3185:        ndiro=''
        !          3186:     else
        !          3187:        echo "No ndir library found--using ./ndir.c."
        !          3188:        d_usendir="$define"
        !          3189:        ndirc='ndir.c'
        !          3190:        ndiro='ndir.o'
        !          3191:     fi
        !          3192: fi
        !          3193: 
        !          3194: : see if we need -ljobs and if we have sigset, etc.
        !          3195: echo " "
        !          3196: if $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then
        !          3197:     echo "Jobs library found."
        !          3198:     d_normsig="$undef"
        !          3199:     jobslib='-ljobs'
        !          3200: else
        !          3201:     if bsd; then
        !          3202:        echo "No jobs library found.  (I suppose this is at least 4.2...)"
        !          3203:     else
        !          3204:        echo "No jobs library found.  (That's okay, we all have our faults.)"
        !          3205:     fi
        !          3206:     d_normsig="$define"
        !          3207:     jobslib=''
        !          3208: fi
        !          3209: 
        !          3210: : see if rdchk exists
        !          3211: echo " "
        !          3212: if $contains rdchk libc.list >/dev/null 2>&1; then
        !          3213:     echo 'rdchk() found.'
        !          3214:     d_rdchk="$define"
        !          3215: else
        !          3216:     if v7; then
        !          3217:        echo "rdchk() not found--you'd better have FIONREAD or O_NDELAY."
        !          3218:     else
        !          3219:        echo 'rdchk() not found.'
        !          3220:     fi
        !          3221:     d_rdchk="$undef"
        !          3222: fi
        !          3223: 
        !          3224: : see how they want the scoreboard kept
        !          3225: case "$d_scorfl" in
        !          3226: "$define") dflt=y ;;
        !          3227: *) dflt=n ;;
        !          3228: esac
        !          3229: case "$nametype" in
        !          3230: other) d_scorfl="$undef" ;;
        !          3231: *)
        !          3232:     $cat <<'EOM'
        !          3233: 
        !          3234: The scoreboard can be kept with one score per login name, or one score
        !          3235: per full name.  If users can change their full name, or if there is
        !          3236: more than one person on your system with the same full name, you should
        !          3237: keep the score by login name (the full name is still printed).
        !          3238: EOM
        !          3239:     rp="Do you want the scoreboard kept by full name? [$dflt]"
        !          3240:     $echo $n "$rp $c"
        !          3241:     . myread
        !          3242:     case "$ans" in
        !          3243:     y*) d_scorfl="$define" ;;
        !          3244:     *) d_scorfl="$undef" ;;
        !          3245:     esac
        !          3246:     ;;
        !          3247: esac
        !          3248: 
        !          3249: : check for signed chars
        !          3250: echo " "
        !          3251: echo "Checking to see if your C compiler can do signed chars..."
        !          3252: $cat >try.c <<'EOCP'
        !          3253: main()
        !          3254: {
        !          3255:        char c = 0;
        !          3256: 
        !          3257:        c--;
        !          3258:        exit(c >= 0);
        !          3259: }
        !          3260: EOCP
        !          3261: cc -o a.out try.c
        !          3262: if a.out; then
        !          3263:     d_sgndchr="$define"
        !          3264:     echo "It certainly can."
        !          3265: else
        !          3266:     d_sgndchr="$undef"
        !          3267:     echo "It can't.  I'll have to make some things type short."
        !          3268: fi
        !          3269: $rm -f try.* a.out
        !          3270: 
        !          3271: : see how we invoke the C preprocessor
        !          3272: echo " "
        !          3273: echo "Checking to see how your C preprocessor is invoked..."
        !          3274: cat <<'EOT' >testcpp.c
        !          3275: #define ABC abc
        !          3276: #define XYZ xyz
        !          3277: ABC.XYZ
        !          3278: EOT
        !          3279: echo 'Maybe "cc -E" will work...'
        !          3280: cc -E testcpp.c >testcpp.out 2>&1
        !          3281: if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
        !          3282:     echo "Yup, it does."
        !          3283:     cpp='cc -E'
        !          3284: else
        !          3285:     echo 'Nope...maybe "cc -P" will work...'
        !          3286:     cc -P testcpp.c >testcpp.out 2>&1
        !          3287:     if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
        !          3288:        echo "Yup, that does."
        !          3289:        cpp='cc -P'
        !          3290:     else
        !          3291:        echo 'Nixed again...maybe "/lib/cpp" will work...'
        !          3292:        /lib/cpp testcpp.c >testcpp.out 2>&1
        !          3293:        if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
        !          3294:            echo "Hooray, it works!  I was beginning to wonder."
        !          3295:            cpp='/lib/cpp'
        !          3296:        else
        !          3297:            echo 'Hmm...maybe you already told me...'
        !          3298:            case "$cpp" in
        !          3299:            '') ;;
        !          3300:            *) $cpp testcpp.c >testcpp.out 2>&1;;
        !          3301:            esac
        !          3302:            if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
        !          3303:                echo "Hooray, you did!  I was beginning to wonder."
        !          3304:            else
        !          3305:                dflt=blurfl
        !          3306:                $echo $n "Nope. I can't find a C preprocessor.  Name one: $c"
        !          3307:                rp='Name a C preprocessor:'
        !          3308:                . myread
        !          3309:                cpp="$ans"
        !          3310:                $cpp testcpp.c >testcpp.out 2>&1
        !          3311:                if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
        !          3312:                    echo "OK, that will do."
        !          3313:                else
        !          3314:                    echo "Sorry, I can't get that to work.  Go find one."
        !          3315:                    exit 1
        !          3316:                fi
        !          3317:            fi
        !          3318:        fi
        !          3319:     fi
        !          3320: fi
        !          3321: rm -f testcpp.c testcpp.out
        !          3322: 
        !          3323: : get C preprocessor symbols handy
        !          3324: echo " "
        !          3325: echo $attrlist | $tr '[ ]' '[\012]' >Cppsym.know
        !          3326: $cat <<EOSS >Cppsym
        !          3327: $startsh
        !          3328: case "\$1" in
        !          3329: -l) list=true
        !          3330:     shift
        !          3331:     ;;
        !          3332: esac
        !          3333: unknown=''
        !          3334: case "\$list\$#" in
        !          3335: 1|2)
        !          3336:     for sym do
        !          3337:        if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
        !          3338:            exit 0
        !          3339:        elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
        !          3340:                :
        !          3341:        else
        !          3342:            unknown="\$unknown \$sym"
        !          3343:        fi
        !          3344:     done
        !          3345:     set X \$unknown
        !          3346:     shift
        !          3347:     ;;
        !          3348: esac
        !          3349: case \$# in
        !          3350: 0) exit 1;;
        !          3351: esac
        !          3352: echo \$* | $tr '[ ]' '[\012]' | $sed -e 's/\(.*\)/\\
        !          3353: #ifdef \1\\
        !          3354: exit 0; _ _ _ _\1\\     \1\\
        !          3355: #endif\\
        !          3356: /' >/tmp/Cppsym\$\$
        !          3357: echo exit 1 >>/tmp/Cppsym\$\$
        !          3358: $cpp /tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
        !          3359: case "\$list" in
        !          3360: true) awk '\$6 != "" {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
        !          3361: *)
        !          3362:     sh /tmp/Cppsym2\$\$
        !          3363:     status=\$?
        !          3364:     ;;
        !          3365: esac
        !          3366: $rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
        !          3367: exit \$status
        !          3368: EOSS
        !          3369: chmod 755 Cppsym
        !          3370: $eunicefix Cppsym
        !          3371: echo "Your C preprocessor defines the following symbols:"
        !          3372: Cppsym -l $attrlist >Cppsym.true
        !          3373: cat Cppsym.true
        !          3374: rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
        !          3375: 
        !          3376: : see if this is a termio system
        !          3377: echo " "
        !          3378: if Cppsym pyr && $test -r /usr/include/sgtty.h ; then
        !          3379:     d_termio="$undef"
        !          3380:     echo "sgtty.h found."
        !          3381: elif $test -r /usr/include/termio.h ; then
        !          3382:     d_termio="$define"
        !          3383:     echo "termio.h found."
        !          3384: elif $test -r /usr/include/sgtty.h ; then
        !          3385:     d_termio="$undef"
        !          3386:     echo "sgtty.h found."
        !          3387: else
        !          3388:     d_termio="$undef"
        !          3389:     echo "Neither termio.h nor sgtty.h found--you could have problems."
        !          3390: fi
        !          3391: 
        !          3392: : find out which shell people like to use most
        !          3393: case "$prefshell" in
        !          3394: '')
        !          3395:     if $test -f /bin/ksh; then
        !          3396:        dflt='/bin/ksh'
        !          3397:     elif $test -f /bin/csh; then
        !          3398:        dflt='/bin/csh'
        !          3399:     else
        !          3400:        dflt='/bin/sh'
        !          3401:     fi
        !          3402:     ;;
        !          3403: *)  dflt="$prefshell";;
        !          3404: esac
        !          3405: cont=true
        !          3406: while $test "$cont" ; do
        !          3407:     echo " "
        !          3408:     echo "Give the full path name of the shell most people like to use on your"
        !          3409:     $echo $n "system: [$dflt] $c"
        !          3410:     rp="Preferred shell: [$dflt]"
        !          3411:     . myread
        !          3412:     prefshell=$ans
        !          3413:     if test -f $ans; then
        !          3414:        cont=''
        !          3415:     else
        !          3416:        dflt=n
        !          3417:        rp="File $ans doesn't exist.  Use that name anyway? [$dflt]"
        !          3418:        $echo $n "$rp $c"
        !          3419:        . myread
        !          3420:        dflt=''
        !          3421:        case "$ans" in
        !          3422:        y*) cont='';;
        !          3423:        esac
        !          3424:     fi
        !          3425: done
        !          3426: 
        !          3427: : determine where private files go
        !          3428: case "$privlib" in
        !          3429: '')
        !          3430:     dflt=/usr/games/lib/$package
        !          3431:     ;;
        !          3432: *)  dflt="$privlib"
        !          3433:     ;;
        !          3434: esac
        !          3435: $cat <<EOM
        !          3436: 
        !          3437: The $package package has a some auxiliary files that should be put in a library
        !          3438: that is accessible by everyone.  Where do you want to put these private"
        !          3439: EOM
        !          3440: $echo $n "but accessible files? [$dflt] (~name ok) $c"
        !          3441: rp="Put private files where? [$dflt]"
        !          3442: . myread
        !          3443: privlib="$ans"
        !          3444: case "$privlib" in
        !          3445:   '') privlib=$dflt ;;
        !          3446: esac
        !          3447: case "$d_portable" in
        !          3448: "$undef")
        !          3449:     privlib=`filexp $privlib`
        !          3450:     ;;
        !          3451: esac
        !          3452: 
        !          3453: : check for size of random number generator
        !          3454: echo " "
        !          3455: case "$randbits" in
        !          3456: '')
        !          3457:     echo "Checking to see how many bits your rand function produces..."
        !          3458:     $cat >try.c <<'EOCP'
        !          3459: #include <stdio.h>
        !          3460: main()
        !          3461: {
        !          3462:     register int i;
        !          3463:     register unsigned long tmp;
        !          3464:     register unsigned long max;
        !          3465: 
        !          3466:     for (i=1000; i; i--) {
        !          3467:        tmp = (unsigned long)rand();
        !          3468:        if (tmp > max) max = tmp;
        !          3469:     }
        !          3470:     for (i=0; max; i++)
        !          3471:        max /= 2;
        !          3472:     printf("%d\n",i);
        !          3473: }
        !          3474: EOCP
        !          3475:     if cc try.c -o try >/dev/null 2>&1 ; then
        !          3476:        dflt=`try`
        !          3477:     else
        !          3478:        dflt='?'
        !          3479:        echo "(I can't seem to compile the test program...)"
        !          3480:     fi
        !          3481:     ;;
        !          3482: *)
        !          3483:     dflt="$randbits"
        !          3484:     ;;
        !          3485: esac
        !          3486: rp="How many bits does your rand() function produce? [$dflt]"
        !          3487: $echo $n "$rp $c"
        !          3488: . myread
        !          3489: randbits="$ans"
        !          3490: $rm -f try.c try
        !          3491: 
        !          3492: : see how many register declarations we want to use
        !          3493: case "$registers" in
        !          3494: '')
        !          3495:     if Cppsym vax; then
        !          3496:        dflt=6
        !          3497:     elif Cppsym sun mc68000; then
        !          3498:        dflt=10
        !          3499:     elif Cppsym pyr; then
        !          3500:        dflt=14
        !          3501:     elif Cppsym ns32000 ns16000; then
        !          3502:        dflt=5
        !          3503:     elif Cppsym $smallmach; then
        !          3504:        dflt=3
        !          3505:     else
        !          3506:        : if you have any other numbers for me, send them in
        !          3507:        dflt=6
        !          3508:     fi
        !          3509:     ;;
        !          3510: *)  dflt=$registers ;;
        !          3511: esac
        !          3512: cat <<EOM
        !          3513:  
        !          3514: Different C compilers on different machines pay attention to different
        !          3515: numbers of register declarations.  About how many register declarations in
        !          3516: EOM
        !          3517: $echo $n "each routine does your C compiler pay attention to? (OK to guess) [$dflt] $c"
        !          3518: rp="# register declarations used? [$dflt]"
        !          3519: . myread
        !          3520: registers=$ans
        !          3521: reg1=''
        !          3522: awk "END { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev/null >.foo
        !          3523: . .foo
        !          3524: awk "END { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \
        !          3525:        </dev/null >.foo
        !          3526: . .foo
        !          3527: rm -f .foo
        !          3528: 
        !          3529: : determine root id
        !          3530: echo " "
        !          3531: rootid=`$sed -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d" </etc/passwd`
        !          3532: case "$rootid" in
        !          3533:   '') rootid=0 ;;
        !          3534:   *)  echo "Root uid = $rootid" ;;
        !          3535: esac
        !          3536: 
        !          3537: : check for void type
        !          3538: echo " "
        !          3539: $cat <<EOM
        !          3540: Checking to see how well your C compiler groks the void type...
        !          3541: 
        !          3542:   Support flag bits are:
        !          3543:     1: basic void declarations.
        !          3544:     2: arrays of pointers to functions returning void.
        !          3545:     4: operations between pointers to and addresses of void functions.
        !          3546: 
        !          3547: EOM
        !          3548: case "$voidflags" in
        !          3549: '')
        !          3550:     $cat >try.c <<'EOCP'
        !          3551: #if TRY & 1
        !          3552: void main() {
        !          3553: #else
        !          3554: main() {
        !          3555: #endif
        !          3556:        extern void *moo();
        !          3557:        void (*goo)();
        !          3558: #if TRY & 2
        !          3559:        void (*foo[10])();
        !          3560: #endif
        !          3561: 
        !          3562: #if TRY & 4
        !          3563:        if(goo == moo) {
        !          3564:                exit(0);
        !          3565:        }
        !          3566: #endif
        !          3567:        exit(0);
        !          3568: }
        !          3569: EOCP
        !          3570:     if cc -S -DTRY=7 try.c >.out 2>&1 ; then
        !          3571:        voidflags=7
        !          3572:        echo "It appears to support void fully."
        !          3573:        if $contains warning .out >/dev/null 2>&1; then
        !          3574:            echo "However, you might get some warnings that look like this:"
        !          3575:            $cat .out
        !          3576:        fi
        !          3577:     else
        !          3578:        echo "Hmm, you compiler has some difficulty with void.  Checking further..."
        !          3579:        if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
        !          3580:            echo "It supports 1..."
        !          3581:            if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
        !          3582:                voidflags=3
        !          3583:                echo "And it supports 2 but not 4."
        !          3584:            else
        !          3585:                echo "It doesn't support 2..."
        !          3586:                if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
        !          3587:                    voidflags=5
        !          3588:                    echo "But it supports 4."
        !          3589:                else
        !          3590:                    voidflags=1
        !          3591:                    echo "And it doesn't support 4."
        !          3592:                fi
        !          3593:            fi
        !          3594:        else
        !          3595:            echo "There is no support at all for void."
        !          3596:            voidflags=0
        !          3597:        fi
        !          3598:     fi
        !          3599: esac
        !          3600: dflt="$voidflags";
        !          3601: rp="Your void support flags add up to what? [$dflt]"
        !          3602: $echo $n "$rp $c"
        !          3603: . myread
        !          3604: voidflags="$ans"
        !          3605: $rm -f try.* .out
        !          3606: 
        !          3607: : preserve RCS keywords in files with variable substitution, grrr
        !          3608: Log='$Log'
        !          3609: Header='$Header'
        !          3610: 
        !          3611: : determine where public executables go
        !          3612: case "$bin" in
        !          3613: '')
        !          3614:     dflt=`loc . /bin /usr/games /usr/local/bin /usr/lbin /usr/local /usr/bin`
        !          3615:     ;;
        !          3616: *)  dflt="$bin"
        !          3617:     ;;
        !          3618: esac
        !          3619: bin='blurfl/dyick'
        !          3620: while $test ! -d "$bin" ; do
        !          3621:     case "$bin" in
        !          3622:       blurfl*) ;;
        !          3623:       *) $echo "$bin does not appear to exist." ;;
        !          3624:     esac
        !          3625:     $echo " "
        !          3626:     rp="Where do you want to put the public executables? [$dflt]"
        !          3627:     $echo $n "$rp $c"
        !          3628:     . myread
        !          3629:     bin="$ans"
        !          3630:     bin=`filexp $bin`
        !          3631:     case "$bin" in
        !          3632:       '') bin=$dflt ;;
        !          3633:     esac
        !          3634: done
        !          3635: 
        !          3636: : determine where manual pages go
        !          3637: case "$mansrc" in
        !          3638: '')
        !          3639:     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
        !          3640:     ;;
        !          3641: *)  dflt="$mansrc"
        !          3642:     ;;
        !          3643: esac
        !          3644: cont=true
        !          3645: while $test "$cont" ; do
        !          3646:     echo " "
        !          3647:     rp="Where do the manual pages (source) go? [$dflt]"
        !          3648:     $echo $n "$rp $c"
        !          3649:     . myread
        !          3650:     mansrc=`filexp "$ans"`
        !          3651:     if test -d $mansrc; then
        !          3652:        cont=''
        !          3653:     else
        !          3654:        dflt=n
        !          3655:        rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
        !          3656:        $echo $n "$rp $c"
        !          3657:        . myread
        !          3658:        dflt=''
        !          3659:        case "$ans" in
        !          3660:        y*) cont='';;
        !          3661:        esac
        !          3662:     fi
        !          3663: done
        !          3664: case "$mansrc" in
        !          3665: *l)
        !          3666:     manext=l
        !          3667:     ;;
        !          3668: *n)
        !          3669:     manext=n
        !          3670:     ;;
        !          3671: *)
        !          3672:     manext=1
        !          3673:     ;;
        !          3674: esac
        !          3675: 
        !          3676: : see what memory models we can support
        !          3677: case "$models" in
        !          3678: '')
        !          3679:     if Cppsym pdp11; then
        !          3680:        dflt='unsplit split'
        !          3681:     else
        !          3682:        ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
        !          3683:        case "$ans" in
        !          3684:        X) dflt='none';;
        !          3685:        *)  if $test -d /lib/small || $test -d /usr/lib/small; then
        !          3686:                dflt='small'
        !          3687:            else
        !          3688:                dflt=''
        !          3689:            fi
        !          3690:            if $test -d /lib/medium || $test -d /usr/lib/medium; then
        !          3691:                dflt="$dflt medium"
        !          3692:            fi
        !          3693:            if $test -d /lib/large || $test -d /usr/lib/large; then
        !          3694:                dflt="$dflt large"
        !          3695:            fi
        !          3696:            if $test -d /lib/huge || $test -d /usr/lib/huge; then
        !          3697:                dflt="$dflt huge"
        !          3698:            fi
        !          3699:        esac
        !          3700:     fi
        !          3701:     ;;
        !          3702: *)  dflt="$models" ;;
        !          3703: esac
        !          3704: $cat <<EOM
        !          3705:  
        !          3706: Some systems have different model sizes.  On most systems they are called
        !          3707: small, medium, large, and huge.  On the PDP11 they are called unsplit and
        !          3708: split.  If your system doesn't support different memory models, say "none".
        !          3709: If you wish to force everything to one memory model, say "none" here and
        !          3710: put the appropriate flags later when it asks you for other cc and ld flags.
        !          3711: Venix systems may wish to put "none" and let the compiler figure things out.
        !          3712: (In the following question multiple model names should be space separated.)
        !          3713: 
        !          3714: EOM
        !          3715: rp="Which models are supported? [$dflt]"
        !          3716: $echo $n "$rp $c"
        !          3717: . myread
        !          3718: models="$ans"
        !          3719: 
        !          3720: case "$models" in
        !          3721: none)
        !          3722:     small=''
        !          3723:     medium=''
        !          3724:     large=''
        !          3725:     huge=''
        !          3726:     unsplit=''
        !          3727:     split=''
        !          3728:     ;;
        !          3729: *split)
        !          3730:     case "$split" in
        !          3731:     '') 
        !          3732:        if $contains '-i' $mansrc/ld.1 >/dev/null 2>&1 || \
        !          3733:           $contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then
        !          3734:            dflt='-i'
        !          3735:        else
        !          3736:            dflt='none'
        !          3737:        fi
        !          3738:        ;;
        !          3739:     *) dflt="$split";;
        !          3740:     esac
        !          3741:     rp="What flag indicates separate I and D space? [$dflt]"
        !          3742:     $echo $n "$rp $c"
        !          3743:     . myread
        !          3744:     case "$ans" in
        !          3745:     none) ans='';;
        !          3746:     esac
        !          3747:     split="$ans"
        !          3748:     unsplit=''
        !          3749:     ;;
        !          3750: *large*|*small*|*medium*|*huge*)
        !          3751:     case "$model" in
        !          3752:     *large*)
        !          3753:        case "$large" in
        !          3754:        '') dflt='-Ml';;
        !          3755:        *) dflt="$large";;
        !          3756:        esac
        !          3757:        rp="What flag indicates large model? [$dflt]"
        !          3758:        $echo $n "$rp $c"
        !          3759:        . myread
        !          3760:        case "$ans" in
        !          3761:        none) ans='';
        !          3762:        esac
        !          3763:        large="$ans"
        !          3764:        ;;
        !          3765:     *) large='';;
        !          3766:     esac
        !          3767:     case "$model" in
        !          3768:     *huge*)
        !          3769:        case "$huge" in
        !          3770:        '') dflt='-Mh';;
        !          3771:        *) dflt="$huge";;
        !          3772:        esac
        !          3773:        rp="What flag indicates huge model? [$dflt]"
        !          3774:        $echo $n "$rp $c"
        !          3775:        . myread
        !          3776:        case "$ans" in
        !          3777:        none) ans='';
        !          3778:        esac
        !          3779:        huge="$ans"
        !          3780:        ;;
        !          3781:     *) huge="$large";;
        !          3782:     esac
        !          3783:     case "$model" in
        !          3784:     *medium*)
        !          3785:        case "$medium" in
        !          3786:        '') dflt='-Mm';;
        !          3787:        *) dflt="$medium";;
        !          3788:        esac
        !          3789:        rp="What flag indicates medium model? [$dflt]"
        !          3790:        $echo $n "$rp $c"
        !          3791:        . myread
        !          3792:        case "$ans" in
        !          3793:        none) ans='';
        !          3794:        esac
        !          3795:        medium="$ans"
        !          3796:        ;;
        !          3797:     *) medium="$large";;
        !          3798:     esac
        !          3799:     case "$model" in
        !          3800:     *small*)
        !          3801:        case "$small" in
        !          3802:        '') dflt='none';;
        !          3803:        *) dflt="$small";;
        !          3804:        esac
        !          3805:        rp="What flag indicates small model? [$dflt]"
        !          3806:        $echo $n "$rp $c"
        !          3807:        . myread
        !          3808:        case "$ans" in
        !          3809:        none) ans='';
        !          3810:        esac
        !          3811:        small="$ans"
        !          3812:        ;;
        !          3813:     *) small='';;
        !          3814:     esac
        !          3815:     ;;
        !          3816: *)
        !          3817:     echo "Unrecognized memory models--you may have to edit Makefile.SH"
        !          3818:     ;;
        !          3819: esac
        !          3820: 
        !          3821: case "$ccflags" in
        !          3822: '') dflt='none';;
        !          3823: *) dflt="$ccflags";;
        !          3824: esac
        !          3825: echo " "
        !          3826: rp="Any additional cc flags? [$dflt]"
        !          3827: $echo $n "$rp $c"
        !          3828: . myread
        !          3829: case "$ans" in
        !          3830: none) ans='';
        !          3831: esac
        !          3832: ccflags="$ans"
        !          3833: 
        !          3834: case "$ldflags" in
        !          3835: '') if venix; then
        !          3836:        dflt='-i -z'
        !          3837:     else
        !          3838:        dflt='none'
        !          3839:     fi
        !          3840:     ;;
        !          3841: *) dflt="$ldflags";;
        !          3842: esac
        !          3843: echo " "
        !          3844: rp="Any additional ld flags? [$dflt]"
        !          3845: $echo $n "$rp $c"
        !          3846: . myread
        !          3847: case "$ans" in
        !          3848: none) ans='';
        !          3849: esac
        !          3850: ldflags="$ans"
        !          3851: 
        !          3852: : see if we need a special compiler
        !          3853: echo " "
        !          3854: if usg; then
        !          3855:     case "$cc" in
        !          3856:     '')
        !          3857:        case "$Mcc" in
        !          3858:        /*) dflt='Mcc'
        !          3859:            ;;
        !          3860:        *)
        !          3861:            case "$large" in
        !          3862:            -M*)
        !          3863:                dflt='cc'
        !          3864:                ;;
        !          3865:            *)
        !          3866:                if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
        !          3867:                    dflt='cc -M'
        !          3868:                else
        !          3869:                    dflt='cc'
        !          3870:                fi
        !          3871:                ;;
        !          3872:            esac
        !          3873:            ;;
        !          3874:        esac
        !          3875:        ;;
        !          3876:     *)  dflt="$cc";;
        !          3877:     esac
        !          3878:     $cat <<'EOM'
        !          3879:  
        !          3880: On some systems the default C compiler will not resolve multiple global
        !          3881: references that happen to have the same name.  On some such systems the
        !          3882: "Mcc" command may be used to force these to be resolved.  On other systems
        !          3883: a "cc -M" command is required.  (Note that the -M flag on other systems
        !          3884: indicates a memory model to use!)  What command will force resolution on
        !          3885: EOM
        !          3886:     $echo $n "this system? [$dflt] $c"
        !          3887:     rp="Command to resolve multiple refs? [$dflt]"
        !          3888:     . myread
        !          3889:     cc="$ans"
        !          3890: else
        !          3891:     echo "Not a USG system--assuming cc can resolve multiple definitions."
        !          3892:     cc=cc
        !          3893: fi
        !          3894: 
        !          3895: : get uid to chown everything to
        !          3896: case "$chowner" in
        !          3897: '') dflt=daemon
        !          3898:     ;;
        !          3899: *)  dflt="$chowner"
        !          3900:     ;;
        !          3901: esac
        !          3902: $cat <<'EOM'
        !          3903:  
        !          3904: If you do a make install as the superuser, I can chown all the publicly
        !          3905: visible files to be owned by some particular user id.  Any setuid programs
        !          3906: in this package will run under this uid, and be able to access the files
        !          3907: that belong to this uid.  You should pick a uid that nobody can log into
        !          3908: that you don't trust to modify the programs or data files of this package.
        !          3909: You should probably not pick root if there are any setuid programs in this
        !          3910: package.  If you want to create a uid for this, do so before the make install.
        !          3911: 
        !          3912: EOM
        !          3913: rp="Uid to chown public files to? [$dflt]"
        !          3914: $echo $n "$rp $c"
        !          3915: . myread
        !          3916: chowner="$ans"
        !          3917: case "$chowner" in
        !          3918: '') chowner=$dflt ;;
        !          3919: esac
        !          3920: 
        !          3921: : see if we should include -lnm
        !          3922: echo " "
        !          3923: if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
        !          3924:     echo "New math library found."
        !          3925:     libnm='-lnm'
        !          3926: else
        !          3927:     ans=`loc libtermlib.a x $libpth`
        !          3928:     case "$ans" in
        !          3929:     x)
        !          3930:        echo "No nm library found--the normal math library will have to do."
        !          3931:        libnm=''
        !          3932:        ;;
        !          3933:     *)
        !          3934:        echo "New math library found in $ans."
        !          3935:        libnm="$ans"
        !          3936:        ;;
        !          3937:     esac
        !          3938: fi
        !          3939: 
        !          3940: : Warnings
        !          3941: if v7; then
        !          3942:     cat <<'EOM'
        !          3943:  
        !          3944: NOTE: the V7 compiler may ignore some #undefs that $package uses.  If so,
        !          3945: you may get messages about redefining EXT.  Some V7 compilers also have
        !          3946: difficulties with #defines near buffer boundaries, so beware.  You may have
        !          3947: to play with the spacing in some .h files, believe it or not.
        !          3948: EOM
        !          3949: fi
        !          3950: 
        !          3951: : Warnings
        !          3952: if v7; then
        !          3953:     cat <<'EOM'
        !          3954: 
        !          3955: NOTE: many V7 systems do not have a way to do a non-blocking read.  If you
        !          3956: don't have any of FIONREAD, O_NDELAY, or rdchk(), the $package package
        !          3957: may not work as well as it might.  It might not work at all.
        !          3958: EOM
        !          3959: fi
        !          3960: 
        !          3961: $echo " "
        !          3962: $echo "End of configuration questions."
        !          3963: $echo " "
        !          3964: 
        !          3965: : create config.sh file
        !          3966: echo " "
        !          3967: if test -d ../UU; then
        !          3968:     cd ..
        !          3969: fi
        !          3970: echo "Creating config.sh..."
        !          3971: $spitshell <<EOT >config.sh
        !          3972: $startsh
        !          3973: # config.sh
        !          3974: # This file was produced by running the Configure script.
        !          3975: 
        !          3976: d_eunice='$d_eunice'
        !          3977: eunicefix='$eunicefix'
        !          3978: define='$define'
        !          3979: loclist='$loclist'
        !          3980: expr='$expr'
        !          3981: sed='$sed'
        !          3982: echo='$echo'
        !          3983: cat='$cat'
        !          3984: rm='$rm'
        !          3985: mv='$mv'
        !          3986: cp='$cp'
        !          3987: tail='$tail'
        !          3988: tr='$tr'
        !          3989: mkdir='$mkdir'
        !          3990: sort='$sort'
        !          3991: uniq='$uniq'
        !          3992: grep='$grep'
        !          3993: trylist='$trylist'
        !          3994: test='$test'
        !          3995: inews='$inews'
        !          3996: egrep='$egrep'
        !          3997: more='$more'
        !          3998: pg='$pg'
        !          3999: Mcc='$Mcc'
        !          4000: vi='$vi'
        !          4001: mailx='$mailx'
        !          4002: Log='$Log'
        !          4003: Header='$Header'
        !          4004: cc='$cc'
        !          4005: contains='$contains'
        !          4006: cpp='$cpp'
        !          4007: d_charsprf='$d_charsprf'
        !          4008: d_fcntl='$d_fcntl'
        !          4009: d_ftime='$d_ftime'
        !          4010: d_gethname='$d_gethname'
        !          4011: d_douname='$d_douname'
        !          4012: d_phostname='$d_phostname'
        !          4013: d_getpwent='$d_getpwent'
        !          4014: d_havetlib='$d_havetlib'
        !          4015: termlib='$termlib'
        !          4016: d_index='$d_index'
        !          4017: d_ioctl='$d_ioctl'
        !          4018: d_normsig='$d_normsig'
        !          4019: jobslib='$jobslib'
        !          4020: d_portable='$d_portable'
        !          4021: d_rdchk='$d_rdchk'
        !          4022: d_scorfl='$d_scorfl'
        !          4023: d_sgndchr='$d_sgndchr'
        !          4024: d_termio='$d_termio'
        !          4025: d_usendir='$d_usendir'
        !          4026: d_libndir='$d_libndir'
        !          4027: ndirc='$ndirc'
        !          4028: ndiro='$ndiro'
        !          4029: d_whoami='$d_whoami'
        !          4030: hostname='$hostname'
        !          4031: phostname='$phostname'
        !          4032: mydomain='$mydomain'
        !          4033: libc='$libc'
        !          4034: libnm='$libnm'
        !          4035: mansrc='$mansrc'
        !          4036: manext='$manext'
        !          4037: models='$models'
        !          4038: split='$split'
        !          4039: small='$small'
        !          4040: medium='$medium'
        !          4041: large='$large'
        !          4042: huge='$huge'
        !          4043: ccflags='$ccflags'
        !          4044: ldflags='$ldflags'
        !          4045: n='$n'
        !          4046: c='$c'
        !          4047: nametype='$nametype'
        !          4048: d_passnames='$d_passnames'
        !          4049: d_berknames='$d_berknames'
        !          4050: d_usgnames='$d_usgnames'
        !          4051: passcat='$passcat'
        !          4052: package='$package'
        !          4053: prefshell='$prefshell'
        !          4054: randbits='$randbits'
        !          4055: registers='$registers'
        !          4056: reg1='$reg1'
        !          4057: reg2='$reg2'
        !          4058: reg3='$reg3'
        !          4059: reg4='$reg4'
        !          4060: reg5='$reg5'
        !          4061: reg6='$reg6'
        !          4062: reg7='$reg7'
        !          4063: reg8='$reg8'
        !          4064: reg9='$reg9'
        !          4065: reg10='$reg10'
        !          4066: reg11='$reg11'
        !          4067: reg12='$reg12'
        !          4068: reg13='$reg13'
        !          4069: reg14='$reg14'
        !          4070: reg15='$reg15'
        !          4071: reg16='$reg16'
        !          4072: rootid='$rootid'
        !          4073: spitshell='$spitshell'
        !          4074: shsharp='$shsharp'
        !          4075: sharpbang='$sharpbang'
        !          4076: startsh='$startsh'
        !          4077: voidflags='$voidflags'
        !          4078: bin='$bin'
        !          4079: chowner='$chowner'
        !          4080: privlib='$privlib'
        !          4081: CONFIG=true
        !          4082: EOT
        !          4083:  
        !          4084: CONFIG=true
        !          4085: 
        !          4086: echo " "
        !          4087: dflt=''
        !          4088: echo "If you didn't make any mistakes, then just type a carriage return here."
        !          4089: rp="If you need to edit config.sh, do it as a shell escape here:"
        !          4090: $echo $n "$rp $c"
        !          4091: . myread
        !          4092: case "$ans" in
        !          4093: '') ;;
        !          4094: *) : in case they cannot read
        !          4095:     eval $ans;;
        !          4096: esac
        !          4097: 
        !          4098: echo " "
        !          4099: echo "Doing variable substitutions on .SH files..."
        !          4100: set `$grep '\.SH' <MANIFEST | awk '{print $1}'`
        !          4101: for file in $*; do
        !          4102:     case "$file" in
        !          4103:     */*)
        !          4104:        dir=`$expr X$file : 'X\(.*\)/'`
        !          4105:        file=`$expr X$file : 'X.*/\(.*\)'`
        !          4106:        (cd $dir && . $file)
        !          4107:        ;;
        !          4108:     *)
        !          4109:        . $file
        !          4110:        ;;
        !          4111:     esac
        !          4112: done
        !          4113: if test -f config.h.SH; then
        !          4114:     if test ! -f config.h; then
        !          4115:        : oops, they left it out of MANIFEST, probably, so do it anyway.
        !          4116:        . config.h.SH
        !          4117:     fi
        !          4118: fi
        !          4119: 
        !          4120: if $contains '^depend:' Makefile >/dev/null 2>&1; then
        !          4121:     dflt=n
        !          4122:     $cat <<EOM
        !          4123: 
        !          4124: Now you need to generate make dependencies by running "make depend".
        !          4125: You might prefer to run it in background: "make depend > makedepend.out &"
        !          4126: It can take a while, so you might not want to run it right now.
        !          4127: 
        !          4128: EOM
        !          4129:     rp="Run make depend now? [$dflt]"
        !          4130:     $echo $n "$rp $c"
        !          4131:     . myread
        !          4132:     case "$ans" in
        !          4133:     y*) make depend
        !          4134:        echo "Now you must run a make."
        !          4135:        ;;
        !          4136:     *)  echo "You must run 'make depend' then 'make'."
        !          4137:        ;;
        !          4138:     esac
        !          4139: elif test -f Makefile; then
        !          4140:     echo " "
        !          4141:     echo "Now you must run a make."
        !          4142: else
        !          4143:     echo "Done."
        !          4144: fi
        !          4145: 
        !          4146: $rm -f kit*isdone
        !          4147: cd UU && $rm -f $rmlist
        !          4148: : end of Configure
        !          4149: fer to run it in background: "make dwarp/smp.7   644    171      5        2620  5121750002   5713 * * *                                                                     * * *
        !          4150: * * * * * * *
        !          4151:       * * * * * * *
        !          4152:             * * * * * *                       * * * * *
        !          4153:                   * * * *                 * * * * * * * * *
        !          4154:                     * * *               * * * *       * * *
        !          4155:                     * * *             * * *               * *
        !          4156:                   * * * *             * *                 * * *
        !          4157:                   * * *               *                   * * *
        !          4158:                 * * *                 *                     * * * *
        !          4159:             * * * *                   *                       * * *
        !          4160:           * * *                       *                         * *
        !          4161:           * *                 * * *   *                         * *
        !          4162:           * *               * * * *   *                       * * *
        !          4163:           * *             * * * * *   *                     * * *
        !          4164:             * *         * *       * * *                     * *
        !          4165:               * * * * * *         * * *                   * * * *
        !          4166:                                                         * * *
        !          4167:                                                         * * *
        !          4168:                                                         * * *
        !          4169:                                                         * * * * *
        !          4170:                                                           * * * * * * * * *
        !          4171:                                                                           * * *
        !          4172: *       * * *                     * *
        !          4173:               * * * * * *         * * *                   * * * *
        !          4174:         warp/move.c   644    171      5       40273  5121750015   6170 /* $Header: move.c,v 7.0.1.2 86/10/20 14:37:06 lwall Exp $ */
        !          4175: 
        !          4176: /* $Log:       move.c,v $
        !          4177:  * Revision 7.0.1.2  86/10/20  14:37:06  lwall
        !          4178:  * Picked some lint.
        !          4179:  * 
        !          4180:  * Revision 7.0.1.1  86/10/16  10:52:09  lwall
        !          4181:  * Added Damage.  Fixed random bugs.
        !          4182:  * 
        !          4183:  * Revision 7.0  86/10/08  15:12:40  lwall
        !          4184:  * Split into separate files.  Added amoebas and pirates.
        !          4185:  * 
        !          4186:  */
        !          4187: 
        !          4188: #include "EXTERN.h"
        !          4189: #include "warp.h"
        !          4190: #include "bang.h"
        !          4191: #include "object.h"
        !          4192: #include "move.h"
        !          4193: #include "play.h"
        !          4194: #include "score.h"
        !          4195: #include "term.h"
        !          4196: #include "them.h"
        !          4197: #include "us.h"
        !          4198: #include "util.h"
        !          4199: #include "weapon.h"
        !          4200: #include "INTERN.h"
        !          4201: #include "move.h"
        !          4202: 
        !          4203: void
        !          4204: move_init()
        !          4205: {
        !          4206:     ;
        !          4207: }
        !          4208: 
        !          4209: void
        !          4210: bounce(obj)
        !          4211: Reg4 OBJECT *obj;
        !          4212: {
        !          4213:     Reg1 int x;
        !          4214:     Reg2 int y;
        !          4215:     Reg3 int count=0;
        !          4216: 
        !          4217:     y = (obj->posy - sgn(obj->vely) + YSIZE00) % YSIZE;
        !          4218:     x = (obj->posx - sgn(obj->velx) + XSIZE00) % XSIZE;
        !          4219:     while (occupant[y][x]) {
        !          4220:        y = (y + rand_mod(3) - 1 + YSIZE00) % YSIZE;
        !          4221:        x = (x + rand_mod(3) - 1 + XSIZE00) % XSIZE;
        !          4222:        if (++count > 10000) {     /* if universe full, get out of it fast */
        !          4223:            unmake_object(obj);
        !          4224:            if (ent) unmake_object(ent);
        !          4225:            if (base) unmake_object(base);
        !          4226:            finish = 1;
        !          4227:            return;
        !          4228:        }
        !          4229:     }
        !          4230:     obj->posy = y;
        !          4231:     obj->posx = x;
        !          4232:     obj->vely = 0;
        !          4233:     obj->velx = 0;
        !          4234:     occupant[y][x] = obj;
        !          4235:     if (numamoebas && obj->image == ' ')
        !          4236:        mvaddc(y+1, x*2, amb[y][x]);
        !          4237:     else
        !          4238:        mvaddc(y+1, x*2, obj->image);
        !          4239: }
        !          4240: 
        !          4241: void
        !          4242: move_universe()
        !          4243: {
        !          4244:     Reg1 OBJECT *curobj;
        !          4245:     Reg2 int x;
        !          4246:     Reg3 int y;
        !          4247:     Reg4 OBJECT *temp;
        !          4248:     OBJECT *thenext;
        !          4249: 
        !          4250:     for (curobj = movers; curobj != &root; curobj = curobj->next) {
        !          4251:        x = curobj->posx;
        !          4252:        y = curobj->posy;
        !          4253:        if (curobj == occupant[y][x]) {
        !          4254:            occupant[y][x] = 0;
        !          4255:        }
        !          4256:        else if (curobj->type != Torp && curobj->type != Web) {
        !          4257:            resetty();
        !          4258:            abort();
        !          4259:        }
        !          4260:     }
        !          4261:     for (curobj = movers; curobj != &root; curobj = thenext) {
        !          4262:        thenext = curobj->next;
        !          4263:        if (curobj->vely || curobj->velx) {
        !          4264:            y = curobj->posy;
        !          4265:            x = curobj->posx;
        !          4266:            if (curobj->image != ' ' &&
        !          4267:              (!(temp=occupant[y][x]) || temp->image==' ') ) {
        !          4268:                move(y+1, x*2, numamoebas ? amb[y][x] : ' ');
        !          4269:            }
        !          4270:            y = (y + curobj->vely + YSIZE00) % YSIZE;
        !          4271:            x = (x + curobj->velx + XSIZE00) % XSIZE;
        !          4272:            if (!(temp=occupant[y][x]) || temp->type != Star ||
        !          4273:              curobj->type != Torp || curobj->image == '+' ||
        !          4274:              curobj->image == 'x') {
        !          4275:                curobj->posy = y;
        !          4276:                curobj->posx = x;
        !          4277:            }
        !          4278:            else {
        !          4279:                if (curobj->image == '0') {
        !          4280:                    curobj->vely = rand_mod(3)-1;
        !          4281:                    curobj->velx = rand_mod(3)-1;
        !          4282:                }
        !          4283:                else
        !          4284:                    curobj->vely = curobj->velx = 0;
        !          4285:                y = curobj->posy;
        !          4286:                x = curobj->posx;
        !          4287:            }
        !          4288:        }
        !          4289:        else {                  /* not moving */
        !          4290:            y = curobj->posy;
        !          4291:            x = curobj->posx;
        !          4292:            if (curobj->type == Torp ||
        !          4293:                curobj->type == Star ||
        !          4294:                curobj->type == Web) {
        !          4295:                curobj->flags |= STATIC;
        !          4296:                curobj->next->prev = curobj->prev;
        !          4297:                curobj->prev->next = curobj->next;
        !          4298:                curobj->prev = movers->prev;
        !          4299:                curobj->next = movers;
        !          4300:                movers->prev->next = curobj;
        !          4301:                movers->prev = curobj;
        !          4302:            }
        !          4303:        }
        !          4304:        if (temp = occupant[y][x]) {            /* already occupied? */
        !          4305:            if (!temp->contend) {
        !          4306:                if (temp->type == Torp) {
        !          4307:                    if (temp->image == '+')
        !          4308:                        blast[y][x] += 1250;
        !          4309:                    else if (temp->image == 'o' && (base||ent))
        !          4310:                        blast[y][x] += 500+super*20;
        !          4311:                    else if (temp->image == 'O' && (base||ent))
        !          4312:                        blast[y][x] += 5000+super*100;
        !          4313:                }
        !          4314:            }
        !          4315:            yblasted[y] |= 1;
        !          4316:            xblasted[x] |= 1;
        !          4317:            blasted = TRUE;
        !          4318:            curobj->contend = temp;
        !          4319:            occupant[y][x] = curobj;
        !          4320:            switch (curobj->type) {
        !          4321:            case Enemy:
        !          4322:                if (numamoebas && curobj == nuke && temp->image == '+')
        !          4323:                    blast[y][x] += 80000;
        !          4324:                else if (temp->type == Enemy)
        !          4325:                    blast[y][x] += 10;
        !          4326:                else
        !          4327:                    goto defblast;
        !          4328:                break;
        !          4329:            case Crusher:
        !          4330:                if (curobj->velx)
        !          4331:                    blast[y][x] += 100000;
        !          4332:                else
        !          4333:                    goto defblast;
        !          4334:                break;
        !          4335:            case Torp:
        !          4336:                if (curobj->image == '+')
        !          4337:                    blast[y][x] += (temp==nuke ? 80000 : 1250);
        !          4338:                else if (curobj->image == 'o')
        !          4339:                    blast[y][x] += 500+super*20;
        !          4340:                else if (curobj->image == 'O')
        !          4341:                    blast[y][x] += 5000+super*100;
        !          4342:                goto defblast;
        !          4343:            case Star:
        !          4344:                if (temp == ent)
        !          4345:                    goto damshield;
        !          4346:                goto defblast;
        !          4347:            case Enterprise:
        !          4348:                if (temp->type == Star) {
        !          4349:              damshield:
        !          4350:                    if (!rand_mod(10)) {
        !          4351:                        if (!damflag[NOSHIELDS])
        !          4352:                            damage++;
        !          4353:                        if (damflag[NOSHIELDS] < 100)
        !          4354:                            damflag[NOSHIELDS] += rand_mod(smarts)/5+2;
        !          4355:                    }
        !          4356:                }
        !          4357:                goto defblast;
        !          4358:            default:
        !          4359:              defblast:
        !          4360:                blast[y][x] += rand_mod(751)+1;
        !          4361:                break;
        !          4362:            }
        !          4363:        }
        !          4364:        else {
        !          4365:            occupant[y][x] = curobj;
        !          4366:            if (curobj->image != ' ' &&
        !          4367:                (curobj->velx || curobj->vely ||
        !          4368:                 curobj->type == Torp || curobj->type == Web) ) {
        !          4369:                mvaddc(y+1, x*2, curobj->image);
        !          4370:            }
        !          4371:            if (curobj->type == Crusher && curobj->velx) {
        !          4372:                blast[y][x] += 100000;
        !          4373:                yblasted[y] |= 1;
        !          4374:                xblasted[x] |= 1;
        !          4375:                blasted = TRUE;
        !          4376:            }
        !          4377:        }
        !          4378:     }
        !          4379:     if (blasted) {
        !          4380:        Reg7 int minxblast = -1;
        !          4381:        Reg8 int maxxblast = -2;
        !          4382:        Reg5 long tmpblast;
        !          4383: 
        !          4384:        blasted = numamoebas;
        !          4385:        for (x=0; x<XSIZE; x++) {
        !          4386:            if (xblasted[x]) {
        !          4387:                xblasted[x] = 0;
        !          4388:                maxxblast = x;
        !          4389:                if (minxblast < 0)
        !          4390:                    minxblast = x;
        !          4391:            }
        !          4392:        }
        !          4393:        for (y=0; y<YSIZE; y++) {
        !          4394:            if (yblasted[y]) {
        !          4395:                yblasted[y] = 0;
        !          4396:                for (x=minxblast; x<=maxxblast; x++) {
        !          4397:                    tmpblast = blast[y][x];
        !          4398:                    if (numamoebas && amb[y][x] == '~') {
        !          4399:                        if (temp = occupant[y][x]) {
        !          4400:                            if (temp->image == '&')
        !          4401:                                tmpblast >>= 1;
        !          4402:                            else if (temp->type == Web)
        !          4403:                                tmpblast = 100000;
        !          4404:                            else
        !          4405:                                tmpblast += 50 + temp->energy/100;
        !          4406:                            if (tmpblast > 250 && !rand_mod(5+(inumstars>>4)))
        !          4407:                                modify_amoeba(y,x,1,'~',5);
        !          4408:                        }
        !          4409:                        xblasted[x] = 2;
        !          4410:                        yblasted[y] = 2;
        !          4411:                    }
        !          4412:                    if (tmpblast) {
        !          4413:                        Reg6 OBJECT *biggie = 0;
        !          4414: 
        !          4415:                        blast[y][x] = 0;
        !          4416:                        temp = occupant[y][x];
        !          4417:                        if (tmpblast < 0) {
        !          4418:                            if (numamoebas && tmpblast < -1000000 &&
        !          4419:                                amb[y][x] == '~' && temp != nuke) {
        !          4420:                                amb[y][x] = ' ';
        !          4421:                                if (!temp)
        !          4422:                                    make_plink(y,x);
        !          4423:                                ambsize--;
        !          4424:                            }
        !          4425:                            tmpblast = 0;
        !          4426:                        }
        !          4427:                        if (temp) {
        !          4428:                            if ((!numamoebas || amb[y][x]==' ') &&
        !          4429:                              tmpblast < 100000)
        !          4430:                                make_plink(y,x);
        !          4431:                            for ( ;temp;
        !          4432:                              temp = curobj->contend,curobj->contend = 0){
        !          4433:                                curobj = temp;
        !          4434:                                switch (curobj->type) {
        !          4435:                                case Enterprise: {
        !          4436:                                    long tmp = curobj->energy;
        !          4437: 
        !          4438:                                    if (ent->energy>500 || apolloflag & 1)
        !          4439:                                        curobj->energy -= tmpblast /
        !          4440:                                           ((apolloflag & 1)
        !          4441:                                            ? 20
        !          4442:                                            : (5+abs(ent->velx)+abs(ent->vely))
        !          4443:                                               / ((damflag[NOSHIELDS]>>3)+1)+1);
        !          4444:                                    else
        !          4445:                                        curobj->energy -= tmpblast;
        !          4446:                                    if (rand_mod(1 + tmp - curobj->energy) > 100
        !          4447:                                        || ent->energy < (entmax>>1)) {
        !          4448:                                        if (debug & 128 ||
        !          4449:                                          (damage <= smarts/10 &&
        !          4450:                                           !rand_mod(6-smarts/20-massacre) )) {
        !          4451:                                            tmp = rand_mod(MAXDAMAGE);
        !          4452:                                            if (damflag[tmp]) {
        !          4453:                                                if (damflag[tmp] < 60)
        !          4454:                                                  damflag[tmp] += rand_mod(60);
        !          4455:                                            }
        !          4456:                                            else {
        !          4457:                                                damflag[tmp] =
        !          4458:                                                  rand_mod(smarts+10)+2;
        !          4459:                                                damage++;
        !          4460:                                            }
        !          4461:                                        }
        !          4462:                                    }
        !          4463:                                    break;
        !          4464:                                }
        !          4465:                                case Base:
        !          4466:                                    if (base->energy > 1000 || apolloflag & 2)
        !          4467:                                        curobj->energy -= tmpblast /
        !          4468:                                           ((apolloflag & 2)?20:5);
        !          4469:                                    else
        !          4470:                                        curobj->energy -= tmpblast;
        !          4471:                                    break;
        !          4472:                                case Crusher:
        !          4473:                                    if (tmpblast > 132767)
        !          4474:                                        curobj->energy -= (tmpblast - 100000);
        !          4475:                                    else if (tmpblast >= 100000) {
        !          4476:                                        curobj->energy += (tmpblast - 100000);
        !          4477:                                        if (curobj->energy > 32767)
        !          4478:                                            curobj->energy = 32767;
        !          4479:                                    }
        !          4480:                                    else        /* vulnerable while feeding */
        !          4481:                                        curobj->energy -= tmpblast;
        !          4482:                                    break;
        !          4483:                                case Enemy:
        !          4484:                                    curobj->energy -= tmpblast*10/enemshields;
        !          4485:                                    break;
        !          4486:                                default:
        !          4487:                                    curobj->energy -= tmpblast;
        !          4488:                                    break;
        !          4489:                                }
        !          4490:                                if (curobj->energy < 0) {       /* killed it? */
        !          4491:                                    switch (curobj->image) {
        !          4492:                                    case 'A':
        !          4493:                                        tmpblast = 100000;
        !          4494:                                        make_blast(y,x,8192L,1);
        !          4495:                                        numapollos = apolloflag = 0;
        !          4496:                                        numstars--;
        !          4497:                                        numenemies--;
        !          4498:                                        curscore += 5000;
        !          4499:                                        deados = 0;
        !          4500:                                        break;
        !          4501:                                    case 'E': case 'e': case 'C': case 'c':
        !          4502:                                        ent = 0;
        !          4503:                                        numents--;
        !          4504:                                        if (base)
        !          4505:                                            status = 2;
        !          4506:                                        else
        !          4507:                                            status = 3;
        !          4508:                                        deados = 0;
        !          4509:                                        break;
        !          4510:                                    case 'B': case 'b':
        !          4511:                                        base = 0;
        !          4512:                                        numbases--;
        !          4513:                                        if (ent)
        !          4514:                                            status = entmode;
        !          4515:                                        else
        !          4516:                                            status = 3;
        !          4517:                                        deados = 0;
        !          4518:                                        break;
        !          4519:                                    case '&': {
        !          4520:                                        int i, xxx, yyy;
        !          4521: 
        !          4522:                                        for (i = 0; i < YSIZE; i++)
        !          4523:                                            yblasted[i] &= 1;
        !          4524:                                        for (i = 0; i < XSIZE; i++)
        !          4525:                                            xblasted[i] &= 1;
        !          4526:                                        numamoebas = 0; /* ignore amb[][] now */
        !          4527:                                        for (yyy = 0; yyy < YSIZE; yyy++) {
        !          4528:                                            for (xxx = 0; xxx < XSIZE; xxx++) {
        !          4529:                                                if (amb[yyy][xxx] == '~' &&
        !          4530:                                                    !occupant[yyy][xxx]) {
        !          4531:                                                    mvaddch(yyy+1,xxx*2,' ');
        !          4532:                                                }
        !          4533:                                            }
        !          4534:                                        }
        !          4535:                                        numenemies--;
        !          4536:                                        curscore += 10000;
        !          4537:                                        if (curobj == enemies)
        !          4538:                                            enemies = curobj->next;
        !          4539:                                        deados = 0;
        !          4540:                                        break;
        !          4541:                                    }
        !          4542:                                    case '<': case '>': {
        !          4543:                                        int i;
        !          4544: 
        !          4545:                                        numenemies--;
        !          4546:                                        numcrushes = 0;
        !          4547:                                        curscore += 10000;
        !          4548:                                        if (curobj == movers)
        !          4549:                                            movers = curobj->next;
        !          4550:                                        if (curobj == enemies)
        !          4551:                                            enemies = curobj->next;
        !          4552:                                        deados = 0;
        !          4553: 
        !          4554:                                        tmpblast = 100000;
        !          4555:                                        make_blast(y,(x+XSIZE00)%XSIZE,10000L,0);
        !          4556:                                        if (curobj->image == '<') {
        !          4557:                                            for (i=XSIZE00; i<=XSIZE01; i++)
        !          4558:                                                make_blast(y,(x+i)%XSIZE,
        !          4559:                                                    10000L,0);
        !          4560:                                            for (i=XSIZE00; i<=XSIZE02; i++)
        !          4561:                                                make_blast(y,(x+i)%XSIZE,
        !          4562:                                                    10000L,0);
        !          4563:                                            make_blast(y,(x+XSIZE03)%XSIZE,
        !          4564:                                                10000L,1);
        !          4565:                                            for (i=XSIZE00; i<=XSIZE08; i++)
        !          4566:                                                make_blast(y,(x+i)%XSIZE,
        !          4567:                                                    10000L,0);
        !          4568:                                        }
        !          4569:                                        else {
        !          4570:                                            for (i=XSIZE00; i>=XSIZE99; i--)
        !          4571:                                                make_blast(y,(x+i)%XSIZE,
        !          4572:                                                    10000L,0);
        !          4573:                                            for (i=XSIZE00; i>=XSIZE98; i--)
        !          4574:                                                make_blast(y,(x+i)%XSIZE,
        !          4575:                                                    10000L,0);
        !          4576:                                            make_blast(y,(x+XSIZE97)%XSIZE,
        !          4577:                                                10000L,1);
        !          4578:                                            for (i=XSIZE00; i>=XSIZE92; i--)
        !          4579:                                                make_blast(y,(x+i)%XSIZE,
        !          4580:                                                    10000L,0);
        !          4581:                                        }
        !          4582:                                    }
        !          4583:                                    break;
        !          4584:                                    case 'K':
        !          4585:                                        numenemies--;
        !          4586:                                        curscore += curobj->mass;
        !          4587:                                        if (curobj == enemies)
        !          4588:                                            enemies = curobj->next;
        !          4589:                                        deados = 0;
        !          4590:                                        break;
        !          4591:                                    case 'T':
        !          4592:                                        numenemies--;
        !          4593:                                        curscore += curobj->mass*3/2;
        !          4594:                                        if (curobj == enemies)
        !          4595:                                            enemies = curobj->next;
        !          4596:                                        deados = 0;
        !          4597:                                        break;
        !          4598:                                    case 'R': case ' ': case 'P':
        !          4599:                                        numenemies--;
        !          4600:                                        if (curobj->flags & PIRATE)
        !          4601:                                            curscore += curobj->mass;
        !          4602:                                        else
        !          4603:                                            curscore += curobj->mass*3;
        !          4604:                                        if (curobj == enemies)
        !          4605:                                            enemies = curobj->next;
        !          4606:                                        deados = 0;
        !          4607:                                        break;
        !          4608:                                    case 'G':
        !          4609:                                        numenemies--;
        !          4610:                                        numgorns--;
        !          4611:                                        tmpblast = 100000;
        !          4612:                                        if (madgorns)
        !          4613:                                            curscore += curobj->mass/2;
        !          4614:                                        else
        !          4615:                                            curscore += curobj->mass*2;
        !          4616:                                        if (curobj == enemies)
        !          4617:                                            enemies = curobj->next;
        !          4618:                                        {
        !          4619:                                            int xxx,yyy;
        !          4620: 
        !          4621:                                            for (xxx = -1; xxx<=1; xxx++)
        !          4622:                                                for (yyy = -1; yyy<=1; yyy++)
        !          4623:                                                    if (rand_mod(2+massacre))
        !          4624:                                                        fire_torp(curobj,
        !          4625:                                                            yyy,xxx);
        !          4626:                                        }
        !          4627:                                        deados = 0;
        !          4628:                                        break;
        !          4629:                                    case '@':
        !          4630:                                        numinhab--;
        !          4631:                                        /* FALL THROUGH */
        !          4632:                                    case '*':
        !          4633:                                        banging = TRUE;
        !          4634:                                        numstars--;
        !          4635:                                        break;
        !          4636:                                    case '|': case '-': case '/': case '\\':
        !          4637:                                        tmpblast = 100000;
        !          4638:                                        make_blast(y,x,curobj->mass,1);
        !          4639:                                        banging = TRUE;
        !          4640:                                        deados = 0;
        !          4641:                                        break;
        !          4642:                                    case 'x':
        !          4643:                                        curscore += 10;
        !          4644:                                        deados = 0;
        !          4645:                                        break;
        !          4646:                                    case 'X':
        !          4647:                                        curscore += 100;
        !          4648:                                        numxes--;
        !          4649:                                        deados = 0;
        !          4650:                                        break;
        !          4651:                                    case '0':
        !          4652:                                        curscore += 35;
        !          4653:                                        numos--;
        !          4654:                                        deados += 3;
        !          4655:                                        break;
        !          4656:                                    case 'o':
        !          4657:                                        curscore += 100;
        !          4658:                                        numos--;
        !          4659:                                        deados++;
        !          4660:                                        break;
        !          4661:                                    case 'O':
        !          4662:                                        curscore += 200;
        !          4663:                                        numos--;
        !          4664:                                        deados += 2;
        !          4665:                                        break;
        !          4666:                                    case 'M':
        !          4667:                                        deadmudds++;
        !          4668:                                        inumfriends--;
        !          4669:                                        numfriends--;
        !          4670:                                        if (curobj == enemies)
        !          4671:                                            enemies = curobj->next;
        !          4672:                                        break;
        !          4673:                                    case 'Q': case 'W': case 'Y': case 'U':
        !          4674:                                    case 'I': case 'S': case 'D': case 'H':
        !          4675:                                    case 'J': case 'L': case 'Z': case 'V':
        !          4676:                                    case 'F':
        !          4677:                                        numfriends--;
        !          4678:                                        if (curobj == enemies)
        !          4679:                                            enemies = curobj->next;
        !          4680:                                        if (inumfriends < 10)
        !          4681:                                            madfriends += 500;
        !          4682:                                        else
        !          4683:                                            madfriends += 10000/inumfriends;
        !          4684:                                        break;
        !          4685:                                    }
        !          4686:                                    if (tmpblast < 100000)
        !          4687:                                        make_blast(y,x,curobj->mass,1);
        !          4688:                                    unmake_object(curobj);
        !          4689:                                }
        !          4690:                                else {          /* didn't kill anything */
        !          4691:                                    if (!biggie)
        !          4692:                                        biggie = curobj;
        !          4693:                                    else {
        !          4694:                                        if (biggie->mass > curobj->mass)
        !          4695:                                            bounce(curobj);
        !          4696:                                        else {
        !          4697:                                            bounce(biggie);
        !          4698:                                            biggie = curobj;
        !          4699:                                        }
        !          4700:                                    }
        !          4701:                                }
        !          4702:                            }
        !          4703:                            if (biggie) {
        !          4704:                                occupant[y][x] = biggie;
        !          4705:                                if (numamoebas && biggie->image == ' ')
        !          4706:                                    mvaddch(y+1,x*2, amb[y][x]);
        !          4707:                                else
        !          4708:                                    mvaddch(y+1,x*2, biggie->image);
        !          4709:                            }
        !          4710:                            else {
        !          4711:                                occupant[y][x] = 0;
        !          4712:                                mvaddch(y+1, x*2, numamoebas ? amb[y][x] : ' ');
        !          4713:                            }
        !          4714:                        }
        !          4715:                    }
        !          4716:                }
        !          4717:            }
        !          4718:        }
        !          4719:     }
        !          4720:     do_bangs();
        !          4721:     if (numcrushes && movers->type == Crusher)
        !          4722:        movers->vely = 0;
        !          4723:     if (curobj = base) {
        !          4724:        char ch;
        !          4725: 
        !          4726:        curobj->velx = 0;
        !          4727:        curobj->vely = 0;
        !          4728:        curobj->energy += 25*lookaround(curobj->posy,curobj->posx,Star);
        !          4729:        if (curobj->energy > basemax)
        !          4730:            curobj->energy = basemax;
        !          4731:        if (curobj->energy >= 1000)
        !          4732:            ch = 'B';
        !          4733:        else
        !          4734:            ch = 'b';
        !          4735:        if (ch != curobj->image) {
        !          4736:            setimage(curobj, ch);
        !          4737:        }
        !          4738:     }
        !          4739:     if (curobj = ent) {
        !          4740:        char ch;
        !          4741: 
        !          4742:        if (entmode == 0) {
        !          4743:            curobj->velx = 0;
        !          4744:            curobj->vely = 0;
        !          4745:        }
        !          4746:        if (base && !cloaking && !curobj->velx && !curobj->vely &&
        !          4747:          lookfor(curobj->posy,curobj->posx,Base)) {
        !          4748:            int tmp;
        !          4749: 
        !          4750: #ifdef lint
        !          4751:            tmp = 0;
        !          4752: #else
        !          4753:            tmp = (int) (base->energy - 1000 < entmax - curobj->energy ?
        !          4754:                         base->energy - 1000 : entmax - curobj->energy);
        !          4755: #endif
        !          4756:            if (tmp < 0)
        !          4757:                tmp = 0;
        !          4758:            curobj->energy += tmp;
        !          4759:            base->energy -= tmp;
        !          4760:            tmp = (btorp < 50 - etorp ?
        !          4761:                   btorp : 50 - etorp);
        !          4762:            etorp += tmp;
        !          4763:            btorp -= tmp;
        !          4764:            if (damage) {
        !          4765:                tmp = rand_mod(MAXDAMAGE);
        !          4766:                if (damflag[tmp] > 5) {
        !          4767:                    damflag[tmp] = rand_mod(5)+1;
        !          4768:                }
        !          4769:            }
        !          4770:        }
        !          4771:        if (curobj->energy >= 500 && (!damage || !damflag[NOSHIELDS]))
        !          4772:            ch = cloaked?'C':'E';
        !          4773:        else
        !          4774:            ch = cloaked?'c':'e';
        !          4775:        if (ch != curobj->image) {
        !          4776:            setimage(curobj, ch);
        !          4777:        }
        !          4778:     }
        !          4779: }
        !          4780: 
        !          4781: int
        !          4782: lookaround(y, x, what)
        !          4783: Reg1 int y;
        !          4784: Reg2 int x;
        !          4785: Reg4 char what;
        !          4786: {
        !          4787:     Reg3 OBJECT *obj;
        !          4788:     Reg5 int count=0;
        !          4789:     Reg6 int xp;
        !          4790:     Reg7 int xm;
        !          4791: 
        !          4792:     if ((obj=occupant[y][xp=(x+XSIZE01)%XSIZE])&&obj->type == what) /* 0, 1 */
        !          4793:        count++;
        !          4794:     if ((obj=occupant[y][xm=(x+XSIZE99)%XSIZE])&&obj->type == what) /* 0, -1 */
        !          4795:        count++;
        !          4796:     if ((obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->type == what) /* -1, 1 */
        !          4797:        count++;
        !          4798:     if ((obj=occupant[y][x])&&obj->type == what)                    /* -1, 0 */
        !          4799:        count++;
        !          4800:     if ((obj=occupant[y][xm])&&obj->type == what)                   /* -1, -1 */
        !          4801:        count++;
        !          4802:     if ((obj=occupant[y=(y+2)%YSIZE][xp])&&obj->type == what)       /* 1, 1 */
        !          4803:        count++;
        !          4804:     if ((obj=occupant[y][x])&&obj->type == what)                    /* 1, 0 */
        !          4805:        count++;
        !          4806:     if ((obj=occupant[y][xm])&&obj->type == what)                   /* 1, -1 */
        !          4807:        count++;
        !          4808:     return (count);
        !          4809: }
        !          4810: 
        !          4811: int
        !          4812: lookfor(y, x, what)
        !          4813: Reg1 int y;
        !          4814: Reg2 int x;
        !          4815: Reg4 char what;
        !          4816: {
        !          4817:     Reg3 OBJECT *obj;
        !          4818:     Reg5 int xp;
        !          4819:     Reg6 int xm;
        !          4820: 
        !          4821:     if ((obj=occupant[y][xp=(x+XSIZE01)%XSIZE])&&obj->type == what ||/* 0, 1 */
        !          4822:         (obj=occupant[y][xm=(x+XSIZE99)%XSIZE])&&obj->type == what ||/* 0, -1 */
        !          4823:         (obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->type == what ||/* -1, 1 */
        !          4824:         (obj=occupant[y][x])&&obj->type == what                    ||/* -1, 0 */
        !          4825:         (obj=occupant[y][xm])&&obj->type == what                   ||/* -1,-1 */
        !          4826:         (obj=occupant[y=(y+2)%YSIZE][xp])&&obj->type == what       ||/* 1, 1 */
        !          4827:         (obj=occupant[y][x])&&obj->type == what                    ||/* 1, 0 */
        !          4828:         (obj=occupant[y][xm])&&obj->type == what)                    /* 1, -1 */
        !          4829:        return(1);
        !          4830:     return (0);
        !          4831: }
        !          4832: 
        !          4833: OBJECT*
        !          4834: lookimg(y, x, what)
        !          4835: Reg1 int y;
        !          4836: Reg2 int x;
        !          4837: Reg4 char what;
        !          4838: {
        !          4839:     Reg3 OBJECT *obj;
        !          4840:     Reg5 int xp;
        !          4841:     Reg6 int xm;
        !          4842: 
        !          4843:     if ((obj=occupant[y][xp=(x+XSIZE01)%XSIZE])&&obj->image==what ||/* 0, 1 */
        !          4844:         (obj=occupant[y][xm=(x+XSIZE99)%XSIZE])&&obj->image==what ||/* 0, -1 */
        !          4845:         (obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->image==what ||/* -1, 1 */
        !          4846:         (obj=occupant[y][x])&&obj->image==what                    ||/* -1, 0 */
        !          4847:         (obj=occupant[y][xm])&&obj->image==what                   ||/* -1,-1 */
        !          4848:         (obj=occupant[y=(y+2)%YSIZE][xp])&&obj->image==what       ||/* 1, 1 */
        !          4849:         (obj=occupant[y][x])&&obj->image==what                    ||/* 1, 0 */
        !          4850:         (obj=occupant[y][xm])&&obj->image==what)                    /* 1, -1 */
        !          4851:        return obj;
        !          4852:     return Null(OBJECT*);
        !          4853: }
        !          4854:  (obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->image==what ||/* -1, 1 */
        !          4855:         (obj=occupant[y][x])&&obj->image==what                    ||/* -1, 0 */
        !          4856:         (obj=occupant[y][xm])&&obj->image==what                   ||/* -1,-1 */
        !          4857:         (obj=occupant[y=(y+2)%YSIZE][xp])&&obj->image==what       ||/* 1, 1 */
        !          4858:         (obj=warp/weapon.c   644    171      5       40211  5121750024   6503 /* $Header: weapon.c,v 7.0.1.2 86/10/20 14:36:33 lwall Exp $ */
        !          4859: 
        !          4860: /* $Log:       weapon.c,v $
        !          4861:  * Revision 7.0.1.2  86/10/20  14:36:33  lwall
        !          4862:  * Picked some lint.
        !          4863:  * 
        !          4864:  * Revision 7.0.1.1  86/10/16  10:54:42  lwall
        !          4865:  * Added Damage.  Fixed random bugs.
        !          4866:  * 
        !          4867:  * Revision 7.0  86/10/08  15:18:08  lwall
        !          4868:  * Split into separate files.  Added amoebas and pirates.
        !          4869:  * 
        !          4870:  */
        !          4871: 
        !          4872: #include "EXTERN.h"
        !          4873: #include "warp.h"
        !          4874: #include "bang.h"
        !          4875: #include "object.h"
        !          4876: #include "move.h"
        !          4877: #include "score.h"
        !          4878: #include "sig.h"
        !          4879: #include "term.h"
        !          4880: #include "them.h"
        !          4881: #include "us.h"
        !          4882: #include "util.h"
        !          4883: #include "INTERN.h"
        !          4884: #include "weapon.h"
        !          4885: 
        !          4886: void
        !          4887: weapon_init()
        !          4888: {
        !          4889:     ;
        !          4890: }
        !          4891: 
        !          4892: void
        !          4893: fire_torp(from, ydir, xdir)
        !          4894: Reg1 OBJECT *from;
        !          4895: Reg3 int ydir;
        !          4896: Reg4 int xdir;
        !          4897: {
        !          4898:     Reg2 OBJECT *to;
        !          4899: 
        !          4900:     if (from->type == Enemy ||
        !          4901:        (from == ent && etorp > 0) ||
        !          4902:        (from == base && btorp > 0)) {
        !          4903:        to = occupant[(from->posy+from->vely+ydir+YSIZE00)%YSIZE]
        !          4904:                     [(from->posx+from->velx+xdir+XSIZE00)%XSIZE];
        !          4905:        if (from->type != Enemy || !to || to->vely || to->velx) {
        !          4906:            if (from->type != Enemy &&
        !          4907:                 (to = isatorp[from==base][ydir+1][xdir+1])) {
        !          4908:                to->vely += ydir;
        !          4909:                to->velx += xdir;
        !          4910:            }
        !          4911:            else {
        !          4912:                if (from == ent) {
        !          4913:                    to = make_object(Torp, '+', from->posy,from->posx,
        !          4914:                        from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
        !          4915:                    aretorps++;
        !          4916:                    isatorp[0][ydir+1][xdir+1] = to;
        !          4917:                    etorp--;
        !          4918:                }
        !          4919:                else if (from == base) {
        !          4920:                    to = make_object(Torp, '+', from->posy,from->posx,
        !          4921:                        from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
        !          4922:                    aretorps++;
        !          4923:                    isatorp[1][ydir+1][xdir+1] = to;
        !          4924:                    btorp--;
        !          4925:                }
        !          4926:                else if (from->image == 'G') {
        !          4927:                    numos++;
        !          4928:                    to = make_object(Torp, 'o', from->posy,from->posx,
        !          4929:                        from->vely+ydir,from->velx+xdir, 100L, 1L,&root);
        !          4930:                    if (madgorns) {
        !          4931:                        possiblescore += 35;
        !          4932:                        to->image = '0';
        !          4933:                        to->mass = 2000;
        !          4934:                        to->energy = 2000;
        !          4935:                    }
        !          4936:                    else if (rand_mod(120)+10 > smarts)
        !          4937:                        possiblescore += 100;
        !          4938:                    else {
        !          4939:                        possiblescore += 200;
        !          4940:                        to->image = 'O';
        !          4941:                    }
        !          4942:                }
        !          4943:                else {
        !          4944:                    to = make_object(Torp, 'x', from->posy,from->posx,
        !          4945:                        from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
        !          4946:                    if (rand_mod(160)+10 > smarts)
        !          4947:                        possiblescore += 10;
        !          4948:                    else {
        !          4949:                        possiblescore += 100;
        !          4950:                        to->image = 'X';
        !          4951:                        to->mass = 1000+super*20;
        !          4952:                        numxes++;
        !          4953:                    }
        !          4954:                }
        !          4955:            }
        !          4956:        }
        !          4957:     }
        !          4958: }
        !          4959: 
        !          4960: void
        !          4961: attack(attackee)
        !          4962: Reg7 OBJECT *attackee;
        !          4963: {
        !          4964:     Reg1 int dx;
        !          4965:     Reg2 int dy;
        !          4966:     Reg3 int curx;
        !          4967:     Reg4 int cury;
        !          4968:     Reg5 int prob;
        !          4969:     Reg6 OBJECT *obj;
        !          4970:     Reg8 bool torps;
        !          4971:     Reg9 bool webnear = FALSE;
        !          4972:     Reg10 bool thru_stars;
        !          4973:     int nukey;
        !          4974:     int nukex;
        !          4975:     int nukedist;
        !          4976: 
        !          4977:     if (attackee) {
        !          4978:        if (attackee == nuke) {
        !          4979:            if (amb[attackee->posy][attackee->posx] != '~')
        !          4980:                return;
        !          4981:            nukey = nukex = 0;
        !          4982:            nukedist = 100;
        !          4983:        }
        !          4984:        for (dx= -1; dx<=1 ; dx++) {
        !          4985:            for (dy= -1; dy<=1; dy++) {
        !          4986:                if (dx||dy) {
        !          4987:                    cury = attackee->posy;
        !          4988:                    curx = attackee->posx;
        !          4989:                    torps = thru_stars = FALSE;
        !          4990:                    if (massacre || madgorns || !rand_mod(53-super) )
        !          4991:                        webnear += rand_mod(2);
        !          4992:                    else
        !          4993:                        webnear = FALSE;
        !          4994:                    for (prob = scandist;prob;prob--) {
        !          4995:                        cury = (cury + dy + YSIZE00) % YSIZE;
        !          4996:                        curx = (curx + dx + XSIZE00) % XSIZE;
        !          4997:                        if (obj = occupant[cury][curx]) {
        !          4998:                            switch (obj->image) {
        !          4999:                            case 'P': case 'K': case 'R': case ' ':
        !          5000:                pot_shot:
        !          5001:                                if (attackee == nuke) {
        !          5002:                                    if (rand_mod(2+scandist-prob) <
        !          5003:                                      rand_mod(smarts/40+1))
        !          5004:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5005:                                }
        !          5006:                                if (rand_mod(51 - sm50) <= prob) {
        !          5007:                                    switch (obj->strategy||thru_stars?0:
        !          5008:                                          rand_mod(ent?4:2)) {
        !          5009:                                    case 1: case 2:
        !          5010:                                        if (-dy + attackee->vely == obj->vely
        !          5011:                                         && -dx + attackee->velx == obj->velx)
        !          5012:                                            fire_torp(obj,
        !          5013:                                             -dy + attackee->vely,
        !          5014:                                             -dx + attackee->velx);
        !          5015:                                        else
        !          5016:                                            fire_torp(obj,
        !          5017:                                             -dy + attackee->vely - obj->vely,
        !          5018:                                             -dx + attackee->velx - obj->velx);
        !          5019:                                        if (obj->image == ' ')
        !          5020:                                            setimage(obj,
        !          5021:                                              obj->flags & PIRATE ? 'P' : 'R');
        !          5022:                                        break;
        !          5023:                                    case 3: {
        !          5024:                                        int newspeed =
        !          5025:                                            rand_mod(prob<5&&smarts>70?4:3)-1;
        !          5026:                                        
        !          5027:                                        obj->vely = -dy * newspeed;
        !          5028:                                        obj->velx = -dx * newspeed;
        !          5029:                                        if (newspeed >= 0 &&
        !          5030:                                            !rand_mod(82-sm80)) {
        !          5031:                                            obj->vely += attackee->vely;
        !          5032:                                            obj->velx += attackee->velx;
        !          5033:                                        }
        !          5034:                                        break;
        !          5035:                                    }
        !          5036:                                    case 0:
        !          5037:                                        if (!torps && obj->energy > 1000) {
        !          5038:                                            fire_phaser(obj, -dy, -dx);
        !          5039:                                            if (smarts > 40 &&
        !          5040:                                               (scandist-prob > 5
        !          5041:                                                || attackee==base) &&
        !          5042:                                               (massacre || obj->strategy ||
        !          5043:                                                rand_mod(2)))
        !          5044:                                                while (rand_mod(2))
        !          5045:                                                    fire_phaser(obj, -dy, -dx);
        !          5046:                                            if (obj->image == ' ')
        !          5047:                                                setimage(obj,
        !          5048:                                                  obj->flags&PIRATE ? 'P':'R');
        !          5049:                                        }
        !          5050:                                        if (obj->strategy) {
        !          5051:                                            obj->velx = obj->vely = 0;
        !          5052:                                            if (obj->energy < 1000 ||
        !          5053:                                                  bvely || bvelx)
        !          5054:                                                obj->strategy = 0;
        !          5055:                                        }
        !          5056:                                        else if ((attackee==base ||
        !          5057:                                                  (cloaking && attackee==ent)
        !          5058:                                                 ) &&
        !          5059:                                                 scandist-prob > 5 &&
        !          5060:                                                 !(rand_mod(
        !          5061:                                                   ent?antibase*2:antibase)) )
        !          5062:                                            obj->strategy = 1;
        !          5063:                                        break;
        !          5064:                                    }
        !          5065:                                }
        !          5066:                                goto bombout;
        !          5067:                            case 'G':
        !          5068:                                if (thru_stars && obj->strategy < 7)
        !          5069:                                    goto bombout;
        !          5070:                                if (attackee == nuke) {
        !          5071:                                    if (rand_mod(2+scandist-prob) <
        !          5072:                                      rand_mod(smarts/40+1))
        !          5073:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5074:                                    goto bombout;
        !          5075:                                }
        !          5076:                                if (obj->strategy) {
        !          5077:                                    if (madgorns || !rand_mod(4)) {
        !          5078:                                        obj->vely = attackee->vely;
        !          5079:                                        obj->velx = attackee->velx;
        !          5080:                                    }
        !          5081:                                    obj->strategy += (!torps && deados > 10);
        !          5082:                                    if (obj->strategy > 4)
        !          5083:                                        madgorns = TRUE;
        !          5084:                                    if (!torps && obj->strategy > 5) {
        !          5085:                                        do {
        !          5086:                                            fire_phaser(obj, -dy, -dx);
        !          5087:                                        } while (rand_mod(2));
        !          5088:                                    }
        !          5089:                                }
        !          5090:                                else if (numgorns >= numenemies-1 &&
        !          5091:                                    deados > 15+numgorns*5)
        !          5092:                                    obj->strategy = 1;
        !          5093:                                if (madgorns || rand_mod(51 - sm50) <= prob) {
        !          5094:                                    if (-dy + attackee->vely == obj->vely
        !          5095:                                     && -dx + attackee->velx == obj->velx)
        !          5096:                                        fire_torp(obj,
        !          5097:                                         -dy + attackee->vely,
        !          5098:                                         -dx + attackee->velx);
        !          5099:                                    else
        !          5100:                                        fire_torp(obj,
        !          5101:                                         -dy + attackee->vely - obj->vely,
        !          5102:                                         -dx + attackee->velx - obj->velx);
        !          5103:                                }
        !          5104:                                goto bombout;
        !          5105:                            case 'T':
        !          5106:                                if (attackee == nuke) {
        !          5107:                                    if (rand_mod(2+scandist-prob) <
        !          5108:                                      rand_mod(smarts/40+1))
        !          5109:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5110:                                }
        !          5111:                                if (thru_stars)
        !          5112:                                    goto bombout;
        !          5113:                                if (webnear && scandist-prob > 5) {
        !          5114:                                    if (massacre || rand_mod(50) < super) {
        !          5115:                                        if (!torps && obj->energy > 1000) {
        !          5116:                                            fire_phaser(obj, -dy, -dx);
        !          5117:                                            while (!rand_mod(57-sm55))
        !          5118:                                                fire_phaser(obj, -dy, -dx);
        !          5119:                                        }
        !          5120:                                    }
        !          5121:                                }
        !          5122:                                goto bombout;
        !          5123:                            case 'C': case 'c':
        !          5124:                                if (thru_stars)
        !          5125:                                    goto bombout;
        !          5126:                                break;
        !          5127:                            case 'Q': case 'W': case 'Y': case 'U':
        !          5128:                            case 'I': case 'S': case 'D': case 'H': case 'J':
        !          5129:                            case 'L': case 'Z': case 'V': case 'M': case 'F':
        !          5130:                                if (attackee == nuke) {
        !          5131:                                    if (rand_mod(2+scandist-prob) <
        !          5132:                                      rand_mod(smarts/40+1))
        !          5133:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5134:                                    if (rand_mod(2))
        !          5135:                                        goto pot_shot;
        !          5136:                                }
        !          5137:                                if (madfriends > 1000) {
        !          5138:                                    madfriends -= 200;
        !          5139:                                    goto pot_shot;
        !          5140:                                }
        !          5141:                                /* FALL THROUGH */
        !          5142:                            case '+':
        !          5143:                                if (attackee == nuke) {
        !          5144:                                    if (smarts > 70) {
        !          5145:                                        if (
        !          5146:                                         (obj->posx + obj->velx + XSIZE00)%XSIZE
        !          5147:                                            == attackee->posx &&
        !          5148:                                         (obj->posy + obj->vely + YSIZE00)%YSIZE
        !          5149:                                            == attackee->posy ) {
        !          5150:                                            Tract(nuke,dy,dx,-1);
        !          5151:                                        }
        !          5152:                                        else
        !          5153:                                            while (!rand_mod(82-sm80))
        !          5154:                                                Tract(nuke,dy,dx,-1);
        !          5155:                                    }
        !          5156:                                    else if (smarts > 60 ||
        !          5157:                                      rand_mod(2+scandist-prob) <
        !          5158:                                      rand_mod(smarts/20+1))
        !          5159:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5160:                                }
        !          5161:                                torps = FALSE;
        !          5162:                                thru_stars = FALSE;
        !          5163:                                break;
        !          5164:                            case '|': case '-': case '/': case '\\':
        !          5165:                                if (thru_stars)
        !          5166:                                    goto bombout;
        !          5167:                                webnear = (scandist-prob < 3);
        !          5168:                                torps = FALSE;
        !          5169:                                break;
        !          5170:                            case 'x':
        !          5171:                                if (attackee == nuke) {
        !          5172:                                    if (rand_mod(2+scandist-prob) <
        !          5173:                                      rand_mod(smarts/20+1))
        !          5174:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5175:                                }
        !          5176:                                if (thru_stars)
        !          5177:                                    goto bombout;
        !          5178:                                torps = TRUE;
        !          5179:                                break;
        !          5180:                            case 'o': case 'O': case '0':
        !          5181:                                if (attackee == nuke) {
        !          5182:                                    if (rand_mod(2+scandist-prob) <
        !          5183:                                      rand_mod(smarts/20+1))
        !          5184:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5185:                                }
        !          5186:                                if (thru_stars)
        !          5187:                                    goto bombout;
        !          5188:                                torps = TRUE;
        !          5189:                                if (rand_mod(99+3*scandist) < smarts+3*prob) {
        !          5190:                                    obj->vely = -dy + attackee->vely;
        !          5191:                                    obj->velx = -dx + attackee->velx;
        !          5192:                                    if (obj->flags & STATIC) {/* not a mover? */
        !          5193:                                        obj->flags &= ~STATIC;
        !          5194:                                        obj->prev->next = obj->next;
        !          5195:                                        obj->next->prev = obj->prev;
        !          5196:                                        root.prev->next = obj;
        !          5197:                                        obj->prev = root.prev;
        !          5198:                                        root.prev = obj;
        !          5199:                                        obj->next = &root;
        !          5200:                                    }
        !          5201:                                }
        !          5202:                                if (obj->image != '0')
        !          5203:                                    break;
        !          5204:                            /* DROP THROUGH! */
        !          5205:                            case 'X':
        !          5206:                                if (attackee == nuke) {
        !          5207:                                    if (rand_mod(2+scandist-prob) <
        !          5208:                                      rand_mod(smarts/20+1))
        !          5209:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5210:                                }
        !          5211:                                torps = TRUE;
        !          5212:                                if (thru_stars)
        !          5213:                                    goto bombout;
        !          5214:                                if (prob == scandist) {
        !          5215:                                    int y, x;
        !          5216: 
        !          5217:                                    blast[y=(obj->posy+obj->vely+YSIZE00)%YSIZE]
        !          5218:                                         [x=(obj->posx+obj->velx+XSIZE00)%XSIZE]
        !          5219:                                      += (obj->image == '0' ? 2000 : 200);
        !          5220:                                    yblasted[y] |= 1;
        !          5221:                                    xblasted[x] |= 1;
        !          5222:                                    blasted = TRUE;
        !          5223:                                }
        !          5224:                                break;
        !          5225:                            case 'A':
        !          5226:                                if (attackee != nuke) {
        !          5227:                                    if (scandist-prob>1 && !rand_mod(51-super))
        !          5228:                                        Tract(obj,-dy,-dx,1);
        !          5229:                                }
        !          5230:                                /* FALL THROUGH */
        !          5231:                            case '*': case '@':
        !          5232:                                if (attackee == nuke) {
        !          5233:                                    if (amb[cury][curx] != '~') {
        !          5234:                                        if (scandist-prob < nukedist) {
        !          5235:                                            nukedist = scandist-prob;
        !          5236:                                            nukey = dy; /* nearest food in */
        !          5237:                                            nukex = dx; /*   this direction */
        !          5238:                                        }
        !          5239:                                        if (smarts > 55 && scandist-prob > 8) {
        !          5240:                                            if (rand_mod(30+scandist-prob) <
        !          5241:                                              rand_mod(smarts/20+1))
        !          5242:                                                Tract(nuke,dy,dx,1);
        !          5243:                                        }
        !          5244:                                    }
        !          5245:                                    else if (obj->vely || obj->velx) {
        !          5246:                                        Tract(nuke,dy,dx,1); /* for looks */
        !          5247:                                        obj->vely = obj->velx = 0;
        !          5248:                                    }
        !          5249:                                }
        !          5250:                                if (!thru_stars)
        !          5251:                                    if (rand_mod(97-sm95))
        !          5252:                                        goto bombout;
        !          5253:                                    else
        !          5254:                                        thru_stars = TRUE;
        !          5255:                                break;
        !          5256:                            case '<': case '>':
        !          5257:                                if (attackee == nuke) {
        !          5258:                                    if ((!dy && scandist-prob < 8) ||
        !          5259:                                      rand_mod(2+scandist-prob) <
        !          5260:                                      rand_mod(smarts/20+1) ) {
        !          5261:                                        nuke->mass += 10000;
        !          5262:                                        Tract(nuke,dy,dx,-1);
        !          5263:                                        nuke->mass -= 10000;
        !          5264:                                    }
        !          5265:                                }
        !          5266:                                goto bombout;
        !          5267:                            case 'E': case 'B':
        !          5268:                                if (attackee == nuke) {
        !          5269:                                    if (rand_mod(2+scandist-prob) <
        !          5270:                                      rand_mod(smarts/40+1))
        !          5271:                                        Tract(nuke,dy,dx,rand_mod(3)?1:-1);
        !          5272:                                }
        !          5273:                                goto bombout;
        !          5274:                            default:
        !          5275:                                goto bombout;
        !          5276:                            }
        !          5277:                        }
        !          5278:                        else {
        !          5279:                            if (thru_stars)
        !          5280:                                goto bombout;
        !          5281:                        }       
        !          5282:                    }
        !          5283: bombout:            ; /* end of loop */
        !          5284:                }
        !          5285:            }
        !          5286:        }
        !          5287:        if (attackee == nuke && nukedist < 100) {/* aim amoeba at nearest */
        !          5288:            if (nukey < 0)                      /*   free star */
        !          5289:                nukey = 2;
        !          5290:            if (nukex < 0)
        !          5291:                nukex = 2;
        !          5292:            nuke->strategy = nukey + (nukex << 2);
        !          5293:        }
        !          5294:     }
        !          5295: }
        !          5296: 
        !          5297: void
        !          5298: fire_phaser(obj, dy, dx)
        !          5299: Reg7 OBJECT *obj;
        !          5300: Reg5 int dy;
        !          5301: Reg6 int dx;
        !          5302: {
        !          5303:     Reg1 int y;
        !          5304:     Reg2 int x;
        !          5305:     Reg3 int skipping;
        !          5306:     Reg4 int size=5000;
        !          5307:     int decr = 50, oldy, oldx;
        !          5308:     static char curchar[] = "@* ";
        !          5309: 
        !          5310:     if (obj == ent)
        !          5311:        decr = 100;
        !          5312:     else if (obj == base) {
        !          5313:        decr = 1000;
        !          5314:        size = 200;
        !          5315:     }
        !          5316:     if (!dy)
        !          5317:        curchar[2] = '-';
        !          5318:     else if (!dx)
        !          5319:        curchar[2] = '!';
        !          5320:     else if (dy == dx)
        !          5321:        curchar[2] = '\\';
        !          5322:     else
        !          5323:        curchar[2] = '/';
        !          5324:     if (obj->energy >= decr) {
        !          5325:        obj->energy -= decr;
        !          5326:        for (
        !          5327:          /* initialize */
        !          5328:          skipping = (obj != base),
        !          5329:          y = (obj->posy+(obj==base?dy*2:dy)+YSIZE00)%YSIZE,
        !          5330:          x = (obj->posx+(obj==base?dx*2:dx)+XSIZE00)%XSIZE;
        !          5331:          /* while */
        !          5332:          size && (!occupant[y][x]||(skipping && occupant[y][x]->type==Star));
        !          5333:          /* at end of loop */
        !          5334:          y = (y+dy+YSIZE00) % YSIZE,
        !          5335:          x = (x+dx+XSIZE00) % XSIZE,
        !          5336:          size = size * 3 / 4 ) {
        !          5337:            move(y+1,x*2,0);
        !          5338:            beg_qwrite();
        !          5339:            if (obj == base || obj->image == 'T') {
        !          5340:                *filler = '@';
        !          5341:                qwrite();
        !          5342:                *filler = '#';
        !          5343:                qwrite();
        !          5344:                *filler = '~';
        !          5345:                qwrite();
        !          5346:                *filler = '%';
        !          5347:                qwrite();
        !          5348:                *filler = ':';
        !          5349:                qwrite();
        !          5350:                *filler = '@';
        !          5351:            }
        !          5352:            else {
        !          5353:                *filler = size >= 500 ?
        !          5354:                          *curchar : (size >= 50 ?
        !          5355:                                     curchar[1] :
        !          5356:                                     curchar[2]);
        !          5357:            }
        !          5358:            qwrite();
        !          5359:            if (occupant[y][x])
        !          5360:                qaddc(occupant[y][x]->image);
        !          5361:            else {
        !          5362:                if (numamoebas)
        !          5363:                    qaddc(amb[y][x]);
        !          5364:                else
        !          5365:                    qaddspace();
        !          5366:                if (skipping)
        !          5367:                    skipping = 0;
        !          5368:            }
        !          5369:            end_qwrite();
        !          5370:        }
        !          5371:        if (size) {
        !          5372:            char img;
        !          5373: 
        !          5374:            assert(occupant[y][x]);
        !          5375:            img = occupant[y][x]->image;
        !          5376:            if (occupant[y][x]->type == Crusher) {
        !          5377:                if (dy)
        !          5378:                    return;
        !          5379:                if (dx==(img == '<' ? 1 : -1) ) {
        !          5380:                    occupant[y][x]->image =
        !          5381:                        (occupant[y][x]->velx *= -1) < 0 ? '>' : '<';
        !          5382:                    return;
        !          5383:                }
        !          5384:            }
        !          5385:            else if (occupant[y][x]->flags & FRIENDLY)
        !          5386:                madfriends += 200;
        !          5387:            if (numamoebas && amb[y][x] == '~' && smarts % 3 &&
        !          5388:                (smarts > 70 || rand_mod(smarts) > rand_mod(20)) ) {
        !          5389:                if (size > 10000)
        !          5390:                    modify_amoeba(y,x,1,'~',10);
        !          5391:                else if (size > 1000)
        !          5392:                    modify_amoeba(y,x,1,'~',7);
        !          5393:                else if (size > 50)
        !          5394:                    modify_amoeba(y,x,1,'~',5);
        !          5395:                else
        !          5396:                    modify_amoeba(y,x,1,'~',2);
        !          5397:                if (occupant[y][x] == nuke) {
        !          5398:                    nuke->strategy = rand_mod(30);
        !          5399:                    nuke->flags |= COUNTDOWN;
        !          5400:                }
        !          5401:                return;
        !          5402:            }
        !          5403:            else {
        !          5404:                move(y+1,x*2,0);
        !          5405:                beg_qwrite();
        !          5406:                if (img == ' ') {
        !          5407:                    *filler = occupant[y][x]->flags & PIRATE ? 'P' : 'R';
        !          5408:                    occupant[y][x]->image = *filler;
        !          5409:                    occupant[y][x]->strategy = 0;
        !          5410:                    qwrite();
        !          5411:                    qwrite();
        !          5412:                }
        !          5413:                else if (img == 'C' || img == 'c') {
        !          5414:                    cloaked = 0;
        !          5415:                    img += 2;
        !          5416:                    occupant[y][x]->image = img;
        !          5417:                    *filler = img;
        !          5418:                    qwrite();
        !          5419:                    qwrite();
        !          5420:                }
        !          5421:                else if (img == 'K' && size > 50)
        !          5422:                    occupant[y][x]->strategy = 0;
        !          5423:                *filler = '@';
        !          5424:                qwrite();
        !          5425:                *filler = '#';
        !          5426:                qwrite();
        !          5427:                *filler = '@';
        !          5428:                qwrite();
        !          5429:                *filler = '#';
        !          5430:                qwrite();
        !          5431:                *filler = '@';
        !          5432:                qwrite();
        !          5433:                qaddc(img);
        !          5434:                end_qwrite();
        !          5435:                oldy = y;
        !          5436:                oldx = x;
        !          5437:                y = (occupant[oldy][oldx]->posy + occupant[oldy][oldx]->vely +
        !          5438:                        YSIZE00) % YSIZE;
        !          5439:                x = (occupant[oldy][oldx]->posx + occupant[oldy][oldx]->velx +
        !          5440:                        XSIZE00) % XSIZE;
        !          5441:                if (occupant[y][x] && occupant[y][x]->type == Star) {
        !          5442:                    y = occupant[oldy][oldx]->posy;
        !          5443:                    x = occupant[oldy][oldx]->posx;
        !          5444:                }
        !          5445:                if (obj==base)
        !          5446:                    blast[y][x] += size>50 ? 15000 : (size>15 ? 1500 : 150);
        !          5447:                else if (obj==ent)
        !          5448:                    blast[y][x] += size*4;
        !          5449:                else if (obj->image=='T')
        !          5450:                    blast[y][x] += 15000;
        !          5451:                else
        !          5452:                    blast[y][x] += size*smarts/25;
        !          5453:                yblasted[y] |= 1;
        !          5454:                xblasted[x] |= 1;
        !          5455:                blasted = TRUE;
        !          5456:            }
        !          5457:        }
        !          5458:     }
        !          5459: }
        !          5460: 
        !          5461: int
        !          5462: tract(obj, dy, dx, to_or_fro)
        !          5463: Reg7 OBJECT *obj;
        !          5464: Reg4 int dy;
        !          5465: Reg5 int dx;
        !          5466: int to_or_fro;
        !          5467: {
        !          5468:     Reg1 int y;
        !          5469:     Reg2 int x;
        !          5470:     Reg3 int size=10;
        !          5471:     static char ch;
        !          5472:     Reg6 OBJECT *tractee;
        !          5473: 
        !          5474:     if (!dy)
        !          5475:        ch = '|';
        !          5476:     else if (!dx)
        !          5477:        ch = '-';
        !          5478:     else if (dy == dx)
        !          5479:        ch = '/';
        !          5480:     else
        !          5481:        ch = '\\';
        !          5482:     {
        !          5483:        for (
        !          5484:          y = (obj->posy+dy+YSIZE00)%YSIZE,
        !          5485:          x = (obj->posx+dx+XSIZE00)%XSIZE;
        !          5486:          size && (!occupant[y][x]);
        !          5487:          y = (y+dy+YSIZE00) % YSIZE, x = (x+dx+XSIZE00) % XSIZE, size--) {
        !          5488:            move(y+1,x*2,0);
        !          5489:            beg_qwrite();
        !          5490:            *filler = ch;
        !          5491:            qwrite();
        !          5492:            qwrite();
        !          5493:            if (numamoebas)
        !          5494:                qaddch(amb[y][x]);
        !          5495:            else
        !          5496:                qaddspace();
        !          5497:            end_qwrite();
        !          5498:        }
        !          5499:        tractee = occupant[y][x];
        !          5500:        if (size) {
        !          5501:            assert(tractee);
        !          5502:            if (numamoebas && obj != nuke && amb[y][x] == '~') {
        !          5503:                if (to_or_fro > 0)
        !          5504:                    modify_amoeba(y,x,2,'~',size);
        !          5505:                else
        !          5506:                    modify_amoeba(y,x,1,' ',size);
        !          5507:            }
        !          5508:            if (tractee->type != Web &&
        !          5509:                (tractee->mass < obj->mass * 5 ||
        !          5510:                 (tractee->type == Crusher && !dx) ) ) {
        !          5511:                if (tractee == ent) {
        !          5512:                    evely -= dy * to_or_fro;
        !          5513:                    evelx -= dx * to_or_fro;
        !          5514:                }
        !          5515:                else if (tractee == base) {
        !          5516:                    bvely -= dy * to_or_fro;
        !          5517:                    bvelx -= dx * to_or_fro;
        !          5518:                }
        !          5519:                else {
        !          5520:                    tractee->vely -= dy * to_or_fro;
        !          5521:                    tractee->velx -= dx * to_or_fro;
        !          5522:                }
        !          5523:                if (tractee->type == Torp ||
        !          5524:                    tractee->type == Star) {
        !          5525:                    if (tractee->flags & STATIC) {  /* not a mover? */
        !          5526:                        tractee->flags &= ~STATIC;
        !          5527:                        tractee->prev->next = tractee->next;
        !          5528:                        tractee->next->prev = tractee->prev;
        !          5529:                        root.prev->next = tractee;
        !          5530:                        tractee->prev = root.prev;
        !          5531:                        root.prev = tractee;
        !          5532:                        tractee->next = &root;
        !          5533:                    }
        !          5534:                }
        !          5535:            }
        !          5536:            else if (tractee->type == Crusher && !dy &&
        !          5537:              dx==(tractee->image == '<' ? 1 : -1) ) {
        !          5538:                setimage(tractee, (tractee->velx *= -1) < 0 ? '>' : '<');
        !          5539:            }
        !          5540:            if (tractee->mass * 5 > obj->mass)
        !          5541:                return(1);
        !          5542:        }
        !          5543:     }
        !          5544:     return(0);
        !          5545: }
        !          5546: STATIC) {  /* not a mover? */
        !          5547:                        tractee->flags &= ~STATIC;
        !          5548:                        tractee->prev->next = tractee->next;
        !          5549:                        tractee->next->prev = tractee->prev;
        !          5550:                        root.prev->next = tractee;
        !          5551:                        tractee->prev = root.prev;
        !          5552:                        root.prev = tractee;
        !          5553:                        tractee->next = &root;
        !          5554:                    }
        !          5555:                }
        !          5556:            }
        !          5557:            else if (tractee->type == Crusher && !dy &&
        !          5558:              dx==(tractee->image == '<' ? 1 : -1) ) {
        !          5559:                setimagwarp/init.c   644    171      5       32736  5121750032   6171 /* $Header: init.c,v 7.0.1.4 86/12/12 16:58:03 lwall Exp $ */
        !          5560: 
        !          5561: /* $Log:       init.c,v $
        !          5562:  * Revision 7.0.1.4  86/12/12  16:58:03  lwall
        !          5563:  * Baseline for net release.
        !          5564:  * 
        !          5565:  * Revision 7.0.1.3  86/10/20  14:35:31  lwall
        !          5566:  * Picked some lint.
        !          5567:  * 
        !          5568:  * Revision 7.0.1.2  86/10/17  15:53:30  lwall
        !          5569:  * Added random walk star fields.
        !          5570:  * 
        !          5571:  * Revision 7.0.1.1  86/10/16  10:51:19  lwall
        !          5572:  * Added Damage.  Fixed random bugs.
        !          5573:  * 
        !          5574:  * Revision 7.0  86/10/08  15:12:10  lwall
        !          5575:  * Split into separate files.  Added amoebas and pirates.
        !          5576:  * 
        !          5577:  */
        !          5578: 
        !          5579: #include "EXTERN.h"
        !          5580: #include "warp.h"
        !          5581: #include "bang.h"
        !          5582: #include "object.h"
        !          5583: #include "move.h"
        !          5584: #include "play.h"
        !          5585: #include "score.h"
        !          5586: #include "term.h"
        !          5587: #include "them.h"
        !          5588: #include "us.h"
        !          5589: #include "util.h"
        !          5590: #include "weapon.h"
        !          5591: #include "INTERN.h"
        !          5592: #include "init.h"
        !          5593: 
        !          5594: void
        !          5595: initialize()
        !          5596: {
        !          5597:     Reg1 int i;
        !          5598:     Reg2 int x;
        !          5599:     Reg3 int y;
        !          5600:     Reg4 int dist;
        !          5601:     Reg5 int ydist;
        !          5602:     Reg6 int xdist;
        !          5603:     long e;
        !          5604:     int yoff, xoff, ypred, xpred;
        !          5605:     Reg7 OBJECT *obj;
        !          5606:     char ch;
        !          5607:     FILE *mapfp = NULL;
        !          5608:     bool tmptholspec;
        !          5609:     int inhabjackpot;
        !          5610:     long inhenergy;
        !          5611:     int walksplit = 200;
        !          5612:     static char *distname[] =
        !          5613:        {" #"," -"," \\"," /",
        !          5614:         " |"," *"," `"," '"};
        !          5615: 
        !          5616:     cloaking = madgorns = FALSE;
        !          5617:     deados = madfriends = 0;
        !          5618:     curscore = possiblescore = 0L;
        !          5619:     yamblast = xamblast = ambsize = 0;
        !          5620:     if (smarts > 90)
        !          5621:        massacre = TRUE;
        !          5622:     scandist = (massacre?20:15);
        !          5623:     antibase = (smarts>60?1:(smarts>40?2:(smarts>25?4:100)));
        !          5624:     sm35 = (smarts>35?35:smarts);
        !          5625:     sm45 = (smarts>45?45:smarts);
        !          5626:     sm50 = (smarts>50?50:smarts);
        !          5627:     sm55 = (smarts>55?55:smarts);
        !          5628:     sm80 = (smarts>80?80:smarts);
        !          5629:     sm95 = (smarts>95?95:smarts);
        !          5630:     super = (smarts>50?smarts-50:0);
        !          5631:     enemshields = 10 + super/2;                /* (scaled by 10) 1 @ 50 .. 3 @ 90 */
        !          5632:     if (smarts>90)
        !          5633:        enemshields += (smarts-90)*10;  /* lay it on thick: ~13 @ 99 */
        !          5634:     entmax = (smarts>=75?5000:(smarts>=50?4000:(smarts>=40?3000:2000)));
        !          5635:     basemax = (smarts>=75?20000:(smarts>=50?15000:(smarts>=40?12500:10000)));
        !          5636: 
        !          5637:     clear();
        !          5638:     while (root.next != &root) {
        !          5639:        root.next = root.next->next;
        !          5640:        free_object(root.next->prev);
        !          5641:     }
        !          5642:     root.prev = &root;
        !          5643:     enemies = movers = NULL;
        !          5644:     numos = numxes = 0;
        !          5645: #if defined(vax) && XYSIZEx4 == 3680
        !          5646:     asm("movc5 $0,_occupant,$0,$3680,_occupant");
        !          5647:     asm("movc5 $0,_blast,$0,$3680,_blast");    /* 3680 = XYSIZEx4 */
        !          5648:     asm("movc5 $0,_amb,$32,$920,_amb");
        !          5649: #else
        !          5650:     for (y=0;y<YSIZE;y++)
        !          5651:        for (x=0;x<XSIZE;x++) {
        !          5652:            occupant[y][x] = 0;
        !          5653:            blast[y][x] = 0;
        !          5654:            amb[y][x] = ' ';
        !          5655:        }
        !          5656: #endif
        !          5657:     for (y=0; y<YSIZE; y++)
        !          5658:        yblasted[y] = 0;
        !          5659:     for (x=0; x<XSIZE; x++)
        !          5660:        xblasted[x] = 0;
        !          5661:     blasted = FALSE;
        !          5662:     if (!starspec)
        !          5663:        if (smarts < 15)
        !          5664:            inumstars = 50 + rand_mod(50);
        !          5665:        else if (smarts < 50 || smarts > 85)
        !          5666:            inumstars = exdis(800) + rand_mod(100) + 1;
        !          5667:        else /* too few stars makes 50..85 too hard */
        !          5668:            inumstars = exdis(700) + rand_mod(150-super*2) + 50+super*2;
        !          5669:     tmptholspec = (smarts > 15 && inumstars < 450 && ! rand_mod(90-sm80));
        !          5670:     if (!klingspec) {
        !          5671:        inumenemies = rand_mod((smarts+1)/2) + 1;
        !          5672:        if (massacre || tmptholspec)
        !          5673:            inumenemies += 10;
        !          5674:     }
        !          5675:     if (!friendspec)
        !          5676:        inumfriends = rand_mod(smarts/8+1);
        !          5677:     if (!piratespec)
        !          5678:        inumpirates = rand_mod(inumfriends/2+1);
        !          5679:     if (inumfriends+inumenemies+inumstars > YSIZE*XSIZE-20)
        !          5680:        inumstars = YSIZE*XSIZE-20 - inumenemies - inumfriends;
        !          5681:     if (inumstars < 0) {
        !          5682:        inumfriends += inumstars;
        !          5683:        inumstars = 0;
        !          5684:     }
        !          5685:     if (inumfriends < 0) {
        !          5686:        inumenemies += inumfriends;
        !          5687:        inumfriends = 0;
        !          5688:     }
        !          5689:     if (inumenemies < 0)
        !          5690:        inumenemies = 0;
        !          5691:     numstars = inumstars;
        !          5692:     inuminhab = numinhab = 0;
        !          5693:     inumroms = inumthols = inumgorns = 0;
        !          5694:     numapollos = apolspec || massacre ? 1 :
        !          5695:        ((!numstars || rand_mod(2) || smarts < 10) ? 0 : 1);
        !          5696:     inumapollos = apolloflag = 0;
        !          5697:     realapollo = NULL;
        !          5698:     inumcrushes = numcrushes =
        !          5699:        crushspec||massacre?1:(rand_mod(2000) < inumstars);
        !          5700:     inumenemies += inumcrushes;
        !          5701:     inumamoebas = numamoebas = (amoebaspec ? 1 :
        !          5702:        !rand_mod(inumcrushes?3-massacre:8) );  /* < and & are fun together */
        !          5703:     inumenemies += inumamoebas;
        !          5704:     if (!rand_mod(40)) {
        !          5705:        inhabjackpot = 32767;
        !          5706:        inumfriends += rand_mod(10);
        !          5707:        inumpirates += rand_mod(10);
        !          5708:     }
        !          5709:     else
        !          5710:        inhabjackpot = inumpirates;
        !          5711:     inhenergy = 30000-super*150;
        !          5712:     if (!rand_mod(10))
        !          5713:        inhenergy = 50000;
        !          5714:     if (!rand_mod(4))
        !          5715:        inhenergy += rand_mod(3500+super*150);
        !          5716:     numfriends = inumfriends;
        !          5717:     numpirates = inumpirates;
        !          5718:     numenemies = inumenemies;
        !          5719:     deadmudds = 0;
        !          5720: 
        !          5721:     /* do stars */
        !          5722: 
        !          5723: stars_again:
        !          5724:     if (prespec)
        !          5725:        dist = 4;
        !          5726:     else if (numstars > 750)
        !          5727:        dist = 0;
        !          5728:     else
        !          5729:        dist = rand_mod(starspec||smarts<=5?3:5);
        !          5730:     if (debugging) {
        !          5731:        real_y = real_x = -100;
        !          5732:        printf("\r\n");
        !          5733:     }
        !          5734:     switch (dist) {
        !          5735:     case 0:                            /* uniform random */
        !          5736:        ydist = xdist = 0;
        !          5737:        if (inumstars < 700 && !rand_mod(3-(inumstars<50))) {
        !          5738:            ydist = xdist = 6;          /* well, maybe not so random */
        !          5739:            y = rand_mod(YSIZE);
        !          5740:            x = rand_mod(XSIZE);
        !          5741:            if (rand_mod(2))
        !          5742:                walksplit = inumstars/(exdis(40)+1);
        !          5743:        }
        !          5744:        if (debugging)
        !          5745:            printf(" R\r\n");
        !          5746:        break;
        !          5747:     case 1: case 2:    /* clumped, maybe skewed, maybe superposed */
        !          5748:        ydist = rand_mod(4);
        !          5749:        xdist = rand_mod(2);
        !          5750:        if (debugging)
        !          5751:            printf("%s\r\n",distname[ydist+4*xdist]);
        !          5752:        yoff = rand_mod(YSIZE);
        !          5753:        xoff = rand_mod(XSIZE);
        !          5754:        if (dist == 2)
        !          5755:            dist = numstars/2 + exdis(numstars/2) - exdis(numstars/2);
        !          5756:        else
        !          5757:            dist = 0;
        !          5758:        break;
        !          5759:     case 3: case 4:                    /* predefined or residual */
        !          5760:       scenario_again:
        !          5761:        if (debugging)
        !          5762:            printf(" P\r\n");
        !          5763:        dist = 0;
        !          5764:        Sprintf(spbuf,"smap.%d",
        !          5765:            (prescene>=0?prescene:rand_mod(MAPS)) );
        !          5766:        if ((mapfp = fopen(spbuf,"r")) != NULL &&
        !          5767:            fgets(spbuf,10,mapfp) != NULL ) {
        !          5768:            inumstars = numstars = atoi(spbuf);
        !          5769:            if (inumenemies+inumstars > YSIZE*XSIZE-20)
        !          5770:                inumstars = numstars = YSIZE*XSIZE-20 - inumenemies;
        !          5771:            ydist = rand_mod(2) + 4;    /* flip y axis? */
        !          5772:            xdist = rand_mod(2) + 4;    /* flip x axis? */
        !          5773:            yoff = rand_mod(YSIZE);     /* how much to shift y */
        !          5774:            xoff = rand_mod(XSIZE);     /* how much to shift x */
        !          5775:        }
        !          5776:        else {
        !          5777:            prespec = FALSE;
        !          5778:            prescene = -1;
        !          5779:            if (rand_mod(2))
        !          5780:                goto scenario_again;
        !          5781:            goto stars_again;
        !          5782:        }
        !          5783:        break;
        !          5784:     }
        !          5785:     for (i = 1; i <= numstars; i++) {
        !          5786:        if (dist && i == dist) {        /* flip to another skewing? */
        !          5787:            ydist = rand_mod(4);
        !          5788:            xdist = rand_mod(2);
        !          5789:            if (!rand_mod(4)) {
        !          5790:                ydist = xdist = 6;
        !          5791:                if (debugging)
        !          5792:                    printf("&\r\n");
        !          5793:            }
        !          5794:            else if (debugging)
        !          5795:                printf("%s\r\n",distname[ydist+4*xdist]);
        !          5796:            yoff = rand_mod(YSIZE);
        !          5797:            xoff = rand_mod(XSIZE);
        !          5798:            dist = 0;
        !          5799:        }
        !          5800:        do {                            /* until an open spot found */
        !          5801:            switch (xdist) {
        !          5802:            case 0:
        !          5803:                x = rand_mod(XSIZE);    /* pick from 0..39, uniform */
        !          5804:                break;
        !          5805:            case 1: case 2: case 3:
        !          5806: #ifndef lint
        !          5807:                x = (int)((((double)(myrand()-HALFRAND)) *
        !          5808:                           ((double)(myrand()-HALFRAND))/RANDRAND)
        !          5809:                          * 20.0) + xoff;       /* pick from -20..20, clumped */
        !          5810: #endif
        !          5811:                break;
        !          5812:            case 4:
        !          5813:                if (fscanf(mapfp,"%d %d\n",&ypred,&xpred) == EOF)
        !          5814:                    ydist = xdist = 0;
        !          5815:                x = xpred + xoff;
        !          5816:                break;
        !          5817:            case 5:
        !          5818:                if (fscanf(mapfp,"%d %d\n",&ypred,&xpred) == EOF)
        !          5819:                    ydist = xdist = 0;
        !          5820:                x = -xpred + xoff;
        !          5821:                break;
        !          5822:            case 6:
        !          5823:                x += rand_mod(3) - 1;
        !          5824:                break;
        !          5825:            }
        !          5826:            switch (ydist) {
        !          5827:            case 0:
        !          5828:                y = rand_mod(YSIZE);
        !          5829:                break;
        !          5830:            case 1:
        !          5831: #ifndef lint
        !          5832:                y = (int)((((double)(myrand()-HALFRAND)) *
        !          5833:                           ((double)(myrand()-HALFRAND))/RANDRAND)
        !          5834:                          * 12.0) + yoff;       /* pick from -12..12, clumped */
        !          5835: #endif
        !          5836:                break;
        !          5837:            case 2:
        !          5838: #ifndef lint
        !          5839:                y = (int)((((double)(myrand()-HALFRAND)) *
        !          5840:                           ((double)(myrand()-HALFRAND))/RANDRAND)
        !          5841:                          * 12.0) + yoff + x*YSIZE/XSIZE;
        !          5842:                                                /* clumped & skewed */
        !          5843: #endif
        !          5844:                break;
        !          5845:            case 3:
        !          5846: #ifndef lint
        !          5847:                y = (int)((((double)(myrand()-HALFRAND)) *
        !          5848:                           ((double)(myrand()-HALFRAND))/RANDRAND)
        !          5849:                          * 12.0) + yoff - x*YSIZE/XSIZE;
        !          5850:                                                /* clumped & skewed */
        !          5851: #endif
        !          5852:                break;
        !          5853:            case 4:
        !          5854:                y = ypred + yoff;
        !          5855:                break;
        !          5856:            case 5:
        !          5857:                y = -ypred + yoff;
        !          5858:                break;
        !          5859:            case 6:
        !          5860:                y += rand_mod(3) - 1;
        !          5861: #ifdef lint
        !          5862:                walksplit = walksplit;
        !          5863: #endif
        !          5864:                if (!rand_mod(walksplit)) {
        !          5865:                    y = rand_mod(YSIZE);
        !          5866:                    x = rand_mod(XSIZE);
        !          5867:                }
        !          5868:                break;
        !          5869:            }
        !          5870:            while (x<0) x += XSIZE00;
        !          5871:            while (y<0) y += YSIZE00;
        !          5872:            x %= XSIZE;
        !          5873:            y %= YSIZE;
        !          5874:        } while (occupant[y][x]);
        !          5875:        e = rand_mod(32768);
        !          5876:        if (--inhabjackpot > 0 || e >= inhenergy) {
        !          5877:            ch = '@';
        !          5878:            if (inhabjackpot && e < 10000)
        !          5879:                e += 10000;
        !          5880:            inuminhab = ++numinhab;
        !          5881:        }
        !          5882:        else {
        !          5883:            ch = '*';
        !          5884:        }
        !          5885:        obj = make_object(Star,ch,y,x,0,0,e+rand_mod(super*100+1),e/4,&root);
        !          5886:        obj->flags |= STATIC;
        !          5887:     }
        !          5888:     if (inumstars > 30 && inhabjackpot <= 0 &&
        !          5889:         !rand_mod(3 - (inumstars > 400) - (inhenergy > 32768)) ) {
        !          5890:        int initx;
        !          5891:        int inity;
        !          5892: 
        !          5893:        x = initx = obj->posx;
        !          5894:        y = inity = obj->posy;
        !          5895:        while (rand_mod(2) && inuminhab < inumstars/2) {
        !          5896:            for (i=rand_mod(smarts)*2+20; i; i--) {
        !          5897:                if ((obj = occupant[y][x]) && obj->image == '*') {
        !          5898:                    setimage(obj,'@');
        !          5899:                    if (obj->energy < 10000)
        !          5900:                        obj->energy += 20000; /* the benefits of civilization */
        !          5901:                    inuminhab = ++numinhab;
        !          5902:                }
        !          5903:                if (i&15) {
        !          5904:                    y = (y + rand_mod(3) + YSIZE99) % YSIZE;
        !          5905:                    x = (x + rand_mod(3) + XSIZE99) % XSIZE;
        !          5906:                }
        !          5907:                else {                  /* don't wander too far */
        !          5908:                    y = inity;
        !          5909:                    x = initx;
        !          5910:                }
        !          5911:            }
        !          5912:            x = initx = rand_mod(XSIZE);
        !          5913:            y = inity = rand_mod(YSIZE);
        !          5914:        }
        !          5915:     }
        !          5916:     if (mapfp != NULL)
        !          5917:        Fclose(mapfp);
        !          5918:     if (numcrushes) {
        !          5919:        do {
        !          5920:            x = rand_mod(XSIZE);
        !          5921:            y = rand_mod(YSIZE);
        !          5922:        } while (occupant[y][x]);
        !          5923:        movers = make_object(Crusher,'<',y,x,0,1,32767L,32768L,&root);
        !          5924:        possiblescore += 10000;
        !          5925:     }
        !          5926:     ient = (numents != 0);
        !          5927:     if (ient) {
        !          5928:        do {
        !          5929:            x = rand_mod(XSIZE);
        !          5930:            y = rand_mod(YSIZE);
        !          5931:        } while (occupant[y][x]);
        !          5932:        e = entmax;
        !          5933:        ent = make_object(Enterprise,'E',y,x,0,0,e,e/2,&root);
        !          5934:        if (!movers)
        !          5935:            movers = ent;
        !          5936:     }
        !          5937:     ibase = (numbases != 0);
        !          5938:     if (ibase) {
        !          5939:        e = 52-super;
        !          5940:        do {
        !          5941:            x = rand_mod(XSIZE);
        !          5942:            y = rand_mod(YSIZE);
        !          5943:        } while (occupant[y][x] || lookaround(y,x,Star) * 7 < e--);
        !          5944:        e = basemax;
        !          5945:        base = make_object(Base, 'B',y,x,0,0,e,e/4,&root);
        !          5946:        if (!movers)
        !          5947:            movers = base;
        !          5948:     }
        !          5949:     if (numamoebas) {
        !          5950:        do {
        !          5951:            x = rand_mod(XSIZE);
        !          5952:            y = rand_mod(YSIZE);
        !          5953:        } while (occupant[y][x]);
        !          5954:        nuke = make_object(Enemy,'&',y,x,0,0,32767L,
        !          5955:          (long)entmax+entmax+rand_mod(entmax),&root);
        !          5956:        possiblescore += 10000;
        !          5957:        amb[y][x] = '~';
        !          5958:        if (rand_mod(2))
        !          5959:            modify_amoeba(y,x,2,'~',(int)rand_mod(smarts<<1));/* just make blob */
        !          5960:        else {
        !          5961:            for (i=smarts/10+1; i; i--) {
        !          5962:                nuke->strategy = rand_mod(256);         /* random direction */
        !          5963:                modify_amoeba(y,x,2,'~',(int)rand_mod(5));
        !          5964:                modify_amoeba(y,x,2,'~',(int)rand_mod(5));
        !          5965:                modify_amoeba(y,x,2,'~',(int)rand_mod(5));
        !          5966:                modify_amoeba(y,x,2,'~',(int)rand_mod(5));      /* extend pseudopod */
        !          5967:            }
        !          5968:        }
        !          5969:        if (!enemies)
        !          5970:            enemies = nuke;
        !          5971:        if (!movers)
        !          5972:            movers = nuke;
        !          5973:     }
        !          5974:     if (rand_mod(27-sm50/2) && !romspec && !gornspec)
        !          5975:        dist = 27-sm50/2;
        !          5976:     else
        !          5977:        dist = rand_mod(4) + 1;
        !          5978:     for (i = 1+inumcrushes+inumamoebas; i <= numenemies; i++) {
        !          5979:        do {
        !          5980:            x = rand_mod(XSIZE);
        !          5981:            y = rand_mod(YSIZE);
        !          5982:        } while (occupant[y][x]);
        !          5983:        if (rand_mod(dist)) {
        !          5984:            if (!tholspec && !tmptholspec && rand_mod((inumstars*3)/sm50+2))
        !          5985:                ch = 'K';
        !          5986:            else {
        !          5987:                ch = 'T';
        !          5988:                inumthols++;
        !          5989:            }
        !          5990:        }
        !          5991:        else {
        !          5992:            if (romspec == gornspec)
        !          5993:                e = 50;
        !          5994:            else if (gornspec)
        !          5995:                e = 10;
        !          5996:            else
        !          5997:                e = 90;
        !          5998:            if (rand_mod(100) < e) {
        !          5999:                ch = 'R';
        !          6000:                inumroms++;
        !          6001:            }
        !          6002:            else {
        !          6003:                ch = 'G';
        !          6004:                inumgorns++;
        !          6005:            }
        !          6006:        }
        !          6007:        if (possiblescore > ENTBOUNDARY - 10000)
        !          6008:            e = (ENTBOUNDARY - possiblescore) / 5;
        !          6009:        else
        !          6010:            e = 250 + (sm50-1) * 30 * 20 / numenemies+1;
        !          6011: #ifndef lint
        !          6012:        e = exdis((int)e) + e - exdis((int)e);
        !          6013:        obj = make_object(Enemy,ch,y,x,0,0,
        !          6014:            e + rand_mod(super*200+2) + 10000*massacre,e/4,&root);
        !          6015: #endif
        !          6016:        e /= 4;
        !          6017:        switch (ch) {
        !          6018:        case 'K':
        !          6019:            possiblescore += e;
        !          6020:            break;
        !          6021:        case 'T':
        !          6022:            possiblescore += e*3/2;
        !          6023:            break;
        !          6024:        case 'G':
        !          6025:            possiblescore += e*2;
        !          6026:            break;
        !          6027:        case 'R':
        !          6028:            possiblescore += e*3;
        !          6029:            obj->flags |= CLOAKS;
        !          6030:            break;
        !          6031:        }
        !          6032:        if (!enemies)
        !          6033:            enemies = obj;
        !          6034:        if (!movers)
        !          6035:            movers = obj;
        !          6036:     }
        !          6037:     numgorns = inumgorns;
        !          6038:     for (i=0; i<numfriends; i++) {
        !          6039:        do {
        !          6040:            x = rand_mod(XSIZE);
        !          6041:            y = rand_mod(YSIZE);
        !          6042:        } while (occupant[y][x]);
        !          6043:        e = 250 + (sm50-1) * 30 * 20 / numenemies+1;
        !          6044: #ifndef lint
        !          6045:        e = exdis((int)e) + e - exdis((int)e);
        !          6046: #endif
        !          6047:        {
        !          6048:            static char let[] = "QWYUISDHJLZVMFFFFFFFFF";
        !          6049: 
        !          6050:            dist = rand_mod(20);
        !          6051:            ch = let[dist];
        !          6052:        }               /* grr, venix doesn't like indexing into string */
        !          6053:        obj = make_object(Enemy,ch,y,x,0,0,
        !          6054:            e + rand_mod(super*200+2),e/4,&root);
        !          6055:        if (numpirates-- > 0) {
        !          6056:            obj->flags |= PIRATE;
        !          6057:            if (smarts >= 20 && !rand_mod(10-smarts/10))
        !          6058:                obj->flags |= CLOAKS;
        !          6059:        }
        !          6060:        obj->flags |= FRIENDLY;
        !          6061:        if (!enemies)
        !          6062:            enemies = obj;
        !          6063:        if (!movers)
        !          6064:            movers = obj;
        !          6065:     }
        !          6066:     if (!movers)
        !          6067:        movers = &root;
        !          6068:     if (!enemies)
        !          6069:        enemies = &root;
        !          6070:     if (ent)
        !          6071:        mvaddch(ent->posy+1, ent->posx*2, ent->image);
        !          6072:     if (base)
        !          6073:        mvaddch(base->posy+1, base->posx*2, base->image);
        !          6074:     sleep(2);
        !          6075:     {
        !          6076:        Reg7 OBJECT *curobj;
        !          6077: 
        !          6078:        for (curobj = root.next; curobj != &root; curobj = curobj->next) {
        !          6079:            mvaddch(curobj->posy+1, curobj->posx*2, curobj->image);
        !          6080:        }
        !          6081:     }
        !          6082: 
        !          6083:     for (i=0;i<2;i++) for (y=0;y<3;y++) for (x=0;x<3;x++) 
        !          6084:     isatorp[i][y][x]=0;
        !          6085: 
        !          6086:     whenok = 0;
        !          6087:     timer = 0;
        !          6088:     finish = 0;
        !          6089:     bombed_out = FALSE;
        !          6090:     if (ent)
        !          6091:        entmode = status = 0;
        !          6092:     else
        !          6093:        if (base)
        !          6094:            status = 2;
        !          6095:        else
        !          6096:            status = 3;
        !          6097: 
        !          6098:     Sprintf(spbuf,
        !          6099:     "%-4s E: %4d %2d B: %5d %3d Enemies: %-3d Stars: %-3d Stardate%5d.%1d %9ld",
        !          6100:        "   ", 0, 0, 0, 0, 0, 0, smarts * 100, 0, 0L);
        !          6101:     mvaddstr(0,0,spbuf);
        !          6102:     oldeenergy = oldbenergy = oldcurscore =
        !          6103:     oldstatus = oldetorp = oldbtorp = oldstrs = oldenemies = -1;
        !          6104:                                        /* force everything to fill in */
        !          6105:     damage = olddamage = 0;
        !          6106:     for (i=0; i<MAXDAMAGE; i++)
        !          6107:        damflag[i] = 0;
        !          6108:     btorp = 500;
        !          6109:     etorp = 50;
        !          6110: }
        !          6111: ode = status = 0;
        !          6112:     else
        !          6113:        if (bawarp/intrp.c   644    171      5       33764  5121750045   6370 /* $Header: intrp.c,v 7.0.1.2 86/12/12 16:59:04 lwall Exp $
        !          6114:  *
        !          6115:  * $Log:       intrp.c,v $
        !          6116:  * Revision 7.0.1.2  86/12/12  16:59:04  lwall
        !          6117:  * Baseline for net release.
        !          6118:  * 
        !          6119:  * Revision 7.0.1.1  86/10/16  10:51:43  lwall
        !          6120:  * Added Damage.  Fixed random bugs.
        !          6121:  * 
        !          6122:  * Revision 7.0  86/10/08  15:12:19  lwall
        !          6123:  * Split into separate files.  Added amoebas and pirates.
        !          6124:  * 
        !          6125:  */
        !          6126: 
        !          6127: #include "EXTERN.h"
        !          6128: #include "warp.h"
        !          6129: #include "sig.h"
        !          6130: #include "util.h"
        !          6131: #include "term.h"
        !          6132: #include "INTERN.h"
        !          6133: #include "intrp.h"
        !          6134: 
        !          6135: /* name of this host */
        !          6136: #ifdef GETHOSTNAME
        !          6137:     char *hostname;
        !          6138: #   undef HOSTNAME
        !          6139: #   define HOSTNAME hostname
        !          6140: #else /* !GETHOSTNAME */
        !          6141: #   ifdef DOUNAME
        !          6142: #      include <sys/utsname.h>
        !          6143:        struct utsname uts;
        !          6144: #      undef HOSTNAME
        !          6145: #      define HOSTNAME uts.nodename
        !          6146: #   else /* !DOUNAME */
        !          6147: #      ifdef PHOSTNAME
        !          6148:            char *hostname;
        !          6149: #          undef HOSTNAME
        !          6150: #          define HOSTNAME hostname
        !          6151: #      else /* !PHOSTNAME */
        !          6152: #          ifdef WHOAMI
        !          6153: #              undef HOSTNAME
        !          6154: #              define HOSTNAME sysname
        !          6155: #          endif /* WHOAMI */
        !          6156: #      endif /* PHOSTNAME */
        !          6157: #   endif /* DOUNAME */
        !          6158: #endif /* GETHOSTNAME */
        !          6159: 
        !          6160: #ifdef TILDENAME
        !          6161: static char *tildename = Nullch;
        !          6162: static char *tildedir = Nullch;
        !          6163: #endif
        !          6164: 
        !          6165: char *dointerp();
        !          6166: char *getrealname();
        !          6167: #ifdef CONDSUB
        !          6168: char *skipinterp();
        !          6169: #endif
        !          6170: 
        !          6171: static void abort_interp();
        !          6172: 
        !          6173: void
        !          6174: intrp_init(tcbuf)
        !          6175: char *tcbuf;
        !          6176: {
        !          6177:     char *getlogin();
        !          6178: 
        !          6179:     /* get environmental stuff */
        !          6180: 
        !          6181:     /* get home directory */
        !          6182: 
        !          6183:     homedir = getenv("HOME");
        !          6184:     if (homedir == Nullch)
        !          6185:        homedir = getenv("LOGDIR");
        !          6186: 
        !          6187:     dotdir = getval("DOTDIR",homedir);
        !          6188: 
        !          6189:     /* get login name */
        !          6190: 
        !          6191:     logname = getenv("USER");
        !          6192:     if (logname == Nullch)
        !          6193:        logname = getenv("LOGNAME");
        !          6194: #ifdef GETLOGIN
        !          6195:     if (logname == Nullch)
        !          6196:        logname = savestr(getlogin());
        !          6197: #endif
        !          6198:     
        !          6199:     /* get the real name of the person (%N) */
        !          6200:     /* Must be done after logname is read in because BERKNAMES uses that */
        !          6201: 
        !          6202:     strcpy(tcbuf,getrealname(getuid()));
        !          6203:     realname = savestr(tcbuf);
        !          6204: 
        !          6205:     /* name of this host (%H) */
        !          6206: 
        !          6207: #ifdef GETHOSTNAME
        !          6208:     gethostname(buf,sizeof buf);
        !          6209:     hostname = savestr(buf);
        !          6210: #else
        !          6211: #ifdef DOUNAME
        !          6212:     /* get sysname */
        !          6213:     uname(&uts);
        !          6214: #else
        !          6215: #ifdef PHOSTNAME
        !          6216:     {
        !          6217:        FILE *popen();
        !          6218:        FILE *pipefp = popen(PHOSTNAME,"r");
        !          6219:        
        !          6220:        if (pipefp == Nullfp) {
        !          6221:            printf("Can't find hostname\r\n");
        !          6222:            sig_catcher(0);
        !          6223:        }
        !          6224:        Fgets(buf,sizeof buf,pipefp);
        !          6225:        buf[strlen(buf)-1] = '\0';      /* wipe out newline */
        !          6226:        hostname = savestr(buf);
        !          6227:        pclose(pipefp);
        !          6228:     }
        !          6229: #endif
        !          6230: #endif
        !          6231: #endif
        !          6232:     if (index(HOSTNAME,'.'))
        !          6233:        hostname = savestr(HOSTNAME);
        !          6234:     else {
        !          6235:        char hname[128];
        !          6236: 
        !          6237:        strcpy(hname,HOSTNAME);
        !          6238:        strcat(hname,MYDOMAIN);
        !          6239:        hostname=savestr(hname);
        !          6240:     }
        !          6241:     warplib = savestr(filexp(WARPLIB));
        !          6242: 
        !          6243:     if (scorespec)                     /* that getwd below takes ~1/3 sec. */
        !          6244:        return;                         /* and we do not need it for -s */
        !          6245:     (void) getwd(tcbuf);               /* find working directory name */
        !          6246:     origdir = savestr(tcbuf);          /* and remember it */
        !          6247: }
        !          6248: 
        !          6249: /* expand filename via %, ~, and $ interpretation */
        !          6250: /* returns pointer to static area */
        !          6251: /* Note that there is a 1-deep cache of ~name interpretation */
        !          6252: 
        !          6253: char *
        !          6254: filexp(s)
        !          6255: Reg1 char *s;
        !          6256: {
        !          6257:     static char filename[CBUFLEN];
        !          6258:     char scrbuf[CBUFLEN];
        !          6259:     Reg2 char *d;
        !          6260: 
        !          6261: #ifdef DEBUGGING
        !          6262:     if (debug & DEB_FILEXP)
        !          6263:        printf("< %s\r\n",s);
        !          6264: #endif
        !          6265:     interp(filename, (sizeof filename), s);                    /* interpret any % escapes */
        !          6266: #ifdef DEBUGGING
        !          6267:     if (debug & DEB_FILEXP)
        !          6268:        printf("%% %s\r\n",filename);
        !          6269: #endif
        !          6270:     s = filename;
        !          6271:     if (*s == '~') {   /* does destination start with ~? */
        !          6272:        if (!*(++s) || *s == '/') {
        !          6273:            Sprintf(scrbuf,"%s%s",homedir,s);
        !          6274:                                /* swap $HOME for it */
        !          6275: #ifdef DEBUGGING
        !          6276:     if (debug & DEB_FILEXP)
        !          6277:        printf("~ %s\r\n",scrbuf);
        !          6278: #endif
        !          6279:            strcpy(filename,scrbuf);
        !          6280:        }
        !          6281:        else {
        !          6282: #ifdef TILDENAME
        !          6283:            for (d=scrbuf; isalnum(*s); s++,d++)
        !          6284:                *d = *s;
        !          6285:            *d = '\0';
        !          6286:            if (tildedir && strEQ(tildename,scrbuf)) {
        !          6287:                strcpy(scrbuf,tildedir);
        !          6288:                strcat(scrbuf, s);
        !          6289:                strcpy(filename, scrbuf);
        !          6290: #ifdef DEBUGGING
        !          6291:                if (debug & DEB_FILEXP)
        !          6292:                    printf("r %s %s\r\n",tildename,tildedir);
        !          6293: #endif
        !          6294:            }
        !          6295:            else {
        !          6296:                if (tildename) {
        !          6297:                    free(tildename);
        !          6298:                    free(tildedir);
        !          6299:                }
        !          6300:                tildedir = Nullch;
        !          6301:                tildename = savestr(scrbuf);
        !          6302: #ifdef GETPWENT                /* getpwnam() is not the paragon of efficiency */
        !          6303:                {
        !          6304:                    struct passwd *getpwnam();
        !          6305:                    struct passwd *pwd = getpwnam(tildename);
        !          6306: 
        !          6307:                    Sprintf(scrbuf,"%s%s",pwd->pw_dir,s);
        !          6308:                    tildedir = savestr(pwd->pw_dir);
        !          6309:                    strcpy(filename,scrbuf);
        !          6310: #ifdef GETPWENT
        !          6311:                    endpwent();
        !          6312: #endif
        !          6313:                }
        !          6314: #else                  /* this will run faster, and is less D space */
        !          6315:                {       /* just be sure LOGDIRFIELD is correct */
        !          6316:                    FILE *pfp = fopen("/etc/passwd","r");
        !          6317:                    char tmpbuf[512];
        !          6318:                    int i;
        !          6319:                    
        !          6320:                    if (pfp == Nullfp) {
        !          6321:                        printf(cantopen,"passwd");
        !          6322:                        sig_catcher(0);
        !          6323:                    }
        !          6324:                    while (fgets(tmpbuf,512,pfp) != Nullch) {
        !          6325:                        d = cpytill(scrbuf,tmpbuf,':');
        !          6326: #ifdef DEBUGGING
        !          6327:                        if (debug & DEB_FILEXP)
        !          6328:                            printf("p %s\r\n",tmpbuf);
        !          6329: #endif
        !          6330:                        if (strEQ(scrbuf,tildename)) {
        !          6331:                            for (i=LOGDIRFIELD-2; i; i--) {
        !          6332:                                if (d)
        !          6333:                                    d = index(d+1,':');
        !          6334:                            }
        !          6335:                            if (d) {
        !          6336:                                Cpytill(scrbuf,d+1,':');
        !          6337:                                tildedir = savestr(scrbuf);
        !          6338:                                strcat(scrbuf,s);
        !          6339:                                strcpy(filename,scrbuf);
        !          6340:                            }
        !          6341:                            break;
        !          6342:                        }
        !          6343:                    }
        !          6344:                    Fclose(pfp);
        !          6345:                }
        !          6346: #endif
        !          6347:            }
        !          6348: #else /* !TILDENAME */
        !          6349: #ifdef VERBOSE
        !          6350:            IF(verbose)
        !          6351:                fputs("~loginname not implemented.\r\n",stdout);
        !          6352:            ELSE
        !          6353: #endif
        !          6354: #ifdef TERSE
        !          6355:                fputs("~login not impl.\r\n",stdout);
        !          6356: #endif
        !          6357: #endif
        !          6358:        }
        !          6359:     }
        !          6360:     else if (*s == '$') {      /* starts with some env variable? */
        !          6361:        d = scrbuf;
        !          6362:        *d++ = '%';
        !          6363:        if (s[1] == '{')
        !          6364:            strcpy(d,s+2);
        !          6365:        else {
        !          6366:            *d++ = '{';
        !          6367:            for (s++; isalnum(*s); s++) *d++ = *s;
        !          6368:                                /* skip over token */
        !          6369:            *d++ = '}';
        !          6370:            strcpy(d,s);
        !          6371:        }
        !          6372: #ifdef DEBUGGING
        !          6373:        if (debug & DEB_FILEXP)
        !          6374:            printf("$ %s\r\n",scrbuf);
        !          6375: #endif
        !          6376:        interp(filename, (sizeof filename), scrbuf);
        !          6377:                                        /* this might do some extra '%'s but */
        !          6378:                                        /* that is how the Mercedes Benz */
        !          6379:     }
        !          6380: #ifdef DEBUGGING
        !          6381:     if (debug & DEB_FILEXP)
        !          6382:        printf("> %s\r\n",filename);
        !          6383: #endif
        !          6384:     return filename;
        !          6385: }
        !          6386: 
        !          6387: #ifdef CONDSUB
        !          6388: /* skip interpolations */
        !          6389: 
        !          6390: char *
        !          6391: skipinterp(pattern,stoppers)
        !          6392: Reg1 char *pattern;
        !          6393: char *stoppers;
        !          6394: {
        !          6395: 
        !          6396:     while (*pattern && (!stoppers || !index(stoppers,*pattern))) {
        !          6397: #ifdef DEBUGGING
        !          6398:        if (debug & 8)
        !          6399:            printf("skipinterp till %s at %s\r\n",stoppers?stoppers:"",pattern);
        !          6400: #endif
        !          6401:        if (*pattern == '%' && pattern[1]) {
        !          6402:            switch (*++pattern) {
        !          6403:            case '{':
        !          6404:                for (pattern++; *pattern && *pattern != '}'; pattern++)
        !          6405:                    if (*pattern == '\\')
        !          6406:                        pattern++;
        !          6407:                break;
        !          6408: #ifdef CONDSUB
        !          6409:            case '(': {
        !          6410:                pattern = skipinterp(pattern+1,"!=");
        !          6411:                if (!*pattern)
        !          6412:                    goto getout;
        !          6413:                for (pattern++; *pattern && *pattern != '?'; pattern++)
        !          6414:                    if (*pattern == '\\')
        !          6415:                        pattern++;
        !          6416:                if (!*pattern)
        !          6417:                    goto getout;
        !          6418:                pattern = skipinterp(pattern+1,":)");
        !          6419:                if (*pattern == ':')
        !          6420:                    pattern = skipinterp(pattern+1,")");
        !          6421:                break;
        !          6422:            }
        !          6423: #endif
        !          6424: #ifdef BACKTICK
        !          6425:            case '`': {
        !          6426:                pattern = skipinterp(pattern+1,"`");
        !          6427:                break;
        !          6428:            }
        !          6429: #endif
        !          6430: #ifdef PROMPTTTY
        !          6431:            case '"':
        !          6432:                pattern = skipinterp(pattern+1,"\"");
        !          6433:                break;
        !          6434: #endif
        !          6435:            default:
        !          6436:                break;
        !          6437:            }
        !          6438:            pattern++;
        !          6439:        }
        !          6440:        else {
        !          6441:            if (*pattern == '^' && pattern[1])
        !          6442:                pattern += 2;
        !          6443:            else if (*pattern == '\\' && pattern[1])
        !          6444:                pattern += 2;
        !          6445:            else
        !          6446:                pattern++;
        !          6447:        }
        !          6448:     }
        !          6449: getout:
        !          6450:     return pattern;                    /* where we left off */
        !          6451: }
        !          6452: #endif
        !          6453: 
        !          6454: /* interpret interpolations */
        !          6455: 
        !          6456: char *
        !          6457: dointerp(dest,destsize,pattern,stoppers)
        !          6458: Reg1 char *dest;
        !          6459: Reg2 int destsize;
        !          6460: Reg3 char *pattern;
        !          6461: char *stoppers;
        !          6462: {
        !          6463:     Reg4 char *s;
        !          6464:     Reg5 int i;
        !          6465:     char scrbuf[512];
        !          6466:     bool upper = FALSE;
        !          6467:     bool lastcomp = FALSE;
        !          6468:     int metabit = 0;
        !          6469: 
        !          6470:     while (*pattern && (!stoppers || !index(stoppers,*pattern))) {
        !          6471: #ifdef DEBUGGING
        !          6472:        if (debug & 8)
        !          6473:            printf("dointerp till %s at %s\r\n",stoppers?stoppers:"",pattern);
        !          6474: #endif
        !          6475:        if (*pattern == '%' && pattern[1]) {
        !          6476:            upper = FALSE;
        !          6477:            lastcomp = FALSE;
        !          6478:            for (s=Nullch; !s; ) {
        !          6479:                switch (*++pattern) {
        !          6480:                case '^':
        !          6481:                    upper = TRUE;
        !          6482:                    break;
        !          6483:                case '_':
        !          6484:                    lastcomp = TRUE;
        !          6485:                    break;
        !          6486:                case '{':
        !          6487:                    pattern = cpytill(scrbuf,pattern+1,'}');
        !          6488:                    if (s = index(scrbuf,'-'))
        !          6489:                        *s++ = '\0';
        !          6490:                    else
        !          6491:                        s = nullstr;
        !          6492:                    s = getval(scrbuf,s);
        !          6493:                    break;
        !          6494: #ifdef CONDSUB
        !          6495:                case '(': {
        !          6496:                    char rch;
        !          6497:                    bool matched;
        !          6498:                    
        !          6499:                    pattern = dointerp(dest,destsize,pattern+1,"!=");
        !          6500:                    rch = *pattern;
        !          6501:                    if (rch == '!')
        !          6502:                        pattern++;
        !          6503:                    if (*pattern != '=')
        !          6504:                        goto getout;
        !          6505:                    pattern = cpytill(scrbuf,pattern+1,'?');
        !          6506:                    if (!*pattern)
        !          6507:                        goto getout;
        !          6508:                    if (*scrbuf == '^' && scrbuf[strlen(scrbuf)-1] == '$') {
        !          6509:                        scrbuf[strlen(scrbuf)-1] = '\0';
        !          6510:                        matched = strEQ(scrbuf+1,dest);
        !          6511:                    }
        !          6512:                    else
        !          6513:                        matched = instr(dest,scrbuf) != Nullch;
        !          6514:                    if (matched==(rch == '=')) {
        !          6515:                        pattern = dointerp(dest,destsize,pattern+1,":)");
        !          6516:                        if (*pattern == ':')
        !          6517:                            pattern = skipinterp(pattern+1,")");
        !          6518:                    }
        !          6519:                    else {
        !          6520:                        pattern = skipinterp(pattern+1,":)");
        !          6521:                        if (*pattern == ':')
        !          6522:                            pattern++;
        !          6523:                        pattern = dointerp(dest,destsize,pattern,")");
        !          6524:                    }
        !          6525:                    s = dest;
        !          6526:                    break;
        !          6527:                }
        !          6528: #endif
        !          6529: #ifdef BACKTICK
        !          6530:                case '`': {
        !          6531:                    FILE *pipefp, *popen();
        !          6532: 
        !          6533:                    pattern = dointerp(scrbuf,(sizeof scrbuf),pattern+1,"`");
        !          6534:                    pipefp = popen(scrbuf,"r");
        !          6535:                    if (pipefp != Nullfp) {
        !          6536:                        int len;
        !          6537: 
        !          6538:                        len = fread(scrbuf,sizeof(char),(sizeof scrbuf)-1,
        !          6539:                            pipefp);
        !          6540:                        scrbuf[len] = '\0';
        !          6541:                        pclose(pipefp);
        !          6542:                    }
        !          6543:                    else {
        !          6544:                        printf("\r\nCan't run %s\r\n",scrbuf);
        !          6545:                        *scrbuf = '\0';
        !          6546:                    }
        !          6547:                    for (s=scrbuf; *s; s++) {
        !          6548:                        if (*s == '\n') {
        !          6549:                            if (s[1])
        !          6550:                                *s = ' ';
        !          6551:                            else
        !          6552:                                *s = '\0';
        !          6553:                        }
        !          6554:                    }
        !          6555:                    s = scrbuf;
        !          6556:                    break;
        !          6557:                }
        !          6558: #endif
        !          6559: #ifdef PROMPTTTY
        !          6560:                case '"':
        !          6561:                    pattern = dointerp(scrbuf,(sizeof scrbuf),pattern+1,"\"");
        !          6562:                    fputs(scrbuf,stdout);
        !          6563:                    resetty();
        !          6564:                    gets(scrbuf);
        !          6565:                    crmode();
        !          6566:                    raw();
        !          6567:                    noecho();
        !          6568:                    nonl();
        !          6569:                    s = scrbuf;
        !          6570:                    break;
        !          6571: #endif
        !          6572:                case '~':
        !          6573:                    s = homedir;
        !          6574:                    break;
        !          6575:                case '.':
        !          6576:                    s = dotdir;
        !          6577:                    break;
        !          6578:                case '$':
        !          6579:                    s = scrbuf;
        !          6580:                    Sprintf(s,"%d",getpid());
        !          6581:                    break;
        !          6582:                case 'H':                       /* host name */
        !          6583:                    s = hostname;
        !          6584:                    break;
        !          6585:                case 'L':                       /* login id */
        !          6586:                    s = logname;
        !          6587:                    break;
        !          6588:                case 'N':                       /* full name */
        !          6589:                    s = getval("NAME",realname);
        !          6590:                    break;
        !          6591:                case 'O':
        !          6592:                    s = origdir;
        !          6593:                    break;
        !          6594:                case 'p':
        !          6595:                    s = cwd;
        !          6596:                    break;
        !          6597:                case 'X':                       /* warp library */
        !          6598:                    s = warplib;
        !          6599:                    break;
        !          6600:                default:
        !          6601:                    if (--destsize <= 0)
        !          6602:                        abort_interp();
        !          6603:                    *dest++ = *pattern | metabit;
        !          6604:                    s = nullstr;
        !          6605:                    break;
        !          6606:                }
        !          6607:            }
        !          6608:            if (!s)
        !          6609:                s = nullstr;
        !          6610:            pattern++;
        !          6611:            if (upper || lastcomp) {
        !          6612:                char *t;
        !          6613: 
        !          6614:                if (s != scrbuf) {
        !          6615:                    Safecpy(scrbuf,s,(sizeof scrbuf));
        !          6616:                    s = scrbuf;
        !          6617:                }
        !          6618:                if (upper || !(t=rindex(s,'/')))
        !          6619:                    t = s;
        !          6620:                while (*t && !isalpha(*t))
        !          6621:                    t++;
        !          6622:                if (islower(*t))
        !          6623:                    *t = toupper(*t);
        !          6624:            }
        !          6625:            i = metabit;                /* maybe get into register */
        !          6626:            if (s == dest) {
        !          6627:                while (*dest) {
        !          6628:                    if (--destsize <= 0)
        !          6629:                        abort_interp();
        !          6630:                    *dest++ |= i;
        !          6631:                }
        !          6632:            }
        !          6633:            else {
        !          6634:                while (*s) {
        !          6635:                    if (--destsize <= 0)
        !          6636:                        abort_interp();
        !          6637:                    *dest++ = *s++ | i;
        !          6638:                }
        !          6639:            }
        !          6640:        }
        !          6641:        else {
        !          6642:            if (--destsize <= 0)
        !          6643:                abort_interp();
        !          6644:            if (*pattern == '^' && pattern[1]) {
        !          6645:                ++pattern;                      /* skip uparrow */
        !          6646:                i = *pattern;           /* get char into a register */
        !          6647:                if (i == '?')
        !          6648:                    *dest++ = '\177' | metabit;
        !          6649:                else if (i == '(') {
        !          6650:                    metabit = 0200;
        !          6651:                    destsize++;
        !          6652:                }
        !          6653:                else if (i == ')') {
        !          6654:                    metabit = 0;
        !          6655:                    destsize++;
        !          6656:                }
        !          6657:                else
        !          6658:                    *dest++ = i & 037 | metabit;
        !          6659:                pattern++;
        !          6660:            }
        !          6661:            else if (*pattern == '\\' && pattern[1]) {
        !          6662:                ++pattern;                      /* skip backslash */
        !          6663:                i = *pattern;           /* get char into a register */
        !          6664:     
        !          6665:                /* this used to be a switch but the if may save space */
        !          6666:                
        !          6667:                if (i >= '0' && i <= '7') {
        !          6668:                    i = 1;
        !          6669:                    while (i < 01000 && *pattern >= '0' && *pattern <= '7') {
        !          6670:                        i <<= 3;
        !          6671:                        i += *pattern++ - '0';
        !          6672:                    }
        !          6673:                    *dest++ = i & 0377 | metabit;
        !          6674:                    --pattern;
        !          6675:                }
        !          6676:                else if (i == 'b')
        !          6677:                    *dest++ = '\b' | metabit;
        !          6678:                else if (i == 'f')
        !          6679:                    *dest++ = '\f' | metabit;
        !          6680:                else if (i == 'n')
        !          6681:                    *dest++ = '\n' | metabit;
        !          6682:                else if (i == 'r')
        !          6683:                    *dest++ = '\r' | metabit;
        !          6684:                else if (i == 't')
        !          6685:                    *dest++ = '\t' | metabit;
        !          6686:                else
        !          6687:                    *dest++ = i | metabit;
        !          6688:                pattern++;
        !          6689:            }
        !          6690:            else
        !          6691:                *dest++ = *pattern++ | metabit;
        !          6692:        }
        !          6693:     }
        !          6694:     *dest = '\0';
        !          6695: getout:
        !          6696:     return pattern;                    /* where we left off */
        !          6697: }
        !          6698: 
        !          6699: void
        !          6700: interp(dest,destsize,pattern)
        !          6701: char *dest;
        !          6702: int destsize;
        !          6703: char *pattern;
        !          6704: {
        !          6705:     (void) dointerp(dest,destsize,pattern,Nullch);
        !          6706: #ifdef DEBUGGING
        !          6707:     if (debug & DEB_FILEXP)
        !          6708:        fputs(dest,stdout);
        !          6709: #endif
        !          6710: }
        !          6711: 
        !          6712: /* get the person's real name from /etc/passwd */
        !          6713: /* (string is overwritten, so it must be copied) */
        !          6714: 
        !          6715: char *
        !          6716: getrealname(uid)
        !          6717: int uid;
        !          6718: {
        !          6719:     char *s, *c;
        !          6720: 
        !          6721: #ifdef PASSNAMES
        !          6722: #ifdef GETPWENT
        !          6723:     struct passwd *pwd = getpwuid(uid);
        !          6724:     
        !          6725:     s = pwd->pw_gecos;
        !          6726: #else
        !          6727:     char tmpbuf[512];
        !          6728:     int i;
        !          6729: 
        !          6730:     getpw(uid, tmpbuf);
        !          6731:     for (s=tmpbuf, i=GCOSFIELD-1; i; i--) {
        !          6732:        if (s)
        !          6733:            s = index(s,':')+1;
        !          6734:     }
        !          6735:     if (!s)
        !          6736:        return nullstr;
        !          6737:     Cpytill(tmpbuf,s,':');
        !          6738:     s = tmpbuf;
        !          6739: #endif
        !          6740: #ifdef BERKNAMES
        !          6741: #ifdef BERKJUNK
        !          6742:     while (*s && !isalnum(*s) && *s != '&') s++;
        !          6743: #endif
        !          6744:     if ((c = index(s, ',')) != Nullch)
        !          6745:        *c = '\0';
        !          6746:     if ((c = index(s, ';')) != Nullch)
        !          6747:        *c = '\0';
        !          6748:     s = cpytill(buf,s,'&');
        !          6749:     if (*s == '&') {                   /* whoever thought this one up was */
        !          6750:        c = buf + strlen(buf);          /* in the middle of the night */
        !          6751:        strcat(c,logname);              /* before the morning after */
        !          6752:        strcat(c,s+1);
        !          6753:        if (islower(*c))
        !          6754:            *c = toupper(*c);           /* gack and double gack */
        !          6755:     }
        !          6756: #else
        !          6757:     if ((c = index(s, '(')) != Nullch)
        !          6758:        *c = '\0';
        !          6759:     if ((c = index(s, '-')) != Nullch)
        !          6760:        s = c;
        !          6761:     strcpy(buf,tmpbuf);
        !          6762: #endif
        !          6763: #ifdef GETPWENT
        !          6764:     endpwent();
        !          6765: #endif
        !          6766:     return buf;                                /* return something static */
        !          6767: #else
        !          6768:     if ((tmpfp=fopen(filexp(FULLNAMEFILE),"r")) != Nullfp) {
        !          6769:        Fgets(buf,sizeof buf,tmpfp);
        !          6770:        Fclose(tmpfp);
        !          6771:     }
        !          6772:     else {
        !          6773:        resetty();
        !          6774:        printf("What is your name? ");
        !          6775:        Fgets(buf,(sizeof buf),stdin);
        !          6776:        crmode();
        !          6777:        raw();
        !          6778:        noecho();
        !          6779:        nonl();
        !          6780:        if (fork())
        !          6781:            wait(0);
        !          6782:        else {
        !          6783:            setuid(getuid());
        !          6784:            if ((tmpfp = fopen(filexp(FULLNAMEFILE),"w")) == NULL)
        !          6785:                exit(1);
        !          6786:            fprintf(tmpfp, "%s\n", buf);
        !          6787:            Fclose(tmpfp);
        !          6788:            exit(0);
        !          6789:        }
        !          6790:     }
        !          6791:     buf[strlen(buf)-1] = '\0';
        !          6792:     return buf;
        !          6793: #endif
        !          6794: }
        !          6795: 
        !          6796: static void
        !          6797: abort_interp()
        !          6798: {
        !          6799:     fputs("\r\n% interp buffer overflow!\r\n",stdout);
        !          6800:     sig_catcher(0);
        !          6801: }
        !          6802: se(tmpfp);
        !          6803:  warp/warp.h   644    171      5       25033  5121750052   6176 /* $Header: warp.h,v 7.0.1.2 86/12/12 17:08:42 lwall Exp $ */
        !          6804: 
        !          6805: /* $Log:       warp.h,v $
        !          6806:  * Revision 7.0.1.2  86/12/12  17:08:42  lwall
        !          6807:  * Baseline for net release.
        !          6808:  * 
        !          6809:  * Revision 7.0.1.1  86/10/16  10:54:26  lwall
        !          6810:  * Added Damage.  Fixed random bugs.
        !          6811:  * 
        !          6812:  * Revision 7.0  86/10/08  15:17:55  lwall
        !          6813:  * Split into separate files.  Added amoebas and pirates.
        !          6814:  * 
        !          6815:  */
        !          6816: 
        !          6817: extern int errno;
        !          6818: 
        !          6819: #include "config.h"    /* generated by Configure script */
        !          6820: 
        !          6821: #include <stdio.h>
        !          6822: #include <signal.h>
        !          6823: #include <ctype.h>
        !          6824: #include <sys/types.h>
        !          6825: #include <sys/stat.h>
        !          6826: #include <errno.h> 
        !          6827: 
        !          6828: /* WARPLIB must be readable and writeable by warp, but not by anyone who you
        !          6829:  * don't trust.  In other words, to set up warp so everyone can play and
        !          6830:  * no one can cheat, give warp a uid of its own and make warp setuid to
        !          6831:  * that uid.  WARPLIB must then NOT be made writeable by the world,
        !          6832:  * since no attempt is made to encrypt saved games or anything.
        !          6833:  * (It must be readable by the world, however, due to a strangeness in
        !          6834:  * access.)
        !          6835:  */
        !          6836: 
        !          6837: #define SAVEDIR "./"
        !          6838: #define NEWSFILE "warp.news"
        !          6839: #define HELPFILE "warp.doc"
        !          6840: #define LOCKFILE ".warp.lock"
        !          6841: #define LOGFILE "warp.log"
        !          6842: #define SCOREBOARD "warp.top"
        !          6843: #define LSCOREBOARD "warp.lowtop"
        !          6844: #define FSCOREBOARD "warp.funtop"
        !          6845: #define TMPSCOREBOARD "warp.topnew"
        !          6846: #define WARPMACRO "%X/Kbmap.%{TERM}"
        !          6847: 
        !          6848: /* warp library */
        !          6849: #ifndef WARPLIB                /* ~ and %l only ("~%l" is permissable) */
        !          6850: #   ifdef PRIVLIB
        !          6851: #      define WARPLIB PRIVLIB
        !          6852: #   else
        !          6853: #      define WARPLIB "/usr/games/warp"
        !          6854: #   endif
        !          6855: #endif
        !          6856: 
        !          6857: EXT char *warplib;
        !          6858: 
        !          6859: #define PERMMAPS 8     /* how many starmaps are permanent */
        !          6860: #define MAPS 20                /* how many starmaps to choose from */
        !          6861:                        /* (MAPS - PERMMAPS is # of half-gone universes) */
        !          6862: 
        !          6863: /*
        !          6864:  * Screen size info, minimum screen size is 23x40 (actually 24x80).
        !          6865:  * YSIZE and XSIZE should be relatively prime so that a torpedo launched
        !          6866:  * at an angle will eventually cover the whole screen.
        !          6867:  * To calculate a new position for something:
        !          6868:  * new_position = (current_position + delta + ?SIZE00) % ?SIZE
        !          6869:  * This allows for negative deltas of up to ?SIZE00 (% doesn't work right
        !          6870:  * on negative numbers).
        !          6871:  * ?SIZE01, etc. are fudges for efficiency--they already include a delta.
        !          6872:  */
        !          6873: 
        !          6874: #define XYSIZE 920
        !          6875: #define XYSIZEx4 3680
        !          6876: 
        !          6877: #define YSIZE   23
        !          6878: #define YSIZE00 2300
        !          6879: #define YSIZE01 2301
        !          6880: #define YSIZE99 2299
        !          6881: 
        !          6882: #define XSIZE   40
        !          6883: #define XSIZE00 4000
        !          6884: #define XSIZE01 4001
        !          6885: #define XSIZE99 3999
        !          6886: #define XSIZE02 4002
        !          6887: #define XSIZE98 3998
        !          6888: #define XSIZE03 4003
        !          6889: #define XSIZE97 3997
        !          6890: #define XSIZE08 4008
        !          6891: #define XSIZE92 3992
        !          6892: 
        !          6893: EXT char amb[YSIZE][XSIZE];
        !          6894: 
        !          6895: #ifdef WHOAMI
        !          6896: #    include <whoami.h>
        !          6897: #endif
        !          6898: 
        !          6899: #ifndef isalnum
        !          6900: #   define isalnum(c) (isalpha(c) || isdigit(c))
        !          6901: #endif
        !          6902: 
        !          6903: #ifdef IOCTL
        !          6904: #include <sys/ioctl.h>
        !          6905: #endif /* IOCTL */
        !          6906: 
        !          6907: #ifdef FCNTL
        !          6908: #   include <fcntl.h>
        !          6909: #endif
        !          6910: 
        !          6911: #ifdef TERMIO
        !          6912: #   include <termio.h>
        !          6913: #else
        !          6914: #   include <sgtty.h>
        !          6915: #endif
        !          6916: 
        !          6917: #ifdef FTIMER
        !          6918: #include <sys/timeb.h>
        !          6919: #endif
        !          6920: 
        !          6921: #ifdef GETPWENT
        !          6922: #   include <pwd.h>
        !          6923: #endif
        !          6924: 
        !          6925: #define BITSPERBYTE 8
        !          6926: #define LBUFLEN 512    /* line buffer length */
        !          6927: 
        !          6928: #ifdef pdp11
        !          6929: #   define CBUFLEN 256 /* command buffer length */
        !          6930: #   define PUSHSIZE 128
        !          6931: #else
        !          6932: #   define CBUFLEN 512 /* command buffer length */
        !          6933: #   define PUSHSIZE 256
        !          6934: #endif
        !          6935: #ifdef pdp11
        !          6936: #   define MAXFILENAME 128
        !          6937: #else
        !          6938: #   define MAXFILENAME 512
        !          6939: #endif
        !          6940: #define FINISHCMD 0177
        !          6941: 
        !          6942: /* some handy defs */
        !          6943: 
        !          6944: #define bool char
        !          6945: #define TRUE (1)
        !          6946: #define FALSE (0)
        !          6947: #define Null(t) ((t)0)
        !          6948: #define Nullch Null(char *)
        !          6949: #define Nullfp Null(FILE *)
        !          6950: 
        !          6951: #define Ctl(ch) (ch & 037)
        !          6952: 
        !          6953: #define strNE(s1,s2) (strcmp(s1,s2))
        !          6954: #define strEQ(s1,s2) (!strcmp(s1,s2))
        !          6955: #define strnNE(s1,s2,l) (strncmp(s1,s2,l))
        !          6956: #define strnEQ(s1,s2,l) (!strncmp(s1,s2,l))
        !          6957: 
        !          6958: #define sgn(x) ((x) < 0 ? -1 : (x) > 0)
        !          6959: 
        !          6960: /* Things we can figure out ourselves */
        !          6961: 
        !          6962: #ifdef SIGPROF
        !          6963: #   define BSD42               /* do we have Berkeley 4.2? */
        !          6964: #endif
        !          6965: 
        !          6966: #ifdef FIONREAD
        !          6967: #   define PENDING
        !          6968: #else
        !          6969: #   ifdef O_NDELAY
        !          6970: #      define PENDING
        !          6971: #   else
        !          6972: #      ifdef RDCHK
        !          6973: #          define PENDING
        !          6974: #      endif
        !          6975: #   endif
        !          6976: #endif
        !          6977: 
        !          6978: #ifdef EUNICE
        !          6979: #   define UNLINK(victim) while (!unlink(victim))
        !          6980: #else
        !          6981: #   define UNLINK(victim) unlink(victim)
        !          6982: #endif
        !          6983: 
        !          6984: /* Valid substitutions for strings marked with % comment are:
        !          6985:  *     %H      Host name (yours)
        !          6986:  *     %L      Login name (yours)
        !          6987:  *     %N      Full name (yours)
        !          6988:  *     %O      Original working directory (where you ran warp from)
        !          6989:  *     %X      Warp library directory
        !          6990:  *     %~      Home directory
        !          6991:  *     %.      Directory containing . files
        !          6992:  *     %$      current process number
        !          6993:  *     %{name} Environment variable "name".  %{name-default} form allowed.
        !          6994:  *     %"prompt"
        !          6995:  *             Print prompt and insert what is typed.
        !          6996:  *     %`command`
        !          6997:  *             Insert output of command.
        !          6998:  *     %(test_text=pattern?if_text:else_text)
        !          6999:  *             Substitute if_text if test_text matches pattern, otherwise
        !          7000:  *             substitute else_text.  Use != for negated match.
        !          7001:  *             % substitutions are done on test_text, if_text, and else_text.
        !          7002:  *             (Note: %() only works if CONDSUB defined.)
        !          7003:  */
        !          7004: 
        !          7005: /* *** System Dependent Stuff *** */
        !          7006: 
        !          7007: /* NOTE: many of these are defined in the config.h file */
        !          7008: 
        !          7009: #ifndef ROOTID
        !          7010: #   define ROOTID 0        /* uid of superuser */
        !          7011: #endif
        !          7012: 
        !          7013: #ifdef NORMSIG
        !          7014: #   define sigset Signal
        !          7015: #   define sigignore(sig) Signal(sig,SIG_IGN)
        !          7016: #endif
        !          7017: 
        !          7018: #ifndef LOGDIRFIELD
        !          7019: #   define LOGDIRFIELD 6               /* Which field (origin 1) is the */
        !          7020:                                        /* login directory in /etc/passwd? */
        !          7021:                                        /* (If it is not kept in passwd, */
        !          7022:                                        /* but getpwnam() returns it, */
        !          7023:                                        /* define the symbol GETPWENT) */
        !          7024: #endif
        !          7025: #ifndef GCOSFIELD
        !          7026: #   define GCOSFIELD 5
        !          7027: #endif
        !          7028: 
        !          7029: /* Undefine any of the following features to save both I and D space */
        !          7030: /* In general, earlier ones are easier to get along without */
        !          7031: /* Pdp11's without split I and D may have to undefine them all */
        !          7032: #define DEBUGGING      /* include debugging code */
        !          7033: #define PUSHBACK       /* macros and keymaps using pushback buffer */
        !          7034: #define CONDSUB                /* allow %(cond?text:text) */
        !          7035: #define BACKTICK       /* allow %`command` */
        !          7036: #define PROMPTTTY      /* allow %"prompt" */
        !          7037: #define GETLOGIN       /* use getlogin() routine as backup to environment */
        !          7038:                        /* variables USER or LOGNAME */
        !          7039: #define TILDENAME      /* allow ~logname expansion */
        !          7040: #define GETWD          /* use our getwd() instead of piped in pwd */
        !          7041: #define SETUIDGID      /* substitute eaccess() for access() so that rn */
        !          7042:                        /* can run setuid or setgid */
        !          7043:                        /* if not setuid or setgid, you don't need it */
        !          7044: #define VERBOSE                /* compile in more informative messages */
        !          7045: #define TERSE          /* compile in shorter messages */
        !          7046: 
        !          7047: /* some dependencies among options */
        !          7048: 
        !          7049: #ifndef SETUIDGID
        !          7050: #   define eaccess access
        !          7051: #endif
        !          7052: 
        !          7053: #ifdef VERBOSE
        !          7054: #   ifdef TERSE
        !          7055: #      define IF(c) if (c)
        !          7056: #      define ELSE else
        !          7057: #   else /* !TERSE */
        !          7058: #      define IF(c)
        !          7059: #      define ELSE
        !          7060: #   endif
        !          7061: #else /* !VERBOSE */
        !          7062: #   ifndef TERSE
        !          7063: #      define TERSE
        !          7064: #   endif
        !          7065: #   define IF(c) "IF" outside of VERBOSE???
        !          7066: #   define ELSE "ELSE" outside of VERBOSE???
        !          7067: #endif
        !          7068: 
        !          7069: #ifdef DEBUGGING
        !          7070: #   define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\r\n", __FILE__, __LINE__);sig_catcher(0);}}
        !          7071: #else
        !          7072: #   define assert(ex) ;
        !          7073: #endif
        !          7074: 
        !          7075: #define TCSIZE 512     /* capacity for termcap strings */
        !          7076: 
        !          7077: /* End of Space Conservation Section */
        !          7078: 
        !          7079: /* More System Dependencies */
        !          7080: 
        !          7081: /* preferred shell for use in doshell routine */
        !          7082: /*  ksh or sh would be okay here */
        !          7083: #ifndef PREFSHELL
        !          7084: #   define PREFSHELL "/bin/csh"
        !          7085: #endif
        !          7086: 
        !          7087: /* path to fastest starting shell */
        !          7088: #ifndef SH
        !          7089: #   define SH "/bin/sh"
        !          7090: #endif
        !          7091: 
        !          7092: /* location of macro file */
        !          7093: #ifndef WARPMACRO
        !          7094: #   ifdef PUSHBACK
        !          7095: #      define WARPMACRO "%./.warpmac"
        !          7096: #   endif
        !          7097: #endif
        !          7098: 
        !          7099: /* location of full name */
        !          7100: #ifndef FULLNAMEFILE
        !          7101: #   ifndef PASSNAMES
        !          7102: #      define FULLNAMEFILE "%./.fullname"
        !          7103: #   endif
        !          7104: #endif
        !          7105: 
        !          7106: /* a motd-like file for warp */
        !          7107: #ifndef WARPNEWSNAME           /* % and ~ */
        !          7108: #   define WARPNEWSNAME "%X/warp.news"
        !          7109: #endif
        !          7110: 
        !          7111: /* typedefs */
        !          7112: 
        !          7113: typedef unsigned int   MEM_SIZE;       /* for passing to malloc */
        !          7114: 
        !          7115: /* *** end of the machine dependent stuff *** */
        !          7116: 
        !          7117: /* GLOBAL THINGS */
        !          7118: 
        !          7119: /* file statistics area */
        !          7120: 
        !          7121: EXT struct stat filestat;
        !          7122: 
        !          7123: /* various things of type char */
        !          7124: 
        !          7125: char   *index();
        !          7126: char   *rindex();
        !          7127: char   *getenv();
        !          7128: char   *strcat();
        !          7129: char   *strcpy();
        !          7130: #ifdef CHARSPRINTF
        !          7131: char   *sprintf();
        !          7132: #else
        !          7133: int    sprintf();
        !          7134: #endif
        !          7135: 
        !          7136: EXT char buf[LBUFLEN+1];       /* general purpose line buffer */
        !          7137: 
        !          7138: EXT char *cwd INIT(Nullch);            /* current working directory */
        !          7139: 
        !          7140: /* switches */
        !          7141: 
        !          7142: #ifdef DEBUGGING
        !          7143:     EXT int debug INIT(0);                             /* -D */
        !          7144: #   define DEB_FILEXP 64 
        !          7145: #endif
        !          7146: 
        !          7147: #ifdef VERBOSE
        !          7148: #   ifdef TERSE
        !          7149:        EXT bool verbose INIT(TRUE);                    /* +t */
        !          7150: #   endif
        !          7151: #endif
        !          7152: 
        !          7153: /* miscellania */
        !          7154: 
        !          7155: EXT FILE *tmpfp INIT(Nullfp);  /* scratch fp */
        !          7156: 
        !          7157: #define NOMARKING 0
        !          7158: #define STANDOUT 1
        !          7159: #define UNDERLINE 2
        !          7160: 
        !          7161: /* Factored strings */
        !          7162: 
        !          7163: EXT char nullstr[] INIT("");
        !          7164: EXT char readerr[] INIT("warp read error");
        !          7165: EXT char cantopen[] INIT("Can't open %s\r\n");
        !          7166: 
        !          7167: #ifdef VERBOSE
        !          7168:     EXT char nocd[] INIT("Can't chdir to directory %s\r\n");
        !          7169: #else
        !          7170:     EXT char nocd[] INIT("Can't find %s\r\n");
        !          7171: #endif
        !          7172: 
        !          7173: extern int errno;
        !          7174: 
        !          7175: EXT bool justonemoretime INIT(TRUE);
        !          7176: EXT bool keepgoing INIT(TRUE);
        !          7177: 
        !          7178: EXT bool friendspec INIT(FALSE);
        !          7179: EXT bool piratespec INIT(FALSE);
        !          7180: EXT bool amoebaspec INIT(FALSE);
        !          7181: EXT bool starspec INIT(FALSE);
        !          7182: EXT bool klingspec INIT(FALSE);
        !          7183: EXT bool apolspec INIT(FALSE);
        !          7184: EXT bool crushspec INIT(FALSE);
        !          7185: EXT bool romspec INIT(FALSE);
        !          7186: EXT bool prespec INIT(FALSE);
        !          7187: EXT bool tholspec INIT(FALSE);
        !          7188: EXT bool gornspec INIT(FALSE);
        !          7189: EXT bool beginner INIT(FALSE);
        !          7190: EXT bool massacre INIT(FALSE);
        !          7191: EXT bool lowspeed INIT(FALSE);
        !          7192: EXT bool debugging INIT(FALSE);
        !          7193: EXT bool didkill INIT(FALSE);
        !          7194: EXT bool experimenting INIT(FALSE);
        !          7195: EXT bool scorespec INIT(FALSE);
        !          7196: EXT bool metakey INIT(FALSE);
        !          7197: 
        !          7198: EXT bool bombed_out;
        !          7199: EXT bool panic INIT(FALSE);
        !          7200: EXT bool madgorns;
        !          7201: 
        !          7202: EXT int madfriends;
        !          7203: 
        !          7204: EXT int inumpirates;
        !          7205: EXT int numpirates;
        !          7206: EXT int inumfriends;
        !          7207: EXT int numfriends;
        !          7208: EXT int inumamoebas;
        !          7209: EXT int numamoebas;
        !          7210: EXT int inumstars;
        !          7211: EXT int numstars;
        !          7212: EXT int inumenemies;
        !          7213: EXT int numenemies;
        !          7214: EXT int inumroms;
        !          7215: EXT int inumthols;
        !          7216: EXT int inumapollos;
        !          7217: EXT int numapollos;
        !          7218: EXT int apolloflag;
        !          7219: EXT int inumcrushes;
        !          7220: EXT int numcrushes;
        !          7221: EXT int inumgorns;
        !          7222: EXT int numgorns;
        !          7223: EXT int deados;
        !          7224: EXT int deadmudds;
        !          7225: EXT int smarts;
        !          7226: EXT int ismarts INIT(0);
        !          7227: EXT int numos INIT(0);
        !          7228: EXT int numxes INIT(0);
        !          7229: EXT int ient;
        !          7230: EXT int numents;
        !          7231: EXT int ibase;
        !          7232: EXT int numbases;
        !          7233: EXT int inuminhab;
        !          7234: EXT int numinhab;
        !          7235: EXT int wave;
        !          7236: EXT int cumsmarts;
        !          7237: EXT int prescene INIT(-1);
        !          7238: EXT int scandist;
        !          7239: EXT int antibase;
        !          7240: EXT int sm35;
        !          7241: EXT int sm45;
        !          7242: EXT int sm50;
        !          7243: EXT int sm55;
        !          7244: EXT int sm80;
        !          7245: EXT int sm95;
        !          7246: EXT int entmax;
        !          7247: EXT int basemax;
        !          7248: EXT int enemshields;
        !          7249: EXT int super;
        !          7250: EXT int whenok;
        !          7251: EXT int yamblast;
        !          7252: EXT int xamblast;
        !          7253: EXT int ambsize;
        !          7254: 
        !          7255: EXT char spbuf[512];
        !          7256: 
        !          7257: char *index(), *ttyname(), *malloc(), *ctime(), *strcpy();
        !          7258: char *getenv(), cmstore(), *tgoto();
        !          7259: long atol();
        !          7260: 
        !          7261: #define Fclose (void)fclose
        !          7262: #define Fflush (void)fflush
        !          7263: #define Fgets (void)fgets
        !          7264: #define Sprintf (void)sprintf
        !          7265: #define Signal (void)signal
        !          7266: #define Safecpy (void)safecpy
        !          7267: #define Cpytill (void)cpytill
        !          7268: #define Tract (void)tract
        !          7269: #define Make_object (void)make_object
        !          7270: #define Read_tty (void)read_tty
        !          7271: XT int super;
        !          7272: EXT int whenok;
        !          7273: EXT int yamblast;
        !          7274: EXT int xamblast;
        !          7275: EXT int ambsize;
        !          7276: 
        !          7277: EXT char spbuf[512];
        !          7278: 
        !          7279: char *index(), *ttyname(), *malloc(), *ctime(), *strcpy();
        !          7280: char *getenv(), cmstore(), *tgoto();
        !          7281: long atol();
        !          7282: 
        !          7283: #define Fclose (void)fclose
        !          7284: #define Fflush (void)fflush
        !          7285: #define Fgets (void)fgets
        !          7286: #define Sprintf (void)sprintf
        !          7287: #define Signal (void)signal
        !          7288: #define Safecpy (void)safecpy
        !          7289: #define Cpytill (void)cpytill
        !          7290: #define Tract (void)tract
        !          7291: #define Make_object (void)make_object
        !          7292: #defiwarp/term.h   644    171      5       24112  5121750060   6170 /* $Header: term.h,v 7.0.1.2 86/12/12 17:05:15 lwall Exp $ */
        !          7293: 
        !          7294: /* $Log:       term.h,v $
        !          7295:  * Revision 7.0.1.2  86/12/12  17:05:15  lwall
        !          7296:  * Baseline for net release.
        !          7297:  * 
        !          7298:  * Revision 7.0.1.1  86/10/16  10:53:33  lwall
        !          7299:  * Added Damage.  Fixed random bugs.
        !          7300:  * 
        !          7301:  * Revision 7.0  86/10/08  15:14:07  lwall
        !          7302:  * Split into separate files.  Added amoebas and pirates.
        !          7303:  * 
        !          7304:  */
        !          7305: 
        !          7306: /* warp will still work without the following, but may get ahead at low speed */
        !          7307: #ifdef TIOCOUTQ                /* chars left in output queue */
        !          7308: #define output_pending() (ioctl(1, TIOCOUTQ, &iocount),iocount)
        !          7309: #endif
        !          7310: 
        !          7311: /* If some of the following look something like curses calls, it is because
        !          7312:  * warp used to use curses but doesn't now.  Warp was neither as efficient nor
        !          7313:  * as portable with curses, and since the program had to cheat on curses all
        !          7314:  * over the place anyway, we ripped it out.
        !          7315:  */
        !          7316: #define setimage(of,to) (mvaddch(of->posy+1,of->posx*2,of->image=(to)))
        !          7317: 
        !          7318: #define mvaddch(y,x,ch) move((y),(x),(ch))
        !          7319: /* #define addch(ch) (tmpchr=(ch), write(1,&tmpchr,1), real_x++) */
        !          7320: #define mvaddc(y,x,ch) move((y),(x),(ch))
        !          7321: #define addc(ch) (write(1,&(ch),1), real_x++)
        !          7322: #define addspace() (write(1," ",1), real_x++)
        !          7323: #define mvaddstr(y,x,s) (move((y),(x),0), tmpstr = (s), \
        !          7324:      tmplen = strlen(tmpstr), write(1, tmpstr, tmplen), real_x += tmplen)
        !          7325: 
        !          7326: EXT int tmplen;
        !          7327: EXT char *tmpstr;
        !          7328: /* EXT char tmpchr; */
        !          7329: 
        !          7330: /* The following macros are like the pseudo-curses macros above, but do
        !          7331:  * certain amount of controlled output buffering.
        !          7332:  *
        !          7333:  * NOTE: a beg_qwrite()..end_qwrite() sequence must NOT contain a cursor
        !          7334:  * movement (move), because the move() routine uses beg_qwrite()..end_qwrite()
        !          7335:  * itself.
        !          7336:  */
        !          7337: 
        !          7338: #define beg_qwrite() (maxcmstring = cmbuffer)
        !          7339: #ifdef vax
        !          7340: #define qwrite() asm("movc3 _gfillen,_filler,*_maxcmstring"); maxcmstring += gfillen
        !          7341: #else
        !          7342: #define qwrite() (movc3(gfillen,filler,maxcmstring), maxcmstring += gfillen)
        !          7343: #endif
        !          7344: #define qaddc(ch) (*maxcmstring++ = (ch), real_x++)
        !          7345: #define qaddch(ch) (*maxcmstring++ = (ch), real_x++)
        !          7346: #define qaddspace() (*maxcmstring++ = ' ', real_x++)
        !          7347: #define end_qwrite() (write(1,cmbuffer,maxcmstring-cmbuffer))
        !          7348: 
        !          7349: /* setting a ??size to infinity forces cursor addressing in that direction */
        !          7350: 
        !          7351: EXT int CMsize;
        !          7352: EXT int BCsize INIT(1);
        !          7353: EXT int DOsize INIT(1000);
        !          7354: EXT int UPsize INIT(1000);
        !          7355: EXT int NDsize INIT(1000);
        !          7356: 
        !          7357: EXT int charsperhalfsec;
        !          7358: 
        !          7359: EXT int real_y INIT(-100);
        !          7360: EXT int real_x INIT(-100);
        !          7361: 
        !          7362: #ifdef DOINIT
        !          7363: char filler[] = {0,'\b',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
        !          7364: #else
        !          7365: EXT char filler[];
        !          7366: #endif
        !          7367: 
        !          7368: EXT char *bsptr INIT(filler+1);
        !          7369: 
        !          7370: EXT char term[12];
        !          7371: 
        !          7372: EXT char gfillen INIT(25);
        !          7373: 
        !          7374: EXT char *maxcmstring;
        !          7375: EXT char cmbuffer[512];
        !          7376: 
        !          7377: #define BREAKCH '\0'
        !          7378: 
        !          7379: EXT char INTRCH INIT('\03');
        !          7380: 
        !          7381: #ifdef PUSHBACK
        !          7382:     EXT char circlebuf[PUSHSIZE];
        !          7383:     EXT int nextin INIT(0);
        !          7384:     EXT int nextout INIT(0);
        !          7385: #   ifdef PENDING
        !          7386: #      ifdef FIONREAD
        !          7387:            EXT long iocount INIT(0);
        !          7388: #          ifndef lint
        !          7389: #              define input_pending() (nextin!=nextout || \
        !          7390: (ioctl(0, FIONREAD, &iocount),(int)iocount))
        !          7391: #          else
        !          7392: #              define input_pending() bizarre
        !          7393: #          endif /* lint */
        !          7394: #      else /* FIONREAD */
        !          7395:            int circfill();
        !          7396: #          ifdef RDCHK
        !          7397: #              ifndef lint
        !          7398: #                  define input_pending() rdchk(0)
        !          7399: #              else /* lint */
        !          7400: #                  define input_pending() bizarre
        !          7401: #              endif /* lint */
        !          7402: #          else /* RDCHK */
        !          7403: #              ifndef O_NDELAY /* assert O_NDELAY */
        !          7404:                    ??? PENDING isn't defined correctly in warp.h
        !          7405: #              endif
        !          7406:                EXT int devtty INIT(0);
        !          7407: #              ifndef lint
        !          7408: #                  define input_pending() (nextin!=nextout || circfill())
        !          7409: #              else
        !          7410: #                  define input_pending() bizarre
        !          7411: #              endif /* lint */
        !          7412: #          endif /* RDCHK */
        !          7413: #      endif /* FIONREAD */
        !          7414: #   else /* PENDING */
        !          7415:        ??? warp won't work without PENDING
        !          7416: #      ifndef lint
        !          7417: #          define input_pending() (nextin!=nextout)
        !          7418: #      else
        !          7419: #          define input_pending() bizarre
        !          7420: #      endif /* lint */
        !          7421: #   endif /* PENDING */
        !          7422: #else /* PUSHBACK */
        !          7423: #   ifdef PENDING
        !          7424: #      ifdef FIONREAD /* must have FIONREAD or O_NDELAY for input_pending() */
        !          7425: #          define read_tty(addr,size) read(0,addr,size)
        !          7426: #          ifndef lint
        !          7427: #              define input_pending() (ioctl(0, FIONREAD, &iocount), \
        !          7428: (int)iocount)
        !          7429: #          else
        !          7430: #              define input_pending() bizarre
        !          7431: #          endif /* lint */
        !          7432:            EXT long iocount INIT(0);
        !          7433: #      else /* FIONREAD */
        !          7434: #          ifdef RDCHK         /* actually, they can have rdchk() too */
        !          7435: #          define read_tty(addr,size) read(0,addr,size)
        !          7436: #              ifndef lint
        !          7437: #                  define input_pending() rdchk(0)
        !          7438: #              else /* lint */
        !          7439: #                  define input_pending() bizarre
        !          7440: #              endif /* lint */
        !          7441: #          else /* RDCHK */
        !          7442: #              ifndef O_NDELAY /* assert O_NDELAY */
        !          7443:                    ??? PENDING isn't defined correctly in warp.h
        !          7444: #              endif
        !          7445:                EXT int devtty INIT(0);
        !          7446:                EXT bool is_input INIT(FALSE);
        !          7447:                EXT char pending_ch INIT(0);
        !          7448: #              ifndef lint
        !          7449: #                  define input_pending() (is_input || \
        !          7450: (is_input=read(devtty,&pending_ch,1)))
        !          7451: #              else
        !          7452: #                  define input_pending() bizarre
        !          7453: #              endif /* lint */
        !          7454: #          endif /* RDCHK */
        !          7455: #      endif /* FIONREAD */
        !          7456: #   else /* PENDING */
        !          7457:        ??? warp won't work without PENDING
        !          7458: #      define read_tty(addr,size) read(0,addr,size)
        !          7459: #      define input_pending() (FALSE)
        !          7460: #   endif /* PENDING */
        !          7461: #endif /* PUSHBACK */
        !          7462: 
        !          7463: /* stuff wanted by terminal mode diddling routines */
        !          7464: 
        !          7465: #ifdef TERMIO
        !          7466: EXT struct termio _tty, _oldtty;
        !          7467: #else
        !          7468: EXT struct sgttyb _tty;
        !          7469: EXT int _res_flg INIT(0);
        !          7470: #endif
        !          7471: 
        !          7472: EXT int _tty_ch INIT(2);
        !          7473: EXT bool bizarre INIT(FALSE);                  /* do we need to restore terminal? */
        !          7474: 
        !          7475: /* terminal mode diddling routines */
        !          7476: 
        !          7477: #ifdef TERMIO
        !          7478:   
        !          7479: #define raw() ((bizarre=1),_tty.c_lflag &=~ISIG,_tty.c_cc[VMIN] = 1,ioctl(_tty_ch,TCSETAF,&_tty))
        !          7480: #define noraw() ((bizarre=1),_tty.c_lflag |= ISIG,_tty.c_cc[VEOF] = CEOF,ioctl(_tty_ch,TCSETAF,&_tty))
        !          7481: #define crmode() ((bizarre=1),_tty.c_lflag &=~ICANON,_tty.c_cc[VMIN] = 1,ioctl(_tty_ch,TCSETAF,&_tty))
        !          7482: #define nocrmode() ((bizarre=1),_tty.c_lflag |= ICANON,_tty.c_cc[VEOF] = CEOF,ioctl(_tty_ch,TCSETAF,&_tty))
        !          7483: #define echo()  ((bizarre=1),_tty.c_lflag |= ECHO, ioctl(_tty_ch, TCSETAW, &_tty))
        !          7484: #define noecho() ((bizarre=1),_tty.c_lflag &=~ECHO, ioctl(_tty_ch, TCSETAW, &_tty))
        !          7485: #define nl()    ((bizarre=1),_tty.c_iflag |= ICRNL,_tty.c_oflag |= ONLCR,ioctl(_tty_ch, TCSETAW, &_tty))
        !          7486: #define nonl()  ((bizarre=1),_tty.c_iflag &=~ICRNL,_tty.c_oflag &=~ONLCR,ioctl(_tty_ch, TCSETAW, &_tty))
        !          7487: #define        savetty() (ioctl(_tty_ch, TCGETA, &_oldtty),ioctl(_tty_ch, TCGETA, &_tty))
        !          7488: #define        resetty() ((bizarre=0),ioctl(_tty_ch, TCSETAF, &_oldtty))
        !          7489: #define unflush_output()
        !          7490: 
        !          7491: #else
        !          7492: 
        !          7493: #define raw()   ((bizarre=1),_tty.sg_flags|=RAW, stty(_tty_ch,&_tty))
        !          7494: #define noraw()         ((bizarre=1),_tty.sg_flags&=~RAW,stty(_tty_ch,&_tty))
        !          7495: #define crmode() ((bizarre=1),_tty.sg_flags |= CBREAK, stty(_tty_ch,&_tty))
        !          7496: #define nocrmode() ((bizarre=1),_tty.sg_flags &= ~CBREAK,stty(_tty_ch,&_tty))
        !          7497: #define echo()  ((bizarre=1),_tty.sg_flags |= ECHO, stty(_tty_ch, &_tty))
        !          7498: #define noecho() ((bizarre=1),_tty.sg_flags &= ~ECHO, stty(_tty_ch, &_tty))
        !          7499: #define nl()    ((bizarre=1),_tty.sg_flags |= CRMOD,stty(_tty_ch, &_tty))
        !          7500: #define nonl()  ((bizarre=1),_tty.sg_flags &= ~CRMOD, stty(_tty_ch, &_tty))
        !          7501: #define        savetty() (gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags)
        !          7502: #define        resetty() ((bizarre=0),_tty.sg_flags = _res_flg, stty(_tty_ch, &_tty))
        !          7503: #endif /* TERMIO */
        !          7504: 
        !          7505: #ifdef TIOCSTI
        !          7506: #ifdef lint
        !          7507: #define forceme(c) ioctl(_tty_ch,TIOCSTI,Null(long*))  /* ghad! */
        !          7508: #else
        !          7509: #define forceme(c) ioctl(_tty_ch,TIOCSTI,c) /* pass character in " " */
        !          7510: #endif /* lint */
        !          7511: #else
        !          7512: #define forceme(c)
        !          7513: #endif
        !          7514: 
        !          7515: /* termcap stuff */
        !          7516: 
        !          7517: /*
        !          7518:  * NOTE: if you don't have termlib you'll have to define these strings,
        !          7519:  *    the tputs routine, and the tgoto routine.
        !          7520:  * The tgoto routine simply produces a cursor addressing string for a given
        !          7521:  * x and y.  The 1st argument is a generic string to be interpreted.
        !          7522:  * If you are hardwiring it you might just ignore the 1st argument.
        !          7523:  * The tputs routine interprets any leading number as a padding factor, possibly
        !          7524:  * scaled by the number of lines (2nd argument), puts out the string (1st arg)
        !          7525:  * and the padding using the routine specified as the 3rd argument.
        !          7526:  */
        !          7527: 
        !          7528: #ifdef HAVETERMLIB
        !          7529: EXT char *BC INIT(Nullch);             /* backspace character */
        !          7530: EXT char *UP INIT(Nullch);             /* move cursor up one line */
        !          7531: EXT char *myUP;
        !          7532: EXT char *ND INIT(Nullch);             /* non-destructive cursor right */
        !          7533: EXT char *myND;
        !          7534: EXT char *DO INIT(Nullch);             /* move cursor down one line */
        !          7535: EXT char *myDO;
        !          7536: EXT char *CR INIT(Nullch);             /* get to left margin, somehow */
        !          7537: EXT char *VB INIT(Nullch);             /* visible bell */
        !          7538: EXT char *CL INIT(Nullch);             /* home and clear screen */
        !          7539: EXT char *CE INIT(Nullch);             /* clear to end of line */
        !          7540: EXT char *CM INIT(Nullch);             /* cursor motion -- PWP */
        !          7541: EXT char *HO INIT(Nullch);             /* home cursor -- PWP */
        !          7542: EXT char *CD INIT(Nullch);             /* clear to end of display -- PWP */
        !          7543: EXT char *SO INIT(Nullch);             /* begin standout mode */
        !          7544: EXT char *SE INIT(Nullch);             /* end standout mode */
        !          7545: EXT int SG INIT(0);            /* blanks left by SO and SE */
        !          7546: EXT char *US INIT(Nullch);             /* start underline mode */
        !          7547: EXT char *UE INIT(Nullch);             /* end underline mode */
        !          7548: EXT char *UC INIT(Nullch);             /* underline a character, if that's how it's done */
        !          7549: EXT int UG INIT(0);            /* blanks left by US and UE */
        !          7550: EXT bool AM INIT(FALSE);               /* does terminal have automatic margins? */
        !          7551: EXT bool XN INIT(FALSE);               /* does it eat 1st newline after automatic wrap? */
        !          7552: EXT char PC INIT(0);           /* pad character for use by tputs() */
        !          7553: EXT short ospeed INIT(0);      /* terminal output speed, for use by tputs() */
        !          7554: EXT int LINES INIT(0), COLS INIT(0);   /* size of screen */
        !          7555: EXT int just_a_sec INIT(960);                  /* 1 sec at current baud rate */
        !          7556:                                        /* (number of nulls) */
        !          7557: EXT char ERASECH;              /* rubout character */
        !          7558: EXT char KILLCH;               /* line delete character */
        !          7559: 
        !          7560: /* define a few handy macros */
        !          7561: 
        !          7562: #define clear() (do_tc(CL,LINES),real_y=real_x=0)
        !          7563: #define erase_eol() do_tc(CE,1)
        !          7564: #define backspace() (do_tc(BC,0),real_x--)
        !          7565: #define clear_rest() do_tc(CD,LINES)
        !          7566: #define underline() do_tc(US,1)
        !          7567: #define un_underline() do_tc(UE,1)
        !          7568: #define underchar() do_tc(UC,0)
        !          7569: #define standout() do_tc(SO,1)
        !          7570: #define un_standout() do_tc(SE,1)
        !          7571: #define up_line() do_tc(UP,1)
        !          7572: #define carriage_return() do_tc(CR,1)
        !          7573: #define dingaling() do_tc(VB,1)
        !          7574: #else
        !          7575:   ????????             /* up to you */
        !          7576: #endif
        !          7577: 
        !          7578: void   term_init();
        !          7579: void   term_set();
        !          7580: #ifdef PUSHBACK
        !          7581: void   pushchar();
        !          7582: void   mac_init();
        !          7583: void   mac_line();
        !          7584: #endif
        !          7585: void   eat_typeahead();
        !          7586: void   settle_down();
        !          7587: #ifndef read_tty
        !          7588:     int                read_tty();
        !          7589: #endif
        !          7590: void   getcmd();
        !          7591: 
        !          7592: int read_nd();
        !          7593: void page();
        !          7594: void move();
        !          7595: void do_tc();
        !          7596: int comp_tc();
        !          7597: void helper();
        !          7598: void rewrite();
        !          7599: char cmstore();
        !          7600: 
        !          7601: SO,1)
        !          7602: #define un_standout() do_tc(SE,1)
        !          7603: #define up_line() do_tc(UP,1)
        !          7604: #define carriage_return() do_tc(CR,1)
        !          7605: #define dingaling() do_tc(VB,1)
        !          7606: #else
        !          7607:   ????????             /* up to you */
        !          7608: #endif
        !          7609: 
        !          7610: void   term_init();
        !          7611: void   term_set();
        !          7612: #ifdef PUSHBACK
        !          7613: void   pushchar();
        !          7614: void   mac_init();
        !          7615: void   mac_line();
        !          7616: #endif
        !          7617: void   eat_typeahead();
        !          7618: void   settle_down();
        !          7619: #ifndef read_tty
        !          7620:     int                read_tty();
        !          7621: #endif
        !          7622: void   getcmd();
        !          7623: 
        !          7624: int read_nd();
        !          7625: void page();
        !          7626: void move();
        !          7627: voiwarp/warp.doc   644    171      5       24042  5121750064   6516 Warp is a real-time space war game.  This means that the enemies will keep
        !          7628: playing even when you sit still.  Another peculiarity is that things which
        !          7629: blow up can damage other things around them.  Universes above a critical
        !          7630: density may chain react.
        !          7631: 
        !          7632: The game starts at difficulty 1, and gets more difficult with each
        !          7633: succeeding wave, up to difficulty 99.  You're not likely to get that far.
        !          7634: (Invoking warp with a -b switch causes the difficulty to increase more
        !          7635: slowly, but games count only a tenth as much.)  The game starts with
        !          7636: 5 Enterprises and 3 Bases, and you get more for surviving long enough.
        !          7637: The game is over when you run out of Enterprises and Bases.
        !          7638: 
        !          7639: The object of the game is to get as many points as possible.  This is done
        !          7640: by destroying as many enemies as possible.  This is not a trivial task.
        !          7641: Each wave starts with one Enterprise and one Base, and continues until
        !          7642: either both the Enterprise and Base are destroyed, or all the enemies
        !          7643: (including any homing torpedoes) are destroyed.  It is possible to abort a
        !          7644: wave, but you will be penalized for it.  The game may be saved between waves.
        !          7645: 
        !          7646: A -x switch causes any saved game to be ignored, and causes the new game
        !          7647: not to be saveable.  Hence it is possible to run test games without
        !          7648: invalidating a currently saved game.
        !          7649: 
        !          7650: The game is played in a 23 x 40 double wrap-around universe.  Everybody
        !          7651: (both you and the enemies) gets the chance to move once every second,
        !          7652: unless a -l (low-speed) switch was given or you are under 2400 baud, in
        !          7653: which case it's every two seconds.  The following symbols are displayed:
        !          7654: 
        !          7655:                                FRIENDS
        !          7656: E      Enterprise with shields         e       Enterprise without shields
        !          7657: C      Cloaked E with shields          c       Cloaked E without shields
        !          7658: B      Base with shields               b       Base without shields
        !          7659: +      Friendly torpedo                M       Harry Mudd
        !          7660: 
        !          7661:                                ENEMIES
        !          7662: K      Klingon                         G       Gorn
        !          7663: R      Romulan                         A       Apollo
        !          7664:        Romulan with cloaking device!   &       Space Amoeba Nucleus
        !          7665: T      Tholian                         >,<     Planet crusher
        !          7666: x,X    Hostile torpedo                 o,O     Homing torpedo
        !          7667: P      Pirate                          M       Harry Mudd
        !          7668: 
        !          7669:                            MISCELLANEOUS
        !          7670: *      Star                            @       Inhabited star
        !          7671: |,-,/,\        Web                             ~       Protoplasm
        !          7672: other  Friendly Freighter, for now...
        !          7673: 
        !          7674: The following keys control the DIRECTION of your various actions:
        !          7675: 
        !          7676:        h or 4          left
        !          7677:        j or 2          down
        !          7678:        k or 8          up
        !          7679:        l or 6          right
        !          7680:        b or 1          down and left
        !          7681:        n or 3          down and right
        !          7682:        y or 7          up and left
        !          7683:        u or 9          up and right
        !          7684: 
        !          7685: (You will note that the letters are the same as other visual games, and the
        !          7686: numbers are for use with a keypad.)  By themselves, these keys move either
        !          7687: the Enterprise or the Base, whichever is the current vessel.  When shifted,
        !          7688: they fire photon torpedoes in the specified direction from the current
        !          7689: vessel.  When used with either the CTRL key or the FUNCT key, phasers
        !          7690: (turbo-lasers for the Base) are fired in the specified direction.  (CTRL
        !          7691: won't work with numbers, and FUNCT probably doesn't exist on non-TVI
        !          7692: terminals.)  When preceded by an 'a', an attractor beam is fired in the
        !          7693: specified direction, and when preceded by an 'r', a repulsor beam is fired.
        !          7694: 
        !          7695: These keys have special functions:
        !          7696: 
        !          7697:        del or %        fire photon torpedoes in every (reasonable) direction
        !          7698:        s               stop all friendly torpedoes
        !          7699:        S or 0          stop the Enterprise when in warp mode
        !          7700:        d               destruct all friendly torpedoes (quite useful)
        !          7701:        D               destruct the current vessel (commit suicide)
        !          7702:        i/w             switch to Enterprise and put into impulse/warp mode
        !          7703:        c/v             switch to Enterprise and put into cloaking/visible mode
        !          7704:        p               switch to Base (not very mnemonic, but 'b' is taken)
        !          7705:        o               switch from Enterprise to Base, or vice versa
        !          7706:        z               zap explosions (multiple zaps extend further) (E only)
        !          7707: 
        !          7708:        ^R              refresh the screen
        !          7709:        ^Z              suspend the game (on a bsd system)
        !          7710:        q               asks if you want to exit this wave (will not work
        !          7711:                            within 10 cycles of previous q command)
        !          7712:        Q               exit this game (not wave)
        !          7713:        ?               display a summary of these commands
        !          7714: 
        !          7715: There may be additional commands listed in your terminal's keymap file.
        !          7716: Unrecognized keystrokes are ignored.  IF YOU FORGET ALL THE OTHER COMMANDS,
        !          7717: REMEMBER "?", which gives you help.
        !          7718: 
        !          7719: Commands for moving the Enterprise may operate in one of two ways.  If it
        !          7720: is in impulse mode, movement commands affect the position of the ship;
        !          7721: if it is in warp mode, movement commands affect the velocity instead.
        !          7722: The Base always moves in impulse mode.  Since multiple commands may be
        !          7723: entered in one turn (if you can type fast enough), it is possible to jump
        !          7724: over things even in impulse mode.  In a crowded universe this may be the
        !          7725: only way to go.
        !          7726: 
        !          7727: (Actually, motion commands always change the velocity--the actual motion
        !          7728: does not occur until the next turn.  Impulse mode simply causes the
        !          7729: velocity to be zeroed out at the end of every turn.  Phaser commands, on
        !          7730: the other hand, are executed immediately.  If you want to move and fire a
        !          7731: phaser, you must wait for the motion to actually occur before typing the
        !          7732: phaser command, or the phaser fires from your old position.  This is a
        !          7733: feature, not a bug, and is intended to reflect reality.  Really.)
        !          7734: 
        !          7735: If multiple torpedo launching commands are given in a turn, a single torpedo
        !          7736: is launched with extra velocity.  You can thus launch photon torpedoes over
        !          7737: objects in the way, and get them where you want them quickly.  This feature
        !          7738: works well with the destruct button.  Variations on this may be useful
        !          7739: against the Space Amoeba.
        !          7740: 
        !          7741: NOTE:  Phasers destroy the target by blasting the projected next location of
        !          7742: the object hit.  This means that if the object hit, be it Klingon, Romulan or
        !          7743: Enterprise, changes velocity in the same turn, it can elude the effect of
        !          7744: the phaser!  (Note that this also means that if you phaser a Klingon or
        !          7745: torpedo that is about to ram you, you will be phasered as well as he/she/it.
        !          7746: This can be embarrassing, not to mention deadly.)  Smart players move
        !          7747: immediately upon phasering something at short range, or whenever they
        !          7748: think they might get phasered (in other words, most of the time).
        !          7749: 
        !          7750: Objects with larger mass can bounce objects with smaller mass out of the way.
        !          7751: In a crowded universe the bouncee can bounce quite a way before finding an
        !          7752: empty place to land.  If you let the Tholians fill up the universe with web,
        !          7753: so that there is no place to bounce to, the Tholians win that wave.
        !          7754: 
        !          7755: The status line across the top gives the current mode, the number of
        !          7756: points accumulated this wave, the Enterprise's energy and torpedoes, the
        !          7757: Base's energy and torpedoes, the number of stars, the number of enemies,
        !          7758: and the stardate.  You will note that nice things happen to your energy levels
        !          7759: when you put the Enterprise next to the Base, or the Base next to some stars.
        !          7760: Bad things happen inside an Amoeba.
        !          7761: 
        !          7762: An object is destroyed when its energy goes negative, either from a direct
        !          7763: hit, or from the blast of the previous turn's explosions.  Enemies and
        !          7764: stars start with random amounts of energy.  High energy enemies can go warp
        !          7765: 2.  A Romulan with sufficient energy maintains a cloaking device.  Tholians
        !          7766: spin web, Gorns shoot homing torpedoes, and the Planet Crusher munches
        !          7767: anything in its way, even Apollo.  Apollo won't let you go unless you kill
        !          7768: him, but he loves you very much and beefs up your shields considerably.
        !          7769: Both Apollo and the Planet Crusher recharge themselves, so you must hit
        !          7770: them hard in a single turn to do them in. (Yes, the Planet Crusher must be
        !          7771: shot in the mouth--he can only die of gluttony--and he blasts out of his
        !          7772: mouth when he dies.)  Tholian web may be crossed only by coasting across it
        !          7773: in warp mode, or by blasting it (but web blasts extend twice as far as
        !          7774: normal blasts, so keep your distance).  The Space Amoeba sucks energy and
        !          7775: grows, and you must destroy the nucleus.  Somehow.  There are at least four
        !          7776: ways.  Phasers won't work on the big ones.
        !          7777: 
        !          7778: Pirates turn inhabited star systems into uninhabited ones.  Even Friendly
        !          7779: Freighters will take potshots at you if you get them mad enough.
        !          7780: 
        !          7781: Note that because of the size of the Base's turbo-lasers (the Base does not
        !          7782: have phasers) they cannot shoot anything next to the Base.  (This is why the
        !          7783: Death Star died!)  In part, this is to protect the Enterprise.  It also lets
        !          7784: you shoot over one adjacent star.  The Enterprise's phasers will shoot over
        !          7785: a arbitrary number of adjacent, contiguous stars, including inhabited ones.
        !          7786: Phasers die away with distance, so don't expect them to kill everything with
        !          7787: one blow.
        !          7788: 
        !          7789: While the Enterprise's shields are up (when it is displayed as "E" rather
        !          7790: than "e"), hits on it count only a fifth as much (or even less if you are
        !          7791: moving in warp mode).  The shields are automatically maintained as long as
        !          7792: there are more than 500 units of energy for the Enterprise.  The Base also
        !          7793: has shields, which stay up as long as it has at least 1000 units of energy.
        !          7794: 
        !          7795: Aside from losing energy, the Enterprise can also take damage, either random
        !          7796: damage from getting blasted, or specific damage when a system is in use
        !          7797: and breaks down under the load.  In place of the score you will see the
        !          7798: Estimated Time to Repair.  Sometimes docking helps to get things fixed faster.
        !          7799: If you lose both your warp and impulse engines, try the tractors.  The
        !          7800: Base doesn't take damage because it has much more redundancy than the
        !          7801: Enterprise.
        !          7802: 
        !          7803: You get points for destroying enemies and hostile torpedoes.  At the end of
        !          7804: a wave, you also get bonus points for saving stars, saving the Enterprise
        !          7805: and Base, and for having an efficiency rating higher that 0.8.  You get
        !          7806: NEGATIVE bonus points for letting friendly life forms get blown up, and for
        !          7807: giving up.  Bonuses tend to be scaled by the ratio of the number of points
        !          7808: you got over the number of points you could have got.  If you think you are
        !          7809: done with a wave, but it won't quit, there may be homing torpedoes that you
        !          7810: haven't destroyed--you must make the universe safe for posterity, you know.
        !          7811: 
        !          7812: When you have used up your Enterprises and Bases (or quit), your score will
        !          7813: be posted to the scoreboard.  You may see the scoreboard outside of the game
        !          7814: simply by giving the command "warp -s".
        !          7815: 
        !          7816: If you get bored, you can always play with some of the undocumented switches
        !          7817: that are used to test warp.  Such funny games go on their own scoreboard.
        !          7818: For kicks try "warp -x -d50 -C -\& -G -T -E400 -S5" and then go hide.  Quick.
        !          7819: 
        !          7820:  that you
        !          7821: haven't destroyed--you must make the universe safe for posterity, you know.
        !          7822: 
        !          7823: When you have used up your Enterprises and Bases (or quit), your score will
        !          7824: be posted to the scoreboard.  You may see the scoreboard outside of the game
        !          7825: simply by giving the command "warp -s".
        !          7826: 
        !          7827: If you get bored, you can always play with some of the undocumented switches
        !          7828: that are used to test warp.  Such funny games go on their own scoreboard.
        !          7829: For kicks try "warp -x -d50 -C -\& -G -T -E400warp/score.h   644    171      5        1701  5121750066   6321 /* $Header: score.h,v 7.0 86/10/08 15:13:21 lwall Exp $ */
        !          7830: 
        !          7831: /* $Log:       score.h,v $
        !          7832:  * Revision 7.0  86/10/08  15:13:21  lwall
        !          7833:  * Split into separate files.  Added amoebas and pirates.
        !          7834:  * 
        !          7835:  */
        !          7836: 
        !          7837: #define ENTBOUNDARY 100000     /*  point boundary across which a new E is
        !          7838:                                        awarded */
        !          7839: 
        !          7840: #define BASEBOUNDARY 250000    /*  point boundary across which a new B is
        !          7841:                                        awarded */
        !          7842: 
        !          7843: EXT int oldstatus;
        !          7844: EXT int oldetorp;
        !          7845: EXT int oldbtorp;
        !          7846: EXT int oldstrs;
        !          7847: EXT int oldenemies;
        !          7848: 
        !          7849: EXT long totalscore;
        !          7850: EXT long lastscore INIT(0);
        !          7851: EXT long curscore;
        !          7852: EXT long possiblescore;
        !          7853: EXT long oldeenergy;
        !          7854: EXT long oldbenergy;
        !          7855: EXT long oldcurscore;
        !          7856: 
        !          7857: EXT char savefilename[40];
        !          7858: 
        !          7859: #ifdef SCOREFULL
        !          7860: #define COMPOFF 0
        !          7861: #define COMPNAME longlognam
        !          7862: #define COMPLEN 24
        !          7863: #else
        !          7864: #define COMPOFF 24
        !          7865: #define COMPNAME longlognam
        !          7866: #define COMPLEN 8
        !          7867: #endif
        !          7868: EXT char longlognam[128];
        !          7869: 
        !          7870: EXT char c INIT(' ');
        !          7871: 
        !          7872: void score_init();
        !          7873: void wscore();
        !          7874: void display_status();
        !          7875: void wavescore();
        !          7876: void score();
        !          7877: void save_game();
        !          7878: enemies;
        !          7879: 
        !          7880: EXT long totalscore;
        !          7881: EXT long lastscore INIT(0);
        !          7882: EXT warp/warp.c   644    171      5       23766  5121750116   6205 char rcsid[] = "@(#)$Header: warp.c,v 7.0.1.3 86/12/12 17:07:44 lwall Exp $";
        !          7883: 
        !          7884: /*     warp -- a real-time space war program
        !          7885:  *     author: Larry Wall
        !          7886:  *     helpers: Jonathan and Mark Biggar, and Dan Faigin
        !          7887:  *     special thanks to my sweetie Gloria who suggested the Planet Crusher
        !          7888:  *
        !          7889:  *     Copyright (C) 1986, Larry Wall
        !          7890:  *
        !          7891:  *     This program may be copied as long as this copyright notice is
        !          7892:  *     included, and as long as it is not being copied for purposes
        !          7893:  *     of profit.  If you want to modify this program in any way other
        !          7894:  *     than normal configuration changes, common decency would suggest
        !          7895:  *     that you also modify the name of the program so that my good name
        !          7896:  *     (what there is of it) is not impugned.  (Calling it something like
        !          7897:  *     "warpx" or "superwarp" would be fine.)  Also, give it another
        !          7898:  *     WARPDIR so that the scoreboards don't get confused.
        !          7899:  *
        !          7900:  * version 5.0  04/20/83
        !          7901:  *         5.1  05/05/83       various tidbits
        !          7902:  *        5.2  05/12/83        VAX -> vax, ifdef'ed a SIGCONT
        !          7903:  *        5.3  05/24/83        RCS
        !          7904:  *
        !          7905:  * $Log:       warp.c,v $
        !          7906:  * Revision 7.0.1.3  86/12/12  17:07:44  lwall
        !          7907:  * Baseline for net release.
        !          7908:  * 
        !          7909:  * Revision 7.0.1.2  86/10/20  12:08:00  lwall
        !          7910:  * Made all exits reset tty.
        !          7911:  * 
        !          7912:  * Revision 7.0.1.1  86/10/16  10:54:13  lwall
        !          7913:  * Added Damage.  Fixed random bugs.
        !          7914:  * 
        !          7915:  * Revision 7.0  86/10/08  15:14:47  lwall
        !          7916:  * Split into separate files.  Added amoebas and pirates.
        !          7917:  * 
        !          7918:  * Revision 6.4  83/12/16  13:11:45  lwall
        !          7919:  * Handled 15 bit random number generators.
        !          7920:  * 
        !          7921:  * Fixed array overflow bug on multiple zaps.
        !          7922:  * 
        !          7923:  * Multiple zaps now consolidated to minimize output.
        !          7924:  * 
        !          7925:  * Tholian jackpot games outlawed under difficulty 15.
        !          7926:  * 
        !          7927:  * Revision 6.3  83/08/24  11:17:49  lwall
        !          7928:  * Fixed array overflow bug on multiple zap.
        !          7929:  * 
        !          7930:  * Revision 6.2  83/08/23  18:06:37  lwall
        !          7931:  * Added zap command.
        !          7932:  * Warp -s should now work on dumb terminals
        !          7933:  * Specifying difficulty >= 40 now just makes it a special game.
        !          7934:  * SIGTTOU #ifdef'ed.
        !          7935:  * No-delay read provided as alternative to FIONREAD.
        !          7936:  * Warp won't report "-1 obsolete" when there are no Enterprises left.
        !          7937:  * Some high-difficulty tuning.
        !          7938:  * 
        !          7939:  * Revision 6.1  83/08/17  08:49:03  lwall
        !          7940:  * Fixed obscure bug in storing UP that caused a %. in CM to occasionally
        !          7941:  * foist garbage onto the screen.
        !          7942:  * 
        !          7943:  * Revision 6.0  83/08/08  17:09:26  lwall
        !          7944:  * New baseline version for net release.
        !          7945:  * 
        !          7946:  * Revision 5.5  83/08/01  10:59:56  lwall
        !          7947:  * Cloaking for the Enterprise.
        !          7948:  * Difficulty now goes to 99, and many activities depending on difficulty
        !          7949:  *     have been adjusted in frequency.
        !          7950:  * Simplified exit sequence, and reduced dependencies on control
        !          7951:  *     characters.  You needn't see the scoreboard if you don't want to.
        !          7952:  * Hitting i,w,c, or v switches to Enterprise.  Hitting p switches to Base.
        !          7953:  * Excessive use of q is not allowed.
        !          7954:  * Excessive use of D is not allowed.
        !          7955:  * Scoreboard may depend on either full name or login name.
        !          7956:  * Integrated scoreboard lister.  Login name now shows up on scoreboard.
        !          7957:  * "Hidden" startup options are now upper case.
        !          7958:  * Checks upon startup for no cursor movement, or screen too small.
        !          7959:  * Checks upon startup that WARPDIR is correctly protected, and that warp
        !          7960:  *     is running setuid.  As an additional bonus this prevents root from
        !          7961:  *     running warp, which mucks things up, UN*X be blessed.
        !          7962:  * All gets's turned into fgets's for safety.
        !          7963:  * Bonus Enterprises and Bases.
        !          7964:  * Escalating bonuses for saving Base and Enterprise.
        !          7965:  * Escalating Enterprise energy.
        !          7966:  * Turbolasers decrease with distance.
        !          7967:  * Really smart enemies can see through stars occasionally.
        !          7968:  * Occasional Tholian jackpot waves.  Tholians are a trifle nastier.
        !          7969:  * Choleric Gorns.
        !          7970:  * An O or o can miss seeing you.  Enemies can avoid a stationary O, o, or X.
        !          7971:  * Warp 3 enemies and other nastinesses are possible in massacre mode.
        !          7972:  * Enemies that decide to navigate when they see you can do other things than
        !          7973:  *     just come toward you.
        !          7974:  * Gorns occasionally launch a salvo for the fun of it.
        !          7975:  * Only star and enemy explosions can keep the round going now.
        !          7976:  * Bounces don't always go back to starting spot now.
        !          7977:  * Better full name processing.  USG quirks handled.  & substitution also
        !          7978:  *     handled now (whoever dreamed up that one must have been in the middle
        !          7979:  *     of the night before the morning after).
        !          7980:  * Catch ^D on fgets.
        !          7981:  * Version number printer.
        !          7982:  * Less signal catching during debugging.
        !          7983:  * 
        !          7984:  * Revision 5.4  83/06/24  09:28:38  lwall
        !          7985:  * 16 bit random number generators are now supported.
        !          7986:  * Made warp not blow up on a null save file.
        !          7987:  * Warp now prints E and B before the stars.
        !          7988:  * Fixed bug which caused torp count to get decremented even when no torp
        !          7989:  *     was launched because of an obstacle.
        !          7990:  * Put %<n>ld formats where appropriate.
        !          7991:  * Fixed E: 0  0 bug on refresh.
        !          7992:  * 
        !          7993:  * Revision 5.3  83/05/24  14:03:10  lwall
        !          7994:  * Starting RCS
        !          7995:  * 
        !          7996:  */
        !          7997: 
        !          7998: #include "INTERN.h"
        !          7999: #include "warp.h"
        !          8000: #include "EXTERN.h"
        !          8001: #include "bang.h"
        !          8002: #include "init.h"
        !          8003: #include "intrp.h"
        !          8004: #include "object.h"
        !          8005: #include "move.h"
        !          8006: #include "play.h"
        !          8007: #include "score.h"
        !          8008: #include "sig.h"
        !          8009: #include "term.h"
        !          8010: #include "them.h"
        !          8011: #include "us.h"
        !          8012: #include "util.h"
        !          8013: #include "version.h"
        !          8014: #include "weapon.h"
        !          8015: 
        !          8016: main(argc,argv)
        !          8017: int argc;
        !          8018: char *argv[];
        !          8019: {
        !          8020:     char tmp, *s, *tcbuf;
        !          8021: 
        !          8022:     int i;
        !          8023: 
        !          8024:     FILE *savfil;
        !          8025: 
        !          8026: #if RANDBITS > 16
        !          8027:     for (i=100; i; i--)
        !          8028:        if (rand() >= 65536)
        !          8029:            goto rand_ok;
        !          8030:     printf("Recompile with RANDBITS = 15 or 16.\n");
        !          8031:     exit(1);
        !          8032: #else
        !          8033: #if RANDBITS > 15
        !          8034:     for (i=100; i; i--) {
        !          8035:        if (rand() >= 32768)
        !          8036:            goto rand_ok;
        !          8037:     }
        !          8038:     printf("Recompile with RANDBITS = 15.\n");
        !          8039:     exit(1);
        !          8040: #endif
        !          8041: #endif
        !          8042: rand_ok:
        !          8043: 
        !          8044: #ifdef lint  /* to suppress "defined but never used" */
        !          8045: # ifdef SIGTSTP
        !          8046:     (void)stop_catcher();
        !          8047: # endif
        !          8048: # ifdef SIGCONT
        !          8049:     (void)cont_catcher();
        !          8050: # endif
        !          8051: #endif
        !          8052: 
        !          8053:     while (--argc > 0 && (*++argv)[0] == '-')
        !          8054:        for (s = argv[0]+1; *s != '\0'; s++)
        !          8055:            switch (*s) {
        !          8056:            case '&':
        !          8057:                amoebaspec = TRUE;
        !          8058:                beginner = TRUE;
        !          8059:                break;
        !          8060:            case 'A':
        !          8061:                apolspec = TRUE;
        !          8062:                beginner = TRUE;
        !          8063:                break;
        !          8064:            case 'b':
        !          8065:                beginner = TRUE;
        !          8066:                break;
        !          8067:            case 'C':
        !          8068:                crushspec = TRUE;
        !          8069:                beginner = TRUE;
        !          8070:                break;
        !          8071:            case 'D':
        !          8072:                debugging = TRUE;
        !          8073: #ifdef DEBUGGING
        !          8074:                debug = atoi(++s);
        !          8075: #endif
        !          8076:                s += strlen(s)-1;
        !          8077:                break;
        !          8078:            case 'd':
        !          8079:                s++;
        !          8080:                if (*s == '=') s++;
        !          8081:                ismarts = atoi(s);
        !          8082:                if (ismarts <= 0)
        !          8083:                    ismarts = 1;
        !          8084:                if (ismarts > 99)
        !          8085:                    ismarts = 99;
        !          8086:                if (ismarts > 40)
        !          8087:                    beginner = TRUE;
        !          8088:                s += strlen(s)-1;
        !          8089:                break;
        !          8090:            case 'E':
        !          8091:                klingspec = TRUE;
        !          8092:                beginner = TRUE;
        !          8093:                s++;
        !          8094:                if (*s == '=') s++;
        !          8095:                inumenemies = atoi(s);
        !          8096:                s += strlen(s)-1;
        !          8097:                break;
        !          8098:            case 'F':
        !          8099:                friendspec = TRUE;
        !          8100:                beginner = TRUE;
        !          8101:                s++;
        !          8102:                if (*s == '=') s++;
        !          8103:                inumfriends = atoi(s);
        !          8104:                s += strlen(s)-1;
        !          8105:                break;
        !          8106:            case 'G':
        !          8107:                gornspec = TRUE;
        !          8108:                beginner = TRUE;
        !          8109:                break;
        !          8110:            case 'l':
        !          8111:                lowspeed = TRUE;
        !          8112:                break;
        !          8113:            case 'm':
        !          8114:                metakey = TRUE;
        !          8115:                break;
        !          8116:            case 'M':
        !          8117:                massacre = TRUE;
        !          8118:                break;
        !          8119:            case 'P':
        !          8120:                piratespec = TRUE;
        !          8121:                beginner = TRUE;
        !          8122:                s++;
        !          8123:                if (*s == '=') s++;
        !          8124:                inumpirates = atoi(s);
        !          8125:                s += strlen(s)-1;
        !          8126:                break;
        !          8127:            case 'S':
        !          8128:                prespec = TRUE;
        !          8129:                beginner = TRUE;
        !          8130:                s++;
        !          8131:                if (*s == '=') s++;
        !          8132:                if (*s)
        !          8133:                    prescene = atoi(s);
        !          8134:                else
        !          8135:                    prescene = -1;
        !          8136:                s += strlen(s)-1;
        !          8137:                break;
        !          8138:            case 'R':
        !          8139:                romspec = TRUE;
        !          8140:                beginner = TRUE;
        !          8141:                break;
        !          8142:            case '*':
        !          8143:                starspec = TRUE;
        !          8144:                beginner = TRUE;
        !          8145:                s++;
        !          8146:                if (*s == '=') s++;
        !          8147:                inumstars = atoi(s);
        !          8148:                s += strlen(s)-1;
        !          8149:                break;
        !          8150:            case 's':
        !          8151:                scorespec = TRUE;
        !          8152:                break;
        !          8153:            case 'T':
        !          8154:                tholspec = TRUE;
        !          8155:                beginner = TRUE;
        !          8156:                break;
        !          8157:            case 'x':
        !          8158:                experimenting = TRUE;
        !          8159:                break;
        !          8160:            case 'v':
        !          8161:                version();
        !          8162:                exit(0);
        !          8163:                break;
        !          8164:            default:
        !          8165:                fprintf(stderr,"warp: illegal option %c\n", *s);
        !          8166:                fprintf(stderr, "Usage: warp -dn -b -x -v -s\n");
        !          8167:                exit(1);
        !          8168:            }
        !          8169:     if (argc != 0) {
        !          8170:        fprintf(stderr, "Usage: warp -dn -b -x -v -s\n");
        !          8171:        exit(1);
        !          8172:     }
        !          8173:     bang_init();
        !          8174:     move_init();
        !          8175:     object_init();
        !          8176:     play_init();
        !          8177:     them_init();
        !          8178:     us_init();
        !          8179:     util_init();
        !          8180:     weapon_init();
        !          8181: 
        !          8182:     tcbuf = malloc(1024);
        !          8183:     intrp_init(tcbuf);
        !          8184: 
        !          8185:     if (chdir(warplib) < 0)
        !          8186:        fprintf(stderr,nocd,warplib);
        !          8187: 
        !          8188:     term_init();
        !          8189: 
        !          8190:     term_set(tcbuf);
        !          8191:     free(tcbuf);
        !          8192: 
        !          8193:     umask(022);     /* mustn't rely on incoming umask--could be 033 which */
        !          8194:                    /* would disable people from running wscore */
        !          8195: 
        !          8196:     score_init();
        !          8197: 
        !          8198:     sig_init();
        !          8199: 
        !          8200:     if (totalscore) {
        !          8201:        clear();
        !          8202:        mvaddstr(12,25,"*** restoring saved game ***");
        !          8203:        roundsleep(1);
        !          8204:     }
        !          8205: 
        !          8206:     srand(getpid());
        !          8207: 
        !          8208:     do {
        !          8209:        for (keepgoing = TRUE;;) {
        !          8210:            if (!experimenting) {
        !          8211:                if ((savfil = fopen(savefilename,"w")) == NULL) {
        !          8212:                    resetty();
        !          8213:                    printf("Can't open savefile\r\n");
        !          8214:                    finalize(1);
        !          8215:                }
        !          8216:                fprintf(savfil,
        !          8217:                    "%-8s %10ld, %2d,%5d,%2d,%2d,%3d %c%c%c%c%c%c%c%c%c\n",
        !          8218:                    logname, totalscore, smarts, cumsmarts,
        !          8219:                    numents, numbases, wave,
        !          8220:                    apolspec ? 'a' : ' ',
        !          8221:                    beginner   ? 'b' : ' ',
        !          8222:                    crushspec  ? 'c' : ' ',
        !          8223:                    gornspec   ? 'g' : ' ',
        !          8224:                    massacre   ? 'm' : ' ',
        !          8225:                    romspec    ? 'r' : ' ',
        !          8226:                    tholspec   ? 't' : ' ',
        !          8227:                    lowspeed   ? 'l' : ' ',
        !          8228:                    amoebaspec ? '&' : ' '
        !          8229:                );
        !          8230:                fprintf(savfil,"         running on %s, process #%d\n",
        !          8231:                    term+5,getpid());
        !          8232:                Fclose(savfil);
        !          8233:            }
        !          8234: 
        !          8235:            lastscore = totalscore;
        !          8236:            initialize();
        !          8237:            play();
        !          8238:            cumsmarts += smarts;
        !          8239:            wavescore();
        !          8240:            if (numents<=0 && numbases<=0)
        !          8241:                keepgoing = FALSE;
        !          8242:          if (!keepgoing) break;
        !          8243:            do {
        !          8244:                if (experimenting) {
        !          8245:                    mvaddstr(23,15,
        !          8246:                      "      [Hit space to continue, 'q' to quit]       ");
        !          8247:                }
        !          8248:                else {
        !          8249:                    mvaddstr(23,15,
        !          8250:                      "[Hit space to continue, 's' to save, 'q' to quit]");
        !          8251:                }
        !          8252:                sleep(1);
        !          8253:                Fflush(stdout);
        !          8254:                eat_typeahead();
        !          8255:                getcmd(&tmp);
        !          8256:                if (tmp == BREAKCH || tmp == INTRCH) {
        !          8257:                    mvaddstr(23,15,
        !          8258:                      "                                                 ");
        !          8259:                    mvaddstr(23,33,
        !          8260:                      "Really quit? ");
        !          8261:                    getcmd(&tmp);
        !          8262:                    if (tmp == 'y' || tmp == 'Y')
        !          8263:                        tmp = 'q';
        !          8264:                    else
        !          8265:                        tmp = 1;
        !          8266:                }
        !          8267:            } while (tmp != INTRCH && tmp != BREAKCH && !index(" qQs",tmp));
        !          8268:          if (tmp != ' ' && tmp != 's') break;
        !          8269:            if (!beginner && smarts < 20)
        !          8270:                smarts += 4;
        !          8271:            else if (!beginner && smarts < 35)
        !          8272:                smarts += 2;
        !          8273:            else if (smarts < 99)
        !          8274:                smarts++;
        !          8275:          if (tmp == 's') save_game();
        !          8276:        }
        !          8277:        score();
        !          8278: 
        !          8279:     } while (justonemoretime);
        !          8280: 
        !          8281:     if (!experimenting)
        !          8282:        unlink(savefilename);
        !          8283: 
        !          8284:     clear();
        !          8285:     resetty();
        !          8286:     exit(0);
        !          8287: }
        !          8288: tcmd(&tmp)warp/us.c   644    171      5       23563  5121750123   5654 /* $Header: us.c,v 7.0.1.3 87/01/13 17:13:21 lwall Exp $ */
        !          8289: 
        !          8290: /* $Log:       us.c,v $
        !          8291:  * Revision 7.0.1.3  87/01/13  17:13:21  lwall
        !          8292:  * Partially fixed ^S behavior.  It now just ignores ^S.
        !          8293:  * 
        !          8294:  * Revision 7.0.1.2  86/12/12  17:06:09  lwall
        !          8295:  * Baseline for net release.
        !          8296:  * 
        !          8297:  * Revision 7.0.1.1  86/10/16  10:53:50  lwall
        !          8298:  * Added Damage.  Fixed random bugs.
        !          8299:  * 
        !          8300:  * Revision 7.0  86/10/08  15:14:21  lwall
        !          8301:  * Split into separate files.  Added amoebas and pirates.
        !          8302:  * 
        !          8303:  */
        !          8304: 
        !          8305: #include "EXTERN.h"
        !          8306: #include "warp.h"
        !          8307: #include "bang.h"
        !          8308: #include "object.h"
        !          8309: #include "play.h"
        !          8310: #include "sig.h"
        !          8311: #include "term.h"
        !          8312: #include "util.h"
        !          8313: #include "weapon.h"
        !          8314: #include "INTERN.h"
        !          8315: #include "us.h"
        !          8316: 
        !          8317: void
        !          8318: us_init()
        !          8319: {
        !          8320:     ;
        !          8321: }
        !          8322: 
        !          8323: void
        !          8324: do_direction(dy,dx)
        !          8325: int dy, dx;
        !          8326: {
        !          8327:     Reg1 int decr;
        !          8328:     Reg2 OBJECT *obj;
        !          8329: 
        !          8330:     if (status < 2) {
        !          8331:        if (cloaking) {
        !          8332:            char ch;
        !          8333:            
        !          8334:            cloaked = FALSE;
        !          8335:            ch = (ent->energy >= 500?'E':'e');
        !          8336:            if (ch != ent->image) {
        !          8337:                setimage(ent, ch);
        !          8338:            }
        !          8339:        }
        !          8340:        decr = 5+abs(evely)+abs(evelx)+tractor*tractor;
        !          8341:        if (ent->energy >= decr) {
        !          8342:            ent->energy -= decr;
        !          8343:            if (tractor) {
        !          8344:                if (!damage || !damflag[NOTRACTORS]) {
        !          8345:                    if (!rand_mod(50)) {
        !          8346:                        damage++;
        !          8347:                        damflag[NOTRACTORS] = rand_mod(smarts+10)+2;
        !          8348:                    }
        !          8349:                    if (tract(ent,dy,dx,tractor)) {
        !          8350:                        evely += tractor*dy;
        !          8351:                        evelx += tractor*dx;
        !          8352:                    }
        !          8353:                }
        !          8354:            }
        !          8355:            else if (!damage ||
        !          8356:              (!entmode && !damflag[NOIMPULSE]) ||
        !          8357:              (entmode && !damflag[NOWARP]) ) {
        !          8358:                if (!rand_mod(30+500/(abs(evely)+abs(evelx)+1))) {
        !          8359:                    damage++;
        !          8360:                    damflag[entmode?NOWARP:NOIMPULSE] = rand_mod(smarts+10)+2;
        !          8361:                }
        !          8362:                evely += dy;
        !          8363:                evelx += dx;
        !          8364:            }
        !          8365:            if (inumthols &&
        !          8366:              (obj=occupant[(ent->posy+evely+YSIZE00)%YSIZE]
        !          8367:                           [(ent->posx+evelx+XSIZE00)%XSIZE] ) &&
        !          8368:              obj->type == Web)
        !          8369:                evely = evelx = 0;
        !          8370:        }
        !          8371:     }
        !          8372:     else if (status == 2) {
        !          8373:        decr = 500+abs(bvely)*5+abs(bvelx)*5+tractor*tractor*100;
        !          8374:        if (base->energy >= decr) {
        !          8375:            base->energy -= decr;
        !          8376:            if (tractor) {
        !          8377:                if (tract(base,dy,dx,tractor)) {
        !          8378:                    bvely += tractor*dy;
        !          8379:                    bvelx += tractor*dx;
        !          8380:                }
        !          8381:            }
        !          8382:            else {
        !          8383:                bvely += dy;
        !          8384:                bvelx += dx;
        !          8385:            }
        !          8386:            if (inumthols &&
        !          8387:              (obj=occupant[(base->posy+bvely+YSIZE00)%YSIZE]
        !          8388:                           [(base->posx+bvelx+XSIZE00)%XSIZE] ) &&
        !          8389:              obj->type == Web)
        !          8390:                bvely = bvelx = 0;
        !          8391:        }
        !          8392:     }
        !          8393:     tractor = 0;
        !          8394: }
        !          8395: 
        !          8396: void
        !          8397: ctrl_direction(dy,dx)
        !          8398: int dy, dx;
        !          8399: {
        !          8400:     if (status < 2) {
        !          8401:        if (cloaking) {
        !          8402:            char ch;
        !          8403:            
        !          8404:            cloaked = FALSE;
        !          8405:            ch = (ent->energy >= 500?'E':'e');
        !          8406:            if (ch != ent->image) {
        !          8407:                setimage(ent, ch);
        !          8408:            }
        !          8409:        }
        !          8410:        if (!damage || !damflag[NOPHASERS]) {
        !          8411:            if (!rand_mod(200)) {
        !          8412:                damage++;
        !          8413:                damflag[NOPHASERS] = rand_mod(smarts+10)+2;
        !          8414:            }
        !          8415:            fire_phaser(ent, dy, dx);
        !          8416:        }
        !          8417:     }
        !          8418:     else if (status == 2)
        !          8419:        fire_phaser(base, dy, dx);
        !          8420: }
        !          8421: 
        !          8422: void
        !          8423: shift_direction(dy,dx)
        !          8424: int dy, dx;
        !          8425: {
        !          8426:     if (status < 2) {
        !          8427:        if (cloaking) {
        !          8428:            char ch;
        !          8429:            
        !          8430:            cloaked = FALSE;
        !          8431:            ch = (ent->energy >= 500?'E':'e');
        !          8432:            if (ch != ent->image) {
        !          8433:                setimage(ent, ch);
        !          8434:            }
        !          8435:        }
        !          8436:        if (!damage || !damflag[NOTORPS]) {
        !          8437:            if (!rand_mod(300)) {
        !          8438:                damage++;
        !          8439:                damflag[NOTORPS] = rand_mod(smarts+10)+2;
        !          8440:            }
        !          8441:            fire_torp(ent, dy, dx);
        !          8442:        }
        !          8443:     }
        !          8444:     else if (status == 2)
        !          8445:        fire_torp(base, dy, dx);
        !          8446: }
        !          8447: 
        !          8448: void
        !          8449: get_commands(done)
        !          8450: bool *done;
        !          8451: {
        !          8452:     static char ch[80];
        !          8453:     Reg1 int i;
        !          8454:     Reg2 int count;
        !          8455:     Reg3 bool ctrla = FALSE;
        !          8456:     char numdestructs = 0, numzaps = 0;
        !          8457: 
        !          8458: top:
        !          8459:     while (count = read_nd(ch,(sizeof ch))) {
        !          8460:        for (i=0; i<count; i++) {
        !          8461:            if (ch[i] == 'Q') {
        !          8462:                bombed_out = TRUE;
        !          8463:                *done = TRUE;
        !          8464:                keepgoing = FALSE;
        !          8465:                return;
        !          8466:            }
        !          8467:            if (ch[i] == 'q' || ch[i] == BREAKCH || ch[i] == INTRCH) {
        !          8468:                int x;
        !          8469:                static char quest[] = "Do you wish to escape from reality? ";
        !          8470: 
        !          8471:                if (timer >= whenok) {
        !          8472:                    mvaddstr(12,22,quest);
        !          8473:                    do {
        !          8474:                        getcmd(&ch[i]);
        !          8475:                    } while (ch[i] != 'y' && ch[i] != 'n');
        !          8476:                    if (ch[i] == 'y') {
        !          8477:                        bombed_out = TRUE;
        !          8478:                        *done = TRUE;
        !          8479:                        return;
        !          8480:                    }
        !          8481:                    else {
        !          8482:                        for (x=11; x<=28; x++) {
        !          8483:                            mvaddch(12,x*2,
        !          8484:                                occupant[11][x]
        !          8485:                                   ? occupant[11][x]->image
        !          8486:                                   : numamoebas
        !          8487:                                      ? amb[11][x]
        !          8488:                                      : ' ');
        !          8489:                            addspace();
        !          8490:                        }
        !          8491:                        roundsleep(2);
        !          8492:                        whenok = timer + 10;
        !          8493:                        goto top;
        !          8494:                    }
        !          8495:                }
        !          8496:                else {
        !          8497:                    write(1,"\07",1);
        !          8498:                    goto top;
        !          8499:                }
        !          8500:            }
        !          8501:        }
        !          8502:        for (i=0; i<count; i++) {
        !          8503:            if (ctrla) {
        !          8504:                switch (ch[i]) {
        !          8505:                case '1': case 'b':
        !          8506:                    ctrl_direction(1, -1);
        !          8507:                    break;
        !          8508:                case '2': case 'j':
        !          8509:                    ctrl_direction(1, 0);
        !          8510:                    break;
        !          8511:                case '3': case 'n':
        !          8512:                    ctrl_direction(1, 1);
        !          8513:                    break;
        !          8514:                case '4': case 'h':
        !          8515:                    ctrl_direction(0, -1);
        !          8516:                    break;
        !          8517:                case '6': case 'l':
        !          8518:                    ctrl_direction(0, 1);
        !          8519:                    break;
        !          8520:                case '7': case 'y':
        !          8521:                    ctrl_direction(-1, -1);
        !          8522:                    break;
        !          8523:                case '8': case 'k':
        !          8524:                    ctrl_direction(-1, 0);
        !          8525:                    break;
        !          8526:                case '9': case 'u':
        !          8527:                    ctrl_direction(-1, 1);
        !          8528:                    break;
        !          8529:                case 'r':
        !          8530:                    rewrite();
        !          8531:                    roundsleep(3);
        !          8532:                    ctrla = FALSE;
        !          8533:                    goto top;
        !          8534:                case 'w':
        !          8535:                    clear();
        !          8536:                    while (!input_pending())
        !          8537:                        sleep(1);
        !          8538:                    rewrite();
        !          8539:                    roundsleep(3);
        !          8540:                    ctrla = FALSE;
        !          8541:                    goto top;
        !          8542: #ifdef SIGTSTP
        !          8543:                case 'z':
        !          8544:                    clear();
        !          8545:                    mytstp();
        !          8546:                    sleep(4);
        !          8547:                    ctrla = FALSE;
        !          8548:                    goto top;
        !          8549: #endif
        !          8550:                default:
        !          8551:                    break;
        !          8552:                }
        !          8553:                ctrla = FALSE;
        !          8554:            }
        !          8555:            else {
        !          8556:                switch (ch[i]) {
        !          8557:                case 'Z':
        !          8558:                    clear();
        !          8559:                    mytstp();
        !          8560:                    sleep(4);
        !          8561:                    goto top;
        !          8562:                case 'i':
        !          8563:                    if (ent && (!damage || !damflag[NOIMPULSE])) {
        !          8564:                        entmode = 0;
        !          8565:                        status = 0;
        !          8566:                    }
        !          8567:                    break;
        !          8568:                case 'w':
        !          8569:                    if (ent && (!damage || !damflag[NOWARP])) {
        !          8570:                        entmode = 1;
        !          8571:                        status = 1;
        !          8572:                    }
        !          8573:                    break;
        !          8574:                case 'p':
        !          8575:                    if (base) {
        !          8576:                        status = 2;
        !          8577:                    }
        !          8578:                    break;
        !          8579:                case 'o':
        !          8580:                    if (status < 2) {
        !          8581:                        if (base)
        !          8582:                            status = 2;
        !          8583:                    }
        !          8584:                    else if (status == 2) {
        !          8585:                        if (ent)
        !          8586:                            status = entmode;
        !          8587:                    }
        !          8588:                    break;
        !          8589:                case 'v':
        !          8590:                    if (ent) {
        !          8591:                        status = entmode;
        !          8592:                    }
        !          8593:                    cloaking=FALSE;
        !          8594:                    cloaked=FALSE;
        !          8595:                    break;
        !          8596:                case 'c':
        !          8597:                    if (ent) {
        !          8598:                        status = entmode;
        !          8599:                        if (ent->energy >= 250)
        !          8600:                            cloaking = TRUE;
        !          8601:                    }
        !          8602:                    break;
        !          8603:                case 'z':
        !          8604:                    if (ent && (!damage || !damflag[NOZAPPER])) {
        !          8605:                        ++numzaps;
        !          8606:                        if (!rand_mod(100/numzaps)) {
        !          8607:                            damage++;
        !          8608:                            damflag[NOZAPPER] = rand_mod(smarts+10)+2;
        !          8609:                        }
        !          8610:                        if (nxtbang && bangm[nxtbang-1] < 0)
        !          8611:                            --nxtbang;  /* consolidate zaps */
        !          8612:                        make_blast(evely*2+ent->posy,evelx*2+ent->posx,
        !          8613:                            -5000000L, 3*numzaps);
        !          8614:                        ent->energy /= 2;
        !          8615:                    }
        !          8616:                    break;
        !          8617:                case 'D':
        !          8618:                    if (status < 2 && (!damage || !damflag[NODESTRUCT])) {
        !          8619:                        if (ent && !rand_mod(10)) {
        !          8620:                            damage++;
        !          8621:                            damflag[NODESTRUCT] = rand_mod(smarts+10)+2;
        !          8622:                        }
        !          8623:                        if (++numdestructs <= 2)
        !          8624:                            make_blast(evely*2+ent->posy,evelx*2+ent->posx,
        !          8625:                                15000L, 3);
        !          8626:                        ent->energy /= 4;
        !          8627:                    }
        !          8628:                    else if (status == 2) {
        !          8629:                        if (numdestructs)
        !          8630:                            base->energy = base->energy / 2;
        !          8631:                        if (++numdestructs <= 2)
        !          8632:                            make_blast(base->posy, base->posx, 15000L, 5);
        !          8633:                    }
        !          8634:                    break;
        !          8635:                case 'd':
        !          8636:                    if ((!damage || !damflag[NODESTRUCT]) && (base||ent)) {
        !          8637:                        Reg4 OBJECT *obj;
        !          8638:                        int x, y;
        !          8639: 
        !          8640:                        if (ent && !rand_mod(200)) {
        !          8641:                            damage++;
        !          8642:                            damflag[NODESTRUCT] = rand_mod(smarts+10)+2;
        !          8643:                        }
        !          8644:                        for (obj = root.prev;
        !          8645:                          obj != &root;
        !          8646:                          obj = obj->prev) {
        !          8647:                            if (obj->image == '+') {
        !          8648:                                blast[y=(obj->posy+obj->vely+YSIZE00)%YSIZE]
        !          8649:                                     [x=(obj->posx+obj->velx+XSIZE00)%XSIZE]
        !          8650:                                     += 1;
        !          8651:                                yblasted[y] |= 1;
        !          8652:                                xblasted[x] |= 1;
        !          8653:                                blasted = TRUE;
        !          8654:                                obj->mass = (massacre?3000:4000);
        !          8655:                            }
        !          8656:                        }
        !          8657:                    }
        !          8658:                    break;
        !          8659:                case 's':
        !          8660:                    if ((!damage || !damflag[NODESTRUCT]) && (base||ent)) {
        !          8661:                        Reg4 OBJECT *obj;
        !          8662:                        if (ent && !rand_mod(200)) {
        !          8663:                            damage++;
        !          8664:                            damflag[NODESTRUCT] = rand_mod(smarts+10)+2;
        !          8665:                        }
        !          8666:                        for (obj = root.prev;
        !          8667:                          obj->type == Torp || obj->type == Web ||
        !          8668:                          obj->type == Star;
        !          8669:                          obj = obj->prev) {
        !          8670:                            if (obj->image == '+')
        !          8671:                                obj->vely = obj->velx = 0;
        !          8672:                        }
        !          8673:                    }
        !          8674:                    break;
        !          8675:                case '\001':
        !          8676:                    ctrla = TRUE;
        !          8677:                    break;
        !          8678:                case '\002':
        !          8679:                case '\003':
        !          8680:                case '\004':
        !          8681:                case '\005':
        !          8682:                case '\006':
        !          8683:                case '\007':
        !          8684:                case '\010':
        !          8685:                case '\011':
        !          8686:                case '\012':
        !          8687:                case '\013':
        !          8688:                case '\014':
        !          8689:                case '\015':
        !          8690:                case '\016':
        !          8691:                case '\017':
        !          8692:                case '\020':
        !          8693:                case '\021':
        !          8694:                case '\022':
        !          8695:                case '\023':
        !          8696:                case '\024':
        !          8697:                case '\025':
        !          8698:                case '\026':
        !          8699:                case '\027':
        !          8700:                case '\030':
        !          8701:                case '\031':
        !          8702:                case '\032':
        !          8703:                    ch[i] += 96;
        !          8704:                    i--;
        !          8705:                    ctrla = TRUE;
        !          8706:                    break;
        !          8707:                case '\033':
        !          8708:                    tractor = 0;
        !          8709:                    break;
        !          8710:                case 'a':
        !          8711:                    tractor++;
        !          8712:                    break;
        !          8713:                case 'r':
        !          8714:                    tractor--;
        !          8715:                    break;
        !          8716:                case '1': case 'b':
        !          8717:                    do_direction(1,-1);
        !          8718:                    break;
        !          8719:                case '2': case 'j':
        !          8720:                    do_direction(1,0);
        !          8721:                    break;
        !          8722:                case '3': case 'n':
        !          8723:                    do_direction(1,1);
        !          8724:                    break;
        !          8725:                case '4': case 'h':
        !          8726:                    do_direction(0,-1);
        !          8727:                    break;
        !          8728:                case '6': case 'l':
        !          8729:                    do_direction(0,1);
        !          8730:                    break;
        !          8731:                case '7': case 'y':
        !          8732:                    do_direction(-1,-1);
        !          8733:                    break;
        !          8734:                case '8': case 'k':
        !          8735:                    do_direction(-1,0);
        !          8736:                    break;
        !          8737:                case '9': case 'u':
        !          8738:                    do_direction(-1,1);
        !          8739:                    break;
        !          8740:                case '0': case 'S':
        !          8741:                    if (status < 2) {
        !          8742:                        evely = 0;
        !          8743:                        evelx = 0;
        !          8744:                    }
        !          8745:                    break;
        !          8746:                case '-':
        !          8747:                    if (status < 2 && ent->energy >= 10) {
        !          8748:                        evely *= -1;
        !          8749:                        evelx *= -1;
        !          8750:                        ent->energy -= 10;
        !          8751:                    }
        !          8752:                    break;
        !          8753:                case '%': case '\177': case '_':
        !          8754:                    shift_direction(0, -1);
        !          8755:                    shift_direction(0, 1);
        !          8756:                    shift_direction(-1, 0);
        !          8757:                    shift_direction(1, 0);
        !          8758:                    shift_direction(-1, -1);
        !          8759:                    shift_direction(-1, 1);
        !          8760:                    shift_direction(1, -1);
        !          8761:                    shift_direction(1, 1);
        !          8762:                    break;
        !          8763:                case '!': case 'B':
        !          8764:                    shift_direction(1, -1);
        !          8765:                    break;
        !          8766:                case '@': case 'J':
        !          8767:                    shift_direction(1, 0);
        !          8768:                    break;
        !          8769:                case '#': case 'N':
        !          8770:                    shift_direction(1, 1);
        !          8771:                    break;
        !          8772:                case '$': case 'H':
        !          8773:                    shift_direction(0, -1);
        !          8774:                    break;
        !          8775:                case '^': case 'L':
        !          8776:                    shift_direction(0, 1);
        !          8777:                    break;
        !          8778:                case '&': case 'Y':
        !          8779:                    shift_direction(-1, -1);
        !          8780:                    break;
        !          8781:                case '*': case 'K':
        !          8782:                    shift_direction(-1, 0);
        !          8783:                    break;
        !          8784:                case '(': case 'U':
        !          8785:                    shift_direction(-1, 1);
        !          8786:                    break;
        !          8787:                case '?':
        !          8788:                    helper();
        !          8789:                    roundsleep(3);
        !          8790:                    goto top;
        !          8791:                default:
        !          8792:                    break;
        !          8793:                }
        !          8794:            }
        !          8795:        }
        !          8796:     }
        !          8797: }
        !          8798:            break;
        !          8799:                case '#': case 'N':
        !          8800:                    shift_direction(1, 1);
        !          8801:                    break;
        !          8802:                case '$': case 'H':
        !          8803:                    shift_direction(0, -1);
        !          8804:                    break;
        !          8805: warp/them.c   644    171      5       23051  5121750127   6156 /* $Header: them.c,v 7.0.1.5 86/12/12 17:05:41 lwall Exp $ */
        !          8806: 
        !          8807: /* $Log:       them.c,v $
        !          8808:  * Revision 7.0.1.5  86/12/12  17:05:41  lwall
        !          8809:  * Baseline for net release.
        !          8810:  * 
        !          8811:  * Revision 7.0.1.4  86/10/20  12:32:38  lwall
        !          8812:  * Wasn't clearing FRIENDLY flag on pirate creation.
        !          8813:  * 
        !          8814:  * Revision 7.0.1.3  86/10/20  12:15:33  lwall
        !          8815:  * Was trying to create pirates from cloaked pirates.
        !          8816:  * 
        !          8817:  * Revision 7.0.1.2  86/10/17  10:03:44  lwall
        !          8818:  * Fixed Romulan writing spaces while cloaked.
        !          8819:  * 
        !          8820:  * Revision 7.0.1.1  86/10/16  10:53:39  lwall
        !          8821:  * Added Damage.  Fixed random bugs.
        !          8822:  * 
        !          8823:  * Revision 7.0  86/10/08  15:14:15  lwall
        !          8824:  * Split into separate files.  Added amoebas and pirates.
        !          8825:  * 
        !          8826:  */
        !          8827: 
        !          8828: #include "EXTERN.h"
        !          8829: #include "warp.h"
        !          8830: #include "bang.h"
        !          8831: #include "object.h"
        !          8832: #include "move.h"
        !          8833: #include "score.h"
        !          8834: #include "term.h"
        !          8835: #include "us.h"
        !          8836: #include "util.h"
        !          8837: #include "weapon.h"
        !          8838: #include "INTERN.h"
        !          8839: #include "them.h"
        !          8840: 
        !          8841: void
        !          8842: them_init()
        !          8843: {
        !          8844:     ;
        !          8845: }
        !          8846: 
        !          8847: void
        !          8848: their_smarts()
        !          8849: {
        !          8850:     Reg1 OBJECT *curkl;
        !          8851:     Reg2 OBJECT *obj;
        !          8852:     Reg3 int prob;
        !          8853:     Reg4 int count;
        !          8854:     Reg5 int y;
        !          8855:     Reg6 int x;
        !          8856: 
        !          8857:     if (numcrushes && (obj=movers)->type == Crusher) {
        !          8858:        if (numamoebas) {
        !          8859:            y = obj->posy;
        !          8860:            x = (obj->posx+(obj->image=='<'?1:-1)+XSIZE00)%XSIZE;
        !          8861:            if (amb[y][x] == '~') {
        !          8862:                obj->velx = 0;          /* stop and munch amoeba */
        !          8863:                modify_amoeba(y,x,1,' ',(int)rand_mod(5+ambsize/10)+1);
        !          8864:                if (occupant[y][x] == nuke)     /* except go for nucleus */
        !          8865:                    obj->velx = (obj->image=='<' ? 1 : -1);
        !          8866:            }
        !          8867:            else if (!obj->velx) {
        !          8868:                if (!rand_mod(4))
        !          8869:                    obj->image = rand_mod(2) ? '<' : '>';
        !          8870:                obj->velx = obj->image == '<' ? 1 : -1;
        !          8871:            }
        !          8872:        }
        !          8873:        obj->vely += (rand_mod(222) - 111) / 100;
        !          8874:        if (!(rand_mod(100))) {
        !          8875:            setimage(obj, (obj->velx *= -1) < 0 ? '>' : '<');
        !          8876:        }
        !          8877:     }
        !          8878:     if (numamoebas) {
        !          8879:        if (!rand_mod(3))
        !          8880:            nuke->velx = nuke->vely = 0;
        !          8881:        if (nuke->strategy && ambsize < 90 && !rand_mod(200-smarts))
        !          8882:            modify_amoeba(0,0,0,'~',(int)rand_mod(10));
        !          8883:        if (ambsize > 200 || (ambsize > 100 && !rand_mod(15)))
        !          8884:            modify_amoeba(yamblast,xamblast,2,' ',(ambsize-100)/5);
        !          8885:     }
        !          8886:     for (curkl = enemies; curkl->type == Enemy; curkl = curkl->next) {
        !          8887:        if ((curkl->flags & (CLOAKS|FRIENDLY)) == CLOAKS &&
        !          8888:            (curkl->image != ' ') &&
        !          8889:            (curkl->energy > 300 || massacre) ) {
        !          8890:            setimage(curkl, ' ');
        !          8891:        }
        !          8892:        if (madgorns)
        !          8893:            prob = 3;
        !          8894:        else if (curkl->vely || curkl->velx)
        !          8895:            prob = massacre?10:20;
        !          8896:        else if ((curkl->flags & (PIRATE|FRIENDLY)) == PIRATE) {
        !          8897:                                /* pirates want to sit sometimes */
        !          8898:            if (curkl->strategy) {
        !          8899:                if ((obj = lookimg(curkl->posy, curkl->posx, '@')) ||
        !          8900:                    (obj = lookimg(curkl->posy, curkl->posx, 'B')) ) {
        !          8901:                    make_plink(obj->posy, obj->posx);
        !          8902:                    if (!--curkl->strategy) {   /* clock ran down */
        !          8903:                        if (obj->image == '@') {
        !          8904:                            obj->image = '*';
        !          8905:                            numinhab--;
        !          8906:                            if (obj->flags & STATIC)
        !          8907:                                mvaddch(obj->posy+1,obj->posx*2,obj->image);
        !          8908:                            if (curkl->energy < 20000)
        !          8909:                                curkl->energy += 5000;
        !          8910:                        }
        !          8911:                        prob = 2;       /* our work here is done */
        !          8912:                    }
        !          8913:                    else if (obj->image == 'B') {
        !          8914:                        btorp -= rand_mod(50);
        !          8915:                        if (btorp < 0)
        !          8916:                            btorp = 0;
        !          8917:                        obj->energy -= rand_mod(500);
        !          8918:                        if (obj->energy < 0)
        !          8919:                            obj->energy = 0;
        !          8920:                        prob = 10000;           /* stay here */
        !          8921:                    }
        !          8922:                    else
        !          8923:                        prob = 10000;
        !          8924:                }
        !          8925:                else {          /* it went away--go elsewhere */
        !          8926:                    prob = 4;
        !          8927:                    curkl->strategy = 0;
        !          8928:                }
        !          8929:            }
        !          8930:            else if (lookimg(curkl->posy, curkl->posx, '@') ||
        !          8931:                     lookimg(curkl->posy, curkl->posx, 'B')) {
        !          8932:                curkl->strategy = rand_mod(15)+5;
        !          8933:                prob = 10000;
        !          8934:            }
        !          8935:            else
        !          8936:                prob = 4;
        !          8937:        }
        !          8938:        else if (curkl->image == 'M') { /* Mudd wants to sit sometimes */
        !          8939:            if ((obj = lookimg(curkl->posy, curkl->posx, 'E')) ||
        !          8940:                (obj = lookimg(curkl->posy, curkl->posx, 'B')) ) {
        !          8941:                if (obj->image == 'B') {
        !          8942:                    btorp -= rand_mod(40);
        !          8943:                    if (btorp < 0)
        !          8944:                        btorp = 0;
        !          8945:                    obj->energy -= rand_mod(100);
        !          8946:                    if (obj->energy < 0)
        !          8947:                        obj->energy = 0;
        !          8948:                }
        !          8949:                else if (!obj->vely && !obj->velx) {
        !          8950:                    etorp -= rand_mod(10);
        !          8951:                    if (etorp < 0)
        !          8952:                        etorp = 0;
        !          8953:                    obj->energy -= rand_mod(20);
        !          8954:                    if (obj->energy < 0)
        !          8955:                        obj->energy = 0;
        !          8956:                }
        !          8957:                prob = 10000;           /* stay here */
        !          8958:            }
        !          8959:            else                /* it went away--go elsewhere */
        !          8960:                prob = 4;
        !          8961:        }
        !          8962:        else if (curkl->flags & FRIENDLY) {
        !          8963:            if (curkl->energy < 10000 &&
        !          8964:              lookimg(curkl->posy, curkl->posx, '@') ) {
        !          8965:                curkl->energy += 100;
        !          8966:                prob = 20;      /* do some loading */
        !          8967:            }
        !          8968:            else
        !          8969:                prob = 4;
        !          8970:        }
        !          8971:        else if (curkl->image == '&') {
        !          8972:            if (curkl->flags & COUNTDOWN) {
        !          8973:                if (curkl->strategy)
        !          8974:                    curkl->strategy--;
        !          8975:                else
        !          8976:                    curkl->flags &= ~COUNTDOWN;
        !          8977:                prob = 100;     /* someone's feeding us, so sit still */
        !          8978:            }
        !          8979:            else
        !          8980:                prob = 4;
        !          8981:        }
        !          8982:        else
        !          8983:            prob = 4;                   /* don't sit still too long */
        !          8984:        count = 11;
        !          8985:        for (;;) {
        !          8986:            if (--count <= 0)           /* no opening, just ram something */
        !          8987:                break;
        !          8988: 
        !          8989: #ifdef lint
        !          8990:            prob = prob;
        !          8991: #endif
        !          8992:            if (!(rand_mod(prob)))      /* turn randomly occasionally */
        !          8993:                goto accell;
        !          8994: 
        !          8995:            y=(curkl->posy+curkl->vely+YSIZE00)%YSIZE;  /* find prospective */
        !          8996:            x=(curkl->posx+curkl->velx+XSIZE00)%XSIZE;  /*   new position */
        !          8997: 
        !          8998:            if (numamoebas) {
        !          8999:                if (curkl == nuke) {
        !          9000:                    if (amb[y][x] != '~')
        !          9001:                        goto accell;    /* never move nucleus from protoplasm */
        !          9002:                }
        !          9003:                else {
        !          9004:                    if (amb[y][x] == '~' && rand_mod(2)) {
        !          9005:                        yamblast = y;
        !          9006:                        xamblast = x;
        !          9007:                        goto accell;
        !          9008:                    }
        !          9009:                }
        !          9010:            }
        !          9011: 
        !          9012:            obj = occupant[y][x];
        !          9013:            if (!obj) break;            /* is anyone there? */
        !          9014: 
        !          9015:            switch (obj->type) {
        !          9016:            case Star:
        !          9017:                if (obj->image == '@' && (curkl->flags & PIRATE)) {
        !          9018:                    if (curkl->image != 'P' && curkl->image != ' ') {
        !          9019:                        if (curkl->flags & FRIENDLY) {
        !          9020:                            curkl->flags &= ~FRIENDLY;
        !          9021:                            curkl->energy += 1000;
        !          9022:                            possiblescore += curkl->mass;
        !          9023:                            inumfriends--;
        !          9024:                            numfriends--;
        !          9025:                            inumenemies++;
        !          9026:                            numenemies++;
        !          9027:                        }
        !          9028:                        curkl->image = 'P';
        !          9029:                    }
        !          9030:                    break;              /* go ahead and ram the star */
        !          9031:                }
        !          9032:                goto accell;            /* try not to ram stars */
        !          9033:            case Torp:
        !          9034:                if (!obj->vely && !obj->velx && (rand_mod(100) <= smarts) &&
        !          9035:                  (obj->image == 'o' || obj->image == 'O' || obj->image == 'X'))
        !          9036:                    goto accell;        /* try not to ram "friendly" torps */
        !          9037:                break;
        !          9038:            case Web:
        !          9039:                if (curkl->image != 'T')
        !          9040:                    goto accell;        /* non-Tholians shouldn't ram web */
        !          9041:                if (count <= 5)
        !          9042:                    break;              /* Tholians retrace web if desperate */
        !          9043:                if (obj->image ==
        !          9044:                    (curkl->vely?
        !          9045:                     (curkl->velx?
        !          9046:                      (curkl->velx==curkl->vely?
        !          9047:                       '\\'
        !          9048:                      :
        !          9049:                       '/'
        !          9050:                      )
        !          9051:                     :
        !          9052:                      '|'
        !          9053:                     )
        !          9054:                    :
        !          9055:                     '-'
        !          9056:                    )
        !          9057:                   ) goto accell;       /* Tholians try not to retrace web */
        !          9058:                break;                  /* No problem with crossing web */
        !          9059:            }
        !          9060:            break;                      /* okay to move over object */
        !          9061: 
        !          9062:        accell:
        !          9063:            /* determine maximum velocity */
        !          9064:            if (massacre && curkl->image != 'T') {
        !          9065:                curkl->vely = rand_mod(7) - 3;
        !          9066:                curkl->velx = rand_mod(7) - 3;
        !          9067:            }
        !          9068:            else if (curkl->image == '&') {
        !          9069:                if (rand_mod(2)) {
        !          9070:                    curkl->vely = rand_mod(3) - 1;
        !          9071:                    curkl->velx = rand_mod(3) - 1;
        !          9072:                }
        !          9073:                else {
        !          9074:                    curkl->vely = curkl->strategy & 3;
        !          9075:                    if (curkl->vely & 2)
        !          9076:                        curkl->vely = -1;
        !          9077:                    curkl->velx = (curkl->strategy >> 2) & 3;
        !          9078:                    if (curkl->velx & 2)
        !          9079:                        curkl->velx = -1;
        !          9080:                }
        !          9081:            }
        !          9082:            else if (curkl->energy >= 2500 && curkl->image != 'T') {
        !          9083:                curkl->vely = rand_mod(5) - 2;
        !          9084:                curkl->velx = rand_mod(5) - 2;
        !          9085:            }
        !          9086:            else {
        !          9087:                curkl->vely = rand_mod(3) - 1;
        !          9088:                curkl->velx = rand_mod(3) - 1;
        !          9089:            }
        !          9090:        }
        !          9091:        if (count != 10) {
        !          9092:            if (curkl->image == ' ') {
        !          9093:                setimage(curkl, curkl->flags & PIRATE ? 'P' : 'R');
        !          9094:            }
        !          9095:            if (!count) {
        !          9096:                curkl->vely = 0;
        !          9097:                curkl->velx = 0;
        !          9098:            }
        !          9099:        }
        !          9100:        if (curkl->image == 'G' && (base||ent) &&
        !          9101:            !rand_mod((103-smarts)*10) ) {
        !          9102:            int xxx,yyy;
        !          9103: 
        !          9104:            for (xxx = -1; xxx<=1; xxx++)
        !          9105:                for (yyy = -1; yyy<=1; yyy++)
        !          9106:                    if ((xxx||yyy) && rand_mod(2))
        !          9107:                        fire_torp(curkl,yyy,xxx);
        !          9108:        }
        !          9109:        else if (curkl->image == 'T' && (curkl->velx || curkl->vely)) {
        !          9110:            Make_object(Web,
        !          9111:             curkl->vely?
        !          9112:             (curkl->velx?
        !          9113:              (curkl->velx==curkl->vely?
        !          9114:               '\\'
        !          9115:              :
        !          9116:               '/'
        !          9117:              )
        !          9118:             :
        !          9119:              '|'
        !          9120:             )
        !          9121:            :
        !          9122:             '-',
        !          9123:            curkl->posy,curkl->posx,0,0,32767L,32767L,&root);
        !          9124:            if (obj && obj->type == Web) {
        !          9125:                unmake_object(obj);
        !          9126:                occupant[y][x] = Null(OBJECT*);
        !          9127:            }
        !          9128:        }
        !          9129:     }
        !          9130:     /* klingon-style fighting */
        !          9131:     if (numamoebas)
        !          9132:        attack(nuke);
        !          9133:     attack(base);
        !          9134:     if (ent && (!cloaked || ent->image=='E' || ent->image=='e'))
        !          9135:        attack(ent);
        !          9136: }
        !          9137: 
        !          9138: void
        !          9139: modify_amoeba(y,x,where,ch,quant)
        !          9140: Reg1 int y;
        !          9141: Reg2 int x;
        !          9142: int where;
        !          9143: Reg6 int ch;
        !          9144: Reg7 int quant;
        !          9145: {
        !          9146:     Reg3 int dy;
        !          9147:     Reg4 int dx;
        !          9148:     Reg5 int count = 15;
        !          9149: 
        !          9150:     if (!numamoebas)
        !          9151:        return;
        !          9152:     if (!where || (where==1 && rand_mod(2))) {
        !          9153:        y = nuke->posy;
        !          9154:        x = nuke->posx;
        !          9155:     }
        !          9156:     if (nuke->strategy && rand_mod(3)) {
        !          9157:        dy = nuke->strategy & 3;
        !          9158:        if (dy & 2)
        !          9159:            dy = -1;
        !          9160:        dx = (nuke->strategy >> 2) & 3;
        !          9161:        if (dx & 2)
        !          9162:            dx = -1;
        !          9163:        if (ch == ' ') {                /* take from the tail */
        !          9164:            dy = -dy;
        !          9165:            dx = -dx;
        !          9166:        }
        !          9167:        if (!rand_mod(100))
        !          9168:            nuke->strategy = rand_mod(256);
        !          9169:     }
        !          9170:     else {
        !          9171:        dy = rand_mod(3) - 1;
        !          9172:        dx = rand_mod(3) - 1;
        !          9173:     }
        !          9174:     if (!dy && !dx)
        !          9175:        return;
        !          9176:     do {
        !          9177:        if (--count < 0)
        !          9178:            return;
        !          9179:        y = (y + dy + YSIZE00) % YSIZE;
        !          9180:        x = (x + dx + XSIZE00) % XSIZE;
        !          9181:     } while (amb[y][x] != ' ');
        !          9182:     if (ch == ' ') {
        !          9183:        y = (y - dy + YSIZE00) % YSIZE;
        !          9184:        x = (x - dx + XSIZE00) % XSIZE;
        !          9185:     }
        !          9186:     if (ambsize > 100 && quant > 2) {
        !          9187:        quant >>= (ambsize/100);
        !          9188:     }
        !          9189:     if ((nuke->energy += quant << 6) > 32767)
        !          9190:        nuke->energy = 32767;
        !          9191:     count = quant << 3;                /* endless loop catcher */
        !          9192:     while (count-- > 0 && quant > 0) {
        !          9193:        if (amb[y][x] != ch) {
        !          9194:            quant--;
        !          9195:            amb[y][x] = ch;
        !          9196:            if (ch == '~') {
        !          9197:                ambsize++;
        !          9198:                yblasted[y] |= 2;
        !          9199:                xblasted[x] |= 2;
        !          9200:                blasted = TRUE;
        !          9201:            }
        !          9202:            else
        !          9203:                ambsize--;
        !          9204:            if (!occupant[y][x])
        !          9205:                mvaddch(y+1,x*2,ch);
        !          9206:        }
        !          9207:        y = (y + rand_mod(3) + YSIZE99) % YSIZE;
        !          9208:        x = (x + rand_mod(3) + XSIZE99) % XSIZE;
        !          9209:     }
        !          9210: }
        !          9211:  >>= (ambsize/100);
        !          9212:     }
        !          9213:     if ((nuke->energy += quant << 6) > 32767)
        !          9214:        nuke->energy = 32767;
        !          9215:     count = quant << 3;                /* endless loop catcher */
        !          9216:     while (count-- > 0 && quant > 0) {
        !          9217:        if (amb[y][x] != ch) {
        !          9218:            quant--;
        !          9219:            amb[y][x] = ch;
        !          9220:            if (ch == '~') {
        !          9221:                ambsize++;
        !          9222:                yblasted[y] |= 2;
        !          9223:                xblasted[x] |= 2;
        !          9224:                blasted = TRUE;
        !          9225:            }
        !          9226:            else
        !          9227:                ambsize--;
        !          9228:            if (!occupant[y][x])
        !          9229:                mvaddch(y+1,x*2,ch);
        !          9230:        }
        !          9231:        y = (y + rand_mod(3) + YSIZE99) % YSIZE;
        !          9232:        x = (x +warp/config.h.SH   644    171      5       21316  5121750133   7003 case $CONFIG in
        !          9233: '')
        !          9234:     if test ! -f config.sh; then
        !          9235:        ln ../config.sh . || \
        !          9236:        ln ../../config.sh . || \
        !          9237:        ln ../../../config.sh . || \
        !          9238:        (echo "Can't find config.sh."; exit 1)
        !          9239:        echo "Using config.sh from above..."
        !          9240:     fi
        !          9241:     . config.sh
        !          9242:     ;;
        !          9243: esac
        !          9244: echo "Extracting config.h (with variable substitutions)"
        !          9245: cat <<!GROK!THIS! >config.h
        !          9246: /* config.h
        !          9247:  * This file was produced by running the config.h.SH script, which
        !          9248:  * gets its values from config.sh, which is generally produced by
        !          9249:  * running Configure.
        !          9250:  *
        !          9251:  * Feel free to modify any of this as the need arises.  Note, however,
        !          9252:  * that running config.h.SH again will wipe out any changes you've made.
        !          9253:  * For a more permanent change edit config.sh and rerun config.h.SH.
        !          9254:  */
        !          9255: 
        !          9256: 
        !          9257: /* EUNICE:
        !          9258:  *     This symbol, if defined, indicates that the program is being compiled
        !          9259:  *     under the EUNICE package under VMS.  The program will need to handle
        !          9260:  *     things like files that don't go away the first time you unlink them,
        !          9261:  *     due to version numbering.  It will also need to compensate for lack
        !          9262:  *     of a respectable link() command.
        !          9263:  */
        !          9264: /* VMX:
        !          9265:  *     This symbol, if defined, indicates that the program is running under
        !          9266:  *     VMS.  It is currently only set in conjunction with the EUNICE symbol.
        !          9267:  */
        !          9268: #$d_eunice     EUNICE          /**/
        !          9269: #$d_eunice     VMS             /**/
        !          9270: 
        !          9271: /* CHARSPRINTF:
        !          9272:  *     This symbol is defined if this system declares "char *sprintf()" in
        !          9273:  *     stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
        !          9274:  *     is up to the package author to declare sprintf correctly based on the
        !          9275:  *     symbol.
        !          9276:  */
        !          9277: #$d_charsprf   CHARSPRINTF     /**/
        !          9278: 
        !          9279: /* FCNTL:
        !          9280:  *     This symbol, if defined, indicates to the C program that it should
        !          9281:  *     include fcntl.h.
        !          9282:  */
        !          9283: #$d_fcntl      FCNTL           /**/
        !          9284: 
        !          9285: /* FTIMER:
        !          9286:  *     This symbol, if defined, indicates that the ftime() routine exists.
        !          9287:  */
        !          9288: #$d_ftime      FTIMER          /**/
        !          9289: 
        !          9290: /* GETHOSTNAME:
        !          9291:  *     This symbol, if defined, indicates that the C program may use the
        !          9292:  *     gethostname() routine to derive the host name.  See also DOUNAME
        !          9293:  *     and PHOSTNAME.
        !          9294:  */
        !          9295: /* DOUNAME:
        !          9296:  *     This symbol, if defined, indicates that the C program may use the
        !          9297:  *     uname() routine to derive the host name.  See also GETHOSTNAME and
        !          9298:  *     PHOSTNAME.
        !          9299:  */
        !          9300: /* PHOSTNAME:
        !          9301:  *     This symbol, if defined, indicates that the C program may use the
        !          9302:  *     contents of PHOSTNAME as a command to feed to the popen() routine
        !          9303:  *     to derive the host name.  See also GETHOSTNAME and DOUNAME.
        !          9304:  */
        !          9305: #$d_gethname   GETHOSTNAME     /**/
        !          9306: #$d_douname    DOUNAME         /**/
        !          9307: #$d_phostname  PHOSTNAME "$phostname"  /**/
        !          9308: 
        !          9309: /* GETPWENT:
        !          9310:  *     This symbol, if defined, indicates that the getpwent() routine
        !          9311:  *     should be used instead of the getpw() routine.
        !          9312:  */
        !          9313: #$d_getpwent   GETPWENT        /**/
        !          9314: 
        !          9315: /* HAVETERMLIB:
        !          9316:  *     This symbol, when defined, indicates that termlib-style routines
        !          9317:  *     are available.  There is nothing to include.
        !          9318:  */
        !          9319: #$d_havetlib   HAVETERMLIB     /**/
        !          9320: 
        !          9321: /* index:
        !          9322:  *     This preprocessor symbol is defined, along with rindex, if the system
        !          9323:  *     uses the strchr and strrchr routines instead.
        !          9324:  */
        !          9325: /* rindex:
        !          9326:  *     This preprocessor symbol is defined, along with index, if the system
        !          9327:  *     uses the strchr and strrchr routines instead.
        !          9328:  */
        !          9329: #$d_index      index strchr    /* cultural */
        !          9330: #$d_index      rindex strrchr  /*  differences? */
        !          9331: 
        !          9332: /* IOCTL:
        !          9333:  *     This symbol, if defined, indicates that sys/ioctl.h exists and should
        !          9334:  *     be included.
        !          9335:  */
        !          9336: #$d_ioctl      IOCTL           /**/
        !          9337: 
        !          9338: /* NORMSIG:
        !          9339:  *     This symbol, if defined, indicates that normal signal handling routines
        !          9340:  *     should be used, as opposed to the ones in 4.1bsd (sigset, etc.).
        !          9341:  */
        !          9342: #$d_normsig    NORMSIG         /**/
        !          9343: 
        !          9344: /* PORTABLE:
        !          9345:  *     This symbol, if defined, indicates to the C program that it should
        !          9346:  *     not assume that it is running on the machine it was compiled on.
        !          9347:  *     The program should be prepared to look up the host name, translate
        !          9348:  *     generic filenames, use PATH, etc.
        !          9349:  */
        !          9350: #$d_portable   PORTABLE        /**/
        !          9351: 
        !          9352: /* RDCHK:
        !          9353:  *     This symbol, if defined, indicates that the rdchk routine is available
        !          9354:  *     to find out if there is input pending on an IO channel.  Generally
        !          9355:  *     the routine is used only if FIONREAD and O_NDELAY aren't available.
        !          9356:  */
        !          9357: #$d_rdchk      RDCHK           /**/
        !          9358: 
        !          9359: /* SCOREFULL:
        !          9360:  *     This symbol, if defined, indicates that any scoreboard kept by the
        !          9361:  *     program should be kept on the basis of the user's full name as opposed
        !          9362:  *     to the user's login name.  If the user can change his full name he
        !          9363:  *     can enter multiple scores if this is defined.
        !          9364:  */
        !          9365: #$d_scorfl     SCOREFULL       /**/
        !          9366: 
        !          9367: /* SIGNEDCHAR:
        !          9368:  *     This symbol, if defined, indicates that characters are a signed type.
        !          9369:  *     If not defined, things declared as signed characters (and that make
        !          9370:  *     use of negative values) should probably be declared as shorts instead.
        !          9371:  */
        !          9372: #$d_sgndchr    SIGNEDCHAR      /**/
        !          9373: 
        !          9374: /* TERMIO:
        !          9375:  *     This symbol, if defined, indicates that the program should include
        !          9376:  *     termio.h rather than sgtty.h.  There are also differences in the
        !          9377:  *     ioctl() calls that depend on the value of this symbol.
        !          9378:  */
        !          9379: #$d_termio     TERMIO          /**/
        !          9380: 
        !          9381: /* USENDIR:
        !          9382:  *     This symbol, if defined, indicates that the program should compile
        !          9383:  *     the ndir.c code provided with the package.
        !          9384:  */
        !          9385: /* LIBNDIR:
        !          9386:  *     This symbol, if defined, indicates that the program should include the
        !          9387:  *     system's version of ndir.h, rather than the one with this package.
        !          9388:  */
        !          9389: #$d_usendir    USENDIR         /**/
        !          9390: #$d_libndir    LIBNDIR         /**/
        !          9391: 
        !          9392: /* WHOAMI:
        !          9393:  *     This symbol, if defined, indicates that the program may include
        !          9394:  *     whoami.h.
        !          9395:  */
        !          9396: #$d_whoami     WHOAMI          /**/
        !          9397: 
        !          9398: /* HOSTNAME:
        !          9399:  *     This symbol contains name of the host the program is going to run on.
        !          9400:  *     The domain is not kept with hostname, but must be gotten from MYDOMAIN.
        !          9401:  *     The dot comes with MYDOMAIN, and need not be supplied by the program.
        !          9402:  *     If gethostname() or uname() exist, HOSTNAME may be ignored.
        !          9403:  */
        !          9404: /* MYDOMAIN:
        !          9405:  *     This symbol contains the domain of the host the program is going to
        !          9406:  *     run on.  The domain must be appended to HOSTNAME to form a complete
        !          9407:  *     host name.  The dot comes with MYDOMAIN, and need not be supplied by
        !          9408:  *     the program.  If the host name is derived from PHOSTNAME, the domain
        !          9409:  *     may or may not already be there, and the program should check.
        !          9410:  */
        !          9411: #define HOSTNAME "$hostname"           /**/
        !          9412: #define MYDOMAIN "$mydomain"           /**/
        !          9413: 
        !          9414: /* PASSNAMES:
        !          9415:  *     This symbol, if defined, indicates that full names are stored in
        !          9416:  *     the /etc/passwd file.
        !          9417:  */
        !          9418: /* BERKNAMES:
        !          9419:  *     This symbol, if defined, indicates that full names are stored in
        !          9420:  *     the /etc/passwd file in Berkeley format (name first thing, everything
        !          9421:  *     up to first comma, with & replaced by capitalized login id, yuck).
        !          9422:  */
        !          9423: /* USGNAMES:
        !          9424:  *     This symbol, if defined, indicates that full names are stored in
        !          9425:  *     the /etc/passwd file in USG format (everything after - and before ( is
        !          9426:  *     the name).
        !          9427:  */
        !          9428: #$d_passnames  PASSNAMES /*  (undef to take name from ~/.fullname) */
        !          9429: #$d_berknames  BERKNAMES /* (that is, ":name,stuff:") */
        !          9430: #$d_usgnames   USGNAMES  /* (that is, ":stuff-name(stuff):") */
        !          9431: 
        !          9432: /* PREFSHELL:
        !          9433:  *     This symbol contains the full name of the preferred user shell on this
        !          9434:  *     system.  Usual values are /bin/csh, /bin/ksh, /bin/sh.
        !          9435:  */
        !          9436: #define PREFSHELL "$prefshell"         /**/
        !          9437: 
        !          9438: /* RANDBITS:
        !          9439:  *     This symbol contains the number of bits of random number the rand()
        !          9440:  *     function produces.  Usual values are 15, 16, and 31.
        !          9441:  */
        !          9442: #define RANDBITS $randbits             /**/
        !          9443: 
        !          9444: /* Reg1:
        !          9445:  *     This symbol, along with Reg2, Reg3, etc. is either the word "register"
        !          9446:  *     or null, depending on whether the C compiler pays attention to this
        !          9447:  *     many register declarations.  The intent is that you don't have to
        !          9448:  *     order your register declarations in the order of importance, so you
        !          9449:  *     can freely declare register variables in sub-blocks of code and as
        !          9450:  *     function parameters.  Do not use Reg<n> more than once per routine.
        !          9451:  */
        !          9452: 
        !          9453: #define Reg1 $reg1             /**/
        !          9454: #define Reg2 $reg2             /**/
        !          9455: #define Reg3 $reg3             /**/
        !          9456: #define Reg4 $reg4             /**/
        !          9457: #define Reg5 $reg5             /**/
        !          9458: #define Reg6 $reg6             /**/
        !          9459: #define Reg7 $reg7             /**/
        !          9460: #define Reg8 $reg8             /**/
        !          9461: #define Reg9 $reg9             /**/
        !          9462: #define Reg10 $reg10           /**/
        !          9463: #define Reg11 $reg11           /**/
        !          9464: #define Reg12 $reg12           /**/
        !          9465: #define Reg13 $reg13           /**/
        !          9466: #define Reg14 $reg14           /**/
        !          9467: #define Reg15 $reg15           /**/
        !          9468: #define Reg16 $reg16           /**/
        !          9469: 
        !          9470: /* ROOTID:
        !          9471:  *     This symbol contains the uid of root, normally 0.
        !          9472:  */
        !          9473: #define ROOTID $rootid         /**/
        !          9474: 
        !          9475: /* VOIDFLAGS:
        !          9476:  *     This symbol indicates how much support of the void type is given by this
        !          9477:  *     compiler.  What various bits mean:
        !          9478:  *
        !          9479:  *         1 = supports declaration of void
        !          9480:  *         2 = supports arrays of pointers to functions returning void
        !          9481:  *         4 = supports comparisons between pointers to void functions and
        !          9482:  *                 addresses of void functions
        !          9483:  *
        !          9484:  *     The package designer should define VOIDUSED to indicate the requirements
        !          9485:  *     of the package.  This can be done either by #defining VOIDUSED before
        !          9486:  *     including config.h, or by defining defvoidused in Myinit.U.
        !          9487:  */
        !          9488: #ifndef VOIDUSED
        !          9489: #define VOIDUSED $defvoidused
        !          9490: #endif
        !          9491: #define VOIDFLAGS $voidflags
        !          9492: #if (VOIDFLAGS & VOIDUSED) != VOIDUSED
        !          9493: #$define void int              /* is void to be avoided? */
        !          9494: #$define M_VOID                /* Xenix strikes again */
        !          9495: #endif
        !          9496: 
        !          9497: /* $package private library, may use ~ expansion, %x and %l */
        !          9498: #define PRIVLIB "$privlib"             /**/
        !          9499: 
        !          9500: !GROK!THIS!
        !          9501: ine VOIDUSED to indicate the requirements
        !          9502:  *     of the package.  This can be done either by #defining VOIDUSED before
        !          9503:  *     including config.h, or by defining defvoidused in Myinit.U.
        !          9504:  */
        !          9505: #ifndef VOIDUSED
        !          9506: #define VOIDUSED $defvoidused
        !          9507: #endif
        !          9508: #define VOIDFLAGS $voidflags
        !          9509: #if (VOIDFLAGS & VOIDUSED) != VOIDUSED
        !          9510: #$warp/warp.man   644    171      5       10714  5121750136   6525 .TH WARP 6
        !          9511: .SH NAME
        !          9512: warp - a real-time space war game
        !          9513: .SH SYNOPSIS
        !          9514: .B warp [options]
        !          9515: .SH DESCRIPTION
        !          9516: .I Warp
        !          9517: is a real-time space war game that requires skill and quick thinking.
        !          9518: "Real-time" in this context means that the enemies keep moving (and shooting)
        !          9519: even if you don't.
        !          9520: A unique feature of
        !          9521: .I warp
        !          9522: is that blast propagates; it is unhealthy to remain near things that are
        !          9523: in the process of blowing up.
        !          9524: If a given universe is above a critical density it may chain react.
        !          9525: Scoring is like many popular arcade games--there are multiple waves which
        !          9526: get harder and harder as you go along.
        !          9527: Nobody has ever maxed out the scoreboard without cheating.
        !          9528: .PP
        !          9529: Unlike many space-war games,
        !          9530: .I warp
        !          9531: is not simply a shooting gallery.
        !          9532: Along with phasers and photon torpedoes, you have tractor beams and a cloaking
        !          9533: device.
        !          9534: Skill in navigation is important.
        !          9535: It helps to be schizophrenic, because you must manage an Enterprise and a Base
        !          9536: simultaneously.
        !          9537: And enemies do not simply shoot back.
        !          9538: You can get tailed, absorbed, snuck up upon, hemmed in, rammed, loved to death,
        !          9539: reprimanded for destroying civilized life, dragged around, robbed, damaged
        !          9540: and eaten.
        !          9541: And if you should happen to get bored by the enemies (a trifle unlikely),
        !          9542: you can always watch the interesting star patterns.
        !          9543: In fact, you'll have to, since your tactics will depend upon what kind of
        !          9544: universe you find yourself in.
        !          9545: .PP
        !          9546: .I Warp
        !          9547: is played in a double wraparound universe, i.e. the bottom is connected to the
        !          9548: top, and the right is connected to the left.
        !          9549: You need a crt with random cursor addressing and at least 24 lines by 80
        !          9550: columns.
        !          9551: For more information about about how to play, simply run
        !          9552: .I warp
        !          9553: and say "y" when it asks if you want to see the instructions.
        !          9554: There is also a single-page command summary that you can get while playing
        !          9555: by typing a "?".
        !          9556: .PP
        !          9557: Command line options include:
        !          9558: .TP 5
        !          9559: .B -b
        !          9560: Put
        !          9561: .I warp
        !          9562: into beginner mode.
        !          9563: Makes the difficulty increase more slowly, but penalizes you for it.
        !          9564: .TP 5
        !          9565: .B -d<n>
        !          9566: Sets the initial difficulty to
        !          9567: .BR n .
        !          9568: .TP 5
        !          9569: .B -l
        !          9570: Play a low-speed game.
        !          9571: Changes the basic cycle time from 1 second to 2 seconds.
        !          9572: This switch is automatically set at baud rates below 2400.
        !          9573: You may want to set it at higher speeds if your terminal cannot keep up
        !          9574: with the output.
        !          9575: (This should never happen on BSD systems, which have an IOCTL call to
        !          9576: determine output queue length.)
        !          9577: Because this makes the game easier, a separate scoreboard is kept for
        !          9578: low-speed games.
        !          9579: .TP 5
        !          9580: .B -m
        !          9581: Terminal has a meta key which turns on the eighth bit.  Ordinarily the
        !          9582: eighth bit is stripped in order to ignore parity.
        !          9583: Metacharacters will appear to the keymap as prefixed with a ^A, and will
        !          9584: subsequently have the same effect as a control character, unless otherwise
        !          9585: mapped.
        !          9586: .TP 5
        !          9587: .B -s
        !          9588: Just prints out the scoreboards and saved games and then exits.
        !          9589: .TP 5
        !          9590: .B -v
        !          9591: Prints out the version number.
        !          9592: .TP 5
        !          9593: .B -x
        !          9594: Play an experimental game.
        !          9595: This causes
        !          9596: .I warp
        !          9597: to ignore any saved game, and disables the ability to save
        !          9598: the current game.
        !          9599: Thus you can play around with something or show
        !          9600: .I warp
        !          9601: to someone without jeopardizing a currently saved game.
        !          9602: .SH ENVIRONMENT
        !          9603: .TP 5
        !          9604: .B WARPMACRO
        !          9605: If defined, names a file containing keyboard mappings and macros.
        !          9606: If not defined, the value %X/Kbmap.%{TERM} is assumed.
        !          9607: The macro file contains lines of the following form:
        !          9608: .sp
        !          9609: <keystroke-sequence> <whitespace> <canonical-keystroke-sequence>
        !          9610: .sp
        !          9611: You may use certain % interpolations and ^<letter> control characters.
        !          9612: For possible % interpolations see warp.h.
        !          9613: Sequences in the canonical-keystroke-sequence bounded by ^(...^) are
        !          9614: subject to reinterpretation via the keymap.
        !          9615: This file has two major uses.
        !          9616: First, you can set up your commands to use any kind of prefix key your terminal
        !          9617: might have, or change the key bindings in any other way you choose.
        !          9618: Second, you can define arbitrary macros, such as this:
        !          9619: .sp
        !          9620: # define Corbamite maneuver
        !          9621: =      DDllllll
        !          9622: .SH AUTHOR
        !          9623: Larry Wall <[email protected]>
        !          9624: .SH FILES
        !          9625: ~/.fullname, if full names aren't in /etc/passwd
        !          9626: .SH DIAGNOSTICS
        !          9627: Generally self-documenting, as they say.
        !          9628: .SH BUGS
        !          9629: Addicting.
        !          9630: At the end of a wave, all you have to do to keep going is hit a space.
        !          9631: You see the message "Hit space to continue" and automatically hit space.
        !          9632: About 2 seconds later you remember you wanted to go home, but by then
        !          9633: it's too late to escape without penalty.
        !          9634: .PP
        !          9635: You can't kill a backgrounded
        !          9636: .I warp
        !          9637: process directly, because it is running setuid.
        !          9638: You have to use the killer built in to
        !          9639: .IR warp .
        !          9640: .PP
        !          9641: Now that there is a space amoeba, there ought to be tribbles.
        !          9642: But it might be too much trouble...
        !          9643: UGS
        !          9644: Addicting.
        !          9645: At the end of a wave, all you have towarp/MANIFEST   644    171      5        5715  5121750140   6170 After all the warp kits are run you should have the following files:
        !          9646: 
        !          9647: Filename               Kit Description
        !          9648: --------               --- -----------
        !          9649: Configure                1  An entertaining little shell script
        !          9650: EXTERN.h                 6  Set up for external .h files
        !          9651: INTERN.h                 6  Set up for internal .h files
        !          9652: MANIFEST                 1  This file
        !          9653: Makefile.SH              5  Makefile for warp
        !          9654: README                   5  Instructions--please read
        !          9655: bang.c                   5  Routines having to do with blast propagation
        !          9656: bang.h                   6  Visible declarations for above
        !          9657: config.H                 4  Sample config.h for if you can't Configure
        !          9658: init.c                   3  Initialization for a wave.
        !          9659: init.h                   2  Visible declarations for above
        !          9660: intrp.c                  4  Code to interpret % substitutions
        !          9661: intrp.h                  6  Visible declarations for above
        !          9662: makedepend.SH            6  Generates makefile dependencies
        !          9663: makedir.SH               6  Makes multilevel directories
        !          9664: move.c                   3  Object movement and display
        !          9665: move.h                   6  Visible declarations for above
        !          9666: ndir.c                   5  Directory manipulation routines
        !          9667: ndir.h                   5  Visible declarations for above
        !          9668: object.c                 6  Object management
        !          9669: object.h                 6  Visible declarations for above
        !          9670: patchlevel.h             4  How patched the kit is
        !          9671: play.c                   5  What to do each second
        !          9672: play.h                   6  Visible declarations for above
        !          9673: score.c                  2  Scoring and saving
        !          9674: score.h                  6  Visible declarations for above
        !          9675: sig.c                    5  Signal handling
        !          9676: sig.h                    6  Visible declarations for above
        !          9677: sm.c                     6  Starmap translator
        !          9678: smp.0                    3  "Straight Grid" scenario
        !          9679: smp.1                    6  "Offset Grid" scenario
        !          9680: smp.2                    6  "Shooting Gallery" scenario
        !          9681: smp.3                    6  "Superfortress" scenario
        !          9682: smp.4                    6  "Blocks" scenario
        !          9683: smp.5                    6  "Microfortress" scenario
        !          9684: smp.6                    6  "Passage" scenario
        !          9685: smp.7                    6  "Wall" scenario
        !          9686: term.c                   2  Terminal handling
        !          9687: term.h                   5  Visible declarations for above
        !          9688: them.c                   5  Smarts for enemies
        !          9689: them.h                   6  Visible declarations for above
        !          9690: us.c                     4  Smarts for us
        !          9691: us.h                     6  Visible declarations for above
        !          9692: util.c                   1  Utility routines
        !          9693: util.h                   5  Visible declarations for above
        !          9694: version.c                6  Prints version number.
        !          9695: version.h                1  Visible declarations for above
        !          9696: warp.c                   2  Main loop
        !          9697: warp.doc                 4  How to play warp
        !          9698: warp.h                   4  Visible declarations for everyone
        !          9699: warp.man                 5  How to start warp
        !          9700: warp.news                5  Sample startup message
        !          9701: weapon.c                 3  Our firepower
        !          9702: weapon.h                 6  Visible declarations for above
        !          9703: util.h                   5  Visible declarations fowarp/Makefile.SH   644    171      5       10214  5121750147   7025 case $CONFIG in
        !          9704: '')
        !          9705:     if test ! -f config.sh; then
        !          9706:        ln ../config.sh . || \
        !          9707:        ln ../../config.sh . || \
        !          9708:        ln ../../../config.sh . || \
        !          9709:        (echo "Can't find config.sh."; exit 1)
        !          9710:     fi
        !          9711:     . config.sh
        !          9712:     ;;
        !          9713: esac
        !          9714: echo "Extracting Makefile (with variable substitutions)"
        !          9715: : This section of the file will have variable substitutions done on it.
        !          9716: : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
        !          9717: : Protect any dollar signs and backticks that you do not want interpreted
        !          9718: : by putting a backslash in front.
        !          9719: $spitshell >Makefile <<!GROK!THIS!
        !          9720: # $Header: Makefile.SH,v 7.0.1.1 86/12/12 16:54:03 lwall Exp $
        !          9721: #
        !          9722: # $Log:        Makefile.SH,v $
        !          9723: # Revision 7.0.1.1  86/12/12  16:54:03  lwall
        !          9724: # Frozen for net release.
        !          9725: # 
        !          9726: # Revision 7.0  86/10/08  15:11:42  lwall
        !          9727: # Split into separate files.  Added amoebas and pirates.
        !          9728: # 
        !          9729: #
        !          9730: CC = $cc
        !          9731: bin = $bin
        !          9732: mansrc = $mansrc
        !          9733: manext = $manext
        !          9734: CFLAGS = $ccflags -O
        !          9735: LDFLAGS = $ldflags
        !          9736: CHOWNER = $chowner
        !          9737: privlib = $privlib
        !          9738: NDIRC = $ndirc
        !          9739: NDIRO = $ndiro
        !          9740: LARGE = $large $split
        !          9741: SMALL = $small
        !          9742: 
        !          9743: libs = $ndirlib $termlib $jobslib $libnm -lm
        !          9744: !GROK!THIS!
        !          9745: 
        !          9746: : In the following dollars and backticks do not need the extra backslash.
        !          9747: $spitshell >>Makefile <<'!NO!SUBS!'
        !          9748: 
        !          9749: public = warp
        !          9750: private = warp.doc smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
        !          9751: manpages = warp.man
        !          9752: util = Makefile makedepend makedir smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
        !          9753: 
        !          9754: sh = Makefile.SH makedepend.SH makedir.SH
        !          9755: 
        !          9756: h1 = bang.h init.h intrp.h move.h ndir.h
        !          9757: h2 = patchlevel.h object.h play.h score.h
        !          9758: h3 = sig.h term.h them.h us.h
        !          9759: h4 = util.h version.h warp.h weapon.h
        !          9760: 
        !          9761: h = $(h1) $(h2) $(h3) $(h4)
        !          9762: 
        !          9763: c1 = bang.c init.c intrp.c move.c
        !          9764: c2 = object.c play.c score.c
        !          9765: c3 = sig.c term.c them.c us.c
        !          9766: c4 = util.c version.c warp.c weapon.c
        !          9767: 
        !          9768: c = $(c1) $(c2) $(c3) $(c4) $(NDIRC)
        !          9769: 
        !          9770: obj1 = bang.o init.o intrp.o move.o
        !          9771: obj2 = object.o play.o score.o
        !          9772: obj3 = sig.o term.o them.o us.o
        !          9773: obj4 = util.o version.o warp.o weapon.o
        !          9774: 
        !          9775: obj = $(obj1) $(obj2) $(obj3) $(obj4) $(NDIRO)
        !          9776: 
        !          9777: lintflags = -phbvxac
        !          9778: 
        !          9779: add1 = Makefile.old 
        !          9780: add2 = bsd config.h config.sh eunice filexp
        !          9781: add3 = loc makedepend 
        !          9782: add4 = 
        !          9783: add5 = pdp11 warp usg v7
        !          9784: 
        !          9785: addedbyconf = $(add1) $(add2) $(add3) $(add4) $(add5)
        !          9786: 
        !          9787: # grrr
        !          9788: SHELL = /bin/sh
        !          9789: 
        !          9790: .c.o:
        !          9791:        $(CC) -c $(CFLAGS) $(LARGE) $*.c
        !          9792: 
        !          9793: all: $(public) $(private) $(util)
        !          9794:        touch all
        !          9795: 
        !          9796: warp: $(obj)
        !          9797:        $(CC) $(LDFLAGS) $(obj) $(LARGE) $(libs) -o warp
        !          9798: 
        !          9799: # if a .h file depends on another .h file...
        !          9800: $(h):
        !          9801:        touch $@
        !          9802: 
        !          9803: install: warp
        !          9804: # won't work with csh
        !          9805:        export PATH || exit 1
        !          9806:        - mv $(bin)/warp $(bin)/warp.old
        !          9807:        - if test `pwd` != $(bin); then cp $(public) $(bin); fi
        !          9808:        - cd $(bin); chmod 755 $(public); chown '$(CHOWNER)' $(public)
        !          9809:        - chmod 4711 $(bin)/warp
        !          9810:        - chmod 755 makedir
        !          9811:        - ./makedir `./filexp $(privlib)`
        !          9812:        - \
        !          9813: if test `pwd` != `./filexp $(privlib)`; then \
        !          9814: cp $(private) `./filexp $(privlib)`; \
        !          9815: fi
        !          9816:        - \
        !          9817: cd `./filexp $(privlib)`; \
        !          9818: chmod 755 $(private); \
        !          9819: chown '$(CHOWNER)' . $(private) \
        !          9820: cp /dev/null save.blurfl
        !          9821:        - \
        !          9822: if test ! -f `./filexp $(privlib)/warp.news`; then \
        !          9823: cp warp.news `./filexp $(privlib)`; \
        !          9824: fi
        !          9825:        - \
        !          9826: if test `pwd` != $(mansrc); then \
        !          9827: for page in $(manpages); do \
        !          9828: cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
        !          9829: done; \
        !          9830: fi
        !          9831: 
        !          9832: clean:
        !          9833:        rm -f core *.o
        !          9834: 
        !          9835: realclean:
        !          9836:        rm -f warp *.o core $(addedbyconf) $(util)
        !          9837: 
        !          9838: # The following lint has practically everything turned on.  Unfortunately,
        !          9839: # you have to wade through a lot of mumbo jumbo that can't be suppressed.
        !          9840: # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
        !          9841: # for that spot.
        !          9842: 
        !          9843: lint:
        !          9844:        lint $(lintflags) $(defs) $(c) > warp.fuzz
        !          9845: 
        !          9846: smap.0: smp.0 sm
        !          9847:        sm <smp.0 >smap.0
        !          9848: smap.1: smp.1 sm
        !          9849:        sm <smp.1 >smap.1
        !          9850: smap.2: smp.2 sm
        !          9851:        sm <smp.2 >smap.2
        !          9852: smap.3: smp.3 sm
        !          9853:        sm <smp.3 >smap.3
        !          9854: smap.4: smp.4 sm
        !          9855:        sm <smp.4 >smap.4
        !          9856: smap.5: smp.5 sm
        !          9857:        sm <smp.5 >smap.5
        !          9858: smap.6: smp.6 sm
        !          9859:        sm <smp.6 >smap.6
        !          9860: smap.7: smp.7 sm
        !          9861:        sm <smp.7 >smap.7
        !          9862: sm: sm.c
        !          9863:        cc sm.c $(SMALL) -o sm
        !          9864: 
        !          9865: depend: makedepend
        !          9866:        makedepend
        !          9867: 
        !          9868: clist:
        !          9869:        echo $(c) | tr ' ' '\012' >.clist
        !          9870: 
        !          9871: hlist:
        !          9872:        echo $(h) | tr ' ' '\012' >.hlist
        !          9873: 
        !          9874: shlist:
        !          9875:        echo $(sh) | tr ' ' '\012' >.shlist
        !          9876: 
        !          9877: # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
        !          9878: $(obj):
        !          9879:        @ echo "You haven't done a "'"make depend" yet!'; exit 1
        !          9880: makedepend: makedepend.SH
        !          9881:        /bin/sh makedepend.SH
        !          9882: !NO!SUBS!
        !          9883: $eunicefix Makefile
        !          9884: 5 sm
        !          9885:        sm <smp.5 >smap.5
        !          9886: smap.6: smp.6 sm
        !          9887:        sm <smp.6 >smap.6
        !          9888: smap.7: smp.7 sm
        !          9889:        sm <smp.7 >smap.7
        !          9890: sm: sm.c
        !          9891:        cc sm.c $(SMALL) -o sm
        !          9892: 
        !          9893: depend: makedepend
        !          9894:        makedepend
        !          9895: 
        !          9896: clist:
        !          9897:        echo $(c) | tr ' ' '\012' >.clist
        !          9898: 
        !          9899: hlist:
        !          9900:        echo $(h) | tr ' ' '\012' >.hlist
        !          9901: 
        !          9902: shlist:
        !          9903:        echo $(sh) | tr ' ' '\012' >.shlist
        !          9904: 
        !          9905: # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
        !          9906: $(objwarp/makedepend.SH   644    171      5       10175  5121750152   7407 case $CONFIG in
        !          9907: '')
        !          9908:     if test ! -f config.sh; then
        !          9909:        ln ../config.sh . || \
        !          9910:        ln ../../config.sh . || \
        !          9911:        ln ../../../config.sh . || \
        !          9912:        (echo "Can't find config.sh."; exit 1)
        !          9913:     fi
        !          9914:     . config.sh
        !          9915:     ;;
        !          9916: esac
        !          9917: case "$0" in
        !          9918: */*) cd `expr X$0 : 'X\(.*\)/'` ;;
        !          9919: esac
        !          9920: echo "Extracting makedepend (with variable substitutions)"
        !          9921: $spitshell >makedepend <<!GROK!THIS!
        !          9922: $startsh
        !          9923: # $Header: makedepend.SH,v 7.0.1.1 86/12/12 17:00:05 lwall Exp $
        !          9924: #
        !          9925: # $Log:        makedepend.SH,v $
        !          9926: # Revision 7.0.1.1  86/12/12  17:00:05  lwall
        !          9927: # Baseline for net release.
        !          9928: # 
        !          9929: # Revision 4.3.1.2  85/05/13  15:53:42  lwall
        !          9930: # Made cpp look in /usr/local/include too.
        !          9931: # 
        !          9932: # Revision 4.3.1.1  85/05/10  11:35:10  lwall
        !          9933: # Branch for patches.
        !          9934: # 
        !          9935: # Revision 4.3  85/05/01  11:42:26  lwall
        !          9936: # Baseline for release with 4.3bsd.
        !          9937: # 
        !          9938: 
        !          9939: export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
        !          9940: 
        !          9941: cat='$cat'
        !          9942: cp='$cp'
        !          9943: cpp='$cpp'
        !          9944: echo='$echo'
        !          9945: egrep='$egrep'
        !          9946: expr='$expr'
        !          9947: mv='$mv'
        !          9948: rm='$rm'
        !          9949: sed='$sed'
        !          9950: sort='$sort'
        !          9951: test='$test'
        !          9952: tr='$tr'
        !          9953: uniq='$uniq'
        !          9954: !GROK!THIS!
        !          9955: 
        !          9956: $spitshell >>makedepend <<'!NO!SUBS!'
        !          9957: 
        !          9958: $cat /dev/null >.deptmp
        !          9959: $echo "(Note: this is going to take a while.)"
        !          9960: $rm -f *.c.c c/*.c.c
        !          9961: if test -f Makefile; then
        !          9962:     mf=Makefile
        !          9963: else
        !          9964:     mf=makefile
        !          9965: fi
        !          9966: if test -f $mf; then
        !          9967:     defrule=`<$mf sed -n               \
        !          9968:        -e '/^\.c\.o:.*;/{'             \
        !          9969:        -e    's/\$\*\.c//'             \
        !          9970:        -e    's/^[^;]*;[        ]*//p' \
        !          9971:        -e    q                         \
        !          9972:        -e '}'                          \
        !          9973:        -e '/^\.c\.o: *$/{'             \
        !          9974:        -e    N                         \
        !          9975:        -e    's/\$\*\.c//'             \
        !          9976:        -e    's/^.*\n[  ]*//p'         \
        !          9977:        -e    q                         \
        !          9978:        -e '}'`
        !          9979: fi
        !          9980: case "$defrule" in
        !          9981: '') defrule='$(CC) -c $(CFLAGS)' ;;
        !          9982: esac
        !          9983: 
        !          9984: make clist || ($echo "Searching for .c files..."; \
        !          9985:        $echo *.c */*.c | $tr ' ' '\012' | $egrep -v '\*' >.clist)
        !          9986: for file in `$cat .clist`; do
        !          9987: # for file in `cat /dev/null`; do
        !          9988:     filebase=`basename $file .c`
        !          9989:     $echo "Finding dependencies for $filebase.o."
        !          9990:     $sed -n <$file >$file.c \
        !          9991:        -e "/^${filebase}_init(/q" \
        !          9992:        -e '/^#/{' \
        !          9993:        -e 's|/\*.*$||' \
        !          9994:        -e 's|\\$||' \
        !          9995:        -e p \
        !          9996:        -e '}'
        !          9997:     $cpp -I/usr/local/include -I. -I./h $file.c | \
        !          9998:     $sed \
        !          9999:        -e '/^# *[0-9]/!d' \
        !          10000:        -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
        !          10001:        -e 's|: \./|: |' \
        !          10002:        -e 's|\.c\.c|.c|' | \
        !          10003:     $uniq | $sort | $uniq >> .deptmp
        !          10004: done
        !          10005: 
        !          10006: $sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'
        !          10007: 
        !          10008: make shlist || ($echo "Searching for .SH files..."; \
        !          10009:        $echo *.SH */*.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
        !          10010: if $test -s .deptmp; then
        !          10011:     for file in `cat .shlist`; do
        !          10012:        $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
        !          10013:            /bin/sh $file >> .deptmp
        !          10014:     done
        !          10015:     $echo "Updating Makefile..."
        !          10016:     $echo "# If this runs make out of memory, delete /usr/include lines." \
        !          10017:        >> Makefile.new
        !          10018:     $sed 's|^\(.*\.o:\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
        !          10019:        >>Makefile.new
        !          10020: else
        !          10021:     make hlist || ($echo "Searching for .h files..."; \
        !          10022:        $echo *.h */*.h | $tr ' ' '\012' | $egrep -v '\*' >.hlist)
        !          10023:     $echo "You don't seem to have a proper C preprocessor.  Using grep instead."
        !          10024:     $egrep '^#include ' `cat .clist` `cat .hlist`  >.deptmp
        !          10025:     $echo "Updating Makefile..."
        !          10026:     <.clist $sed -n                                                    \
        !          10027:        -e '/\//{'                                                      \
        !          10028:        -e   's|^\(.*\)/\(.*\)\.c|\2.o: \1/\2.c; '"$defrule \1/\2.c|p"  \
        !          10029:        -e   d                                                          \
        !          10030:        -e '}'                                                          \
        !          10031:        -e 's|^\(.*\)\.c|\1.o: \1.c|p' >> Makefile.new
        !          10032:     <.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed
        !          10033:     <.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \
        !          10034:        $sed 's|^[^;]*/||' | \
        !          10035:        $sed -f .hsed >> Makefile.new
        !          10036:     <.deptmp $sed -n 's|c:#include <\(.*\)>.*$|o: /usr/include/\1|p' \
        !          10037:        >> Makefile.new
        !          10038:     <.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
        !          10039:        $sed -f .hsed >> Makefile.new
        !          10040:     <.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
        !          10041:        >> Makefile.new
        !          10042:     for file in `$cat .shlist`; do
        !          10043:        $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
        !          10044:            /bin/sh $file >> Makefile.new
        !          10045:     done
        !          10046: fi
        !          10047: $rm -f Makefile.old
        !          10048: $cp Makefile Makefile.old
        !          10049: $cp Makefile.new Makefile
        !          10050: $rm Makefile.new
        !          10051: $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
        !          10052: $rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed
        !          10053: 
        !          10054: !NO!SUBS!
        !          10055: $eunicefix makedepend
        !          10056: chmod 755 makedepend
        !          10057: case `pwd` in
        !          10058: *SH)
        !          10059:     $rm -f ../makedepend
        !          10060:     ln makedepend ../makedepend
        !          10061:     ;;
        !          10062: esac
        !          10063: e in `$cat .shlist`; do
        !          10064:        $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
        !          10065:            /bin/sh $file >> Makefile.new
        !          10066:     done
        !          10067: fi
        !          10068: $rm -f Makefile.old
        !          10069: $cp Makefile Makefile.old
        !          10070: $cp Makefile.new Makefile
        !          10071: $rm Makefile.new
        !          10072: $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
        !          10073: $rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed
        !          10074: 
        !          10075: !NO!SUBS!
        !          10076: $eunicwarp/play.c   644    171      5        7142  5121750154   6151 /* $Header: play.c,v 7.0.1.1 86/10/16 10:52:39 lwall Exp $ */
        !          10077: 
        !          10078: /* $Log:       play.c,v $
        !          10079:  * Revision 7.0.1.1  86/10/16  10:52:39  lwall
        !          10080:  * Added Damage.  Fixed random bugs.
        !          10081:  * 
        !          10082:  * Revision 7.0  86/10/08  15:13:09  lwall
        !          10083:  * Split into separate files.  Added amoebas and pirates.
        !          10084:  * 
        !          10085:  */
        !          10086: 
        !          10087: #include "EXTERN.h"
        !          10088: #include "warp.h"
        !          10089: #include "bang.h"
        !          10090: #include "score.h"
        !          10091: #include "object.h"
        !          10092: #include "move.h"
        !          10093: #include "term.h"
        !          10094: #include "them.h"
        !          10095: #include "us.h"
        !          10096: #include "util.h"
        !          10097: #include "weapon.h"
        !          10098: #include "INTERN.h"
        !          10099: #include "play.h"
        !          10100: 
        !          10101: void
        !          10102: play_init()
        !          10103: {
        !          10104:     ;
        !          10105: }
        !          10106: 
        !          10107: void
        !          10108: play()
        !          10109: {
        !          10110:     bool done = FALSE;
        !          10111:     Reg1 OBJECT *curobj;
        !          10112:     Reg2 OBJECT *to;
        !          10113:     Reg3 int i;
        !          10114:     Reg4 int x;
        !          10115:     Reg5 int y;
        !          10116: 
        !          10117:     display_status();
        !          10118: #ifdef TIOCOUTQ
        !          10119:     while (output_pending() > charsperhalfsec)
        !          10120:        sleep(1);                        /* allow buffers to empty */
        !          10121: #endif
        !          10122:     sleep(3);
        !          10123:     do {
        !          10124:        timer++;
        !          10125:        nxtbang = 0;
        !          10126:        banging = FALSE;
        !          10127:        display_status();
        !          10128: #ifdef TIOCOUTQ
        !          10129:        while (output_pending() > charsperhalfsec)
        !          10130:            sleep(1);
        !          10131: #endif
        !          10132:        if (lowspeed)
        !          10133:            roundsleep(2);
        !          10134:        else
        !          10135:            roundsleep(1);
        !          10136:        if (ent) {
        !          10137:            evely = ent->vely;
        !          10138:            evelx = ent->velx;
        !          10139:            if (cloaking && ent->energy >= 250 && !damflag[NOCLOAKING]) {
        !          10140:                if (!rand_mod(300)) {
        !          10141:                    damage++;
        !          10142:                    damflag[NOCLOAKING] = rand_mod(smarts+1)+2;
        !          10143:                }
        !          10144:                ent->energy -= ent->energy/40;
        !          10145:            }
        !          10146:            else
        !          10147:                cloaking = FALSE;
        !          10148:            cloaked = cloaking;
        !          10149:        }
        !          10150:        if (base) {
        !          10151:            bvely = base->vely;
        !          10152:            bvelx = base->velx;
        !          10153:        }
        !          10154:        get_commands(&done);
        !          10155:        if (done)
        !          10156:            break;
        !          10157:        their_smarts();
        !          10158:        apolloflag = 0;
        !          10159:        if (ent) {
        !          10160:            if (numapollos) {
        !          10161:                if (numstars) {
        !          10162:                    if (realapollo) {
        !          10163:                        if (lookfor(realapollo->posy,realapollo->posx,
        !          10164:                            Enterprise)) {
        !          10165:                            apolloflag = 1;
        !          10166:                        }
        !          10167:                    }
        !          10168:                    else if (lookfor(root.next->posy,root.next->posx,
        !          10169:                        Enterprise)) {
        !          10170:                        apolloflag = 1;
        !          10171:                        realapollo = root.next;
        !          10172:                        mvaddch(realapollo->posy+1,realapollo->posx*2,
        !          10173:                            'A');
        !          10174:                        realapollo->image = 'A';
        !          10175:                        realapollo->mass = 6000;
        !          10176:                        inumapollos = 1;
        !          10177:                        numenemies++;
        !          10178:                        inumenemies++;
        !          10179:                        possiblescore += 5000;
        !          10180:                    }
        !          10181:                    if (apolloflag) {
        !          10182:                        if (blast[realapollo->posy][realapollo->posx] <= 32000)
        !          10183:                            evely = evelx = 0;
        !          10184:                        realapollo->energy = 32000;
        !          10185:                    }
        !          10186:                }
        !          10187:                else
        !          10188:                    numapollos = 0;
        !          10189:            }
        !          10190:            ent->vely = evely;
        !          10191:            ent->velx = evelx;
        !          10192:        }
        !          10193:        if (base) {
        !          10194:            if (numapollos) {
        !          10195:                if (numstars) {
        !          10196:                    if (realapollo) {
        !          10197:                        if (lookfor(realapollo->posy,realapollo->posx,
        !          10198:                            Base)) {
        !          10199:                            apolloflag |= 2;
        !          10200:                        }
        !          10201:                    }
        !          10202:                    else if (lookfor(root.next->posy,root.next->posx,
        !          10203:                        Base)) {
        !          10204:                        apolloflag |= 2;
        !          10205:                        realapollo = root.next;
        !          10206:                        mvaddch(realapollo->posy+1,realapollo->posx*2,
        !          10207:                            'A');
        !          10208:                        realapollo->image = 'A';
        !          10209:                        realapollo->mass = 6000;
        !          10210:                        inumapollos = 1;
        !          10211:                        numenemies++;
        !          10212:                        inumenemies++;
        !          10213:                        possiblescore += 5000;
        !          10214:                    }
        !          10215:                    if (apolloflag & 2) {
        !          10216:                        if (blast[realapollo->posy][realapollo->posx] <= 32000)
        !          10217:                            bvely = bvelx = 0;
        !          10218:                        realapollo->energy = 32000;
        !          10219:                    }
        !          10220:                }
        !          10221:                else
        !          10222:                    numapollos = 0;
        !          10223:            }
        !          10224:            base->vely = bvely;
        !          10225:            base->velx = bvelx;
        !          10226:        }
        !          10227:        if (aretorps) {
        !          10228:            aretorps = 0;
        !          10229:            for (i=0;i<2;i++) for (y=0;y<3;y++) for (x=0;x<3;x++) {
        !          10230:                if (curobj = isatorp[i][y][x]) {
        !          10231:                    to = occupant[(curobj->posy+curobj->vely+YSIZE00)%YSIZE]
        !          10232:                                 [(curobj->posx+curobj->velx+XSIZE00)%XSIZE];
        !          10233:                    if (to && !to->vely && !to->velx) {
        !          10234:                        unmake_object(curobj);
        !          10235:                        if (i)
        !          10236:                            btorp++;
        !          10237:                        else
        !          10238:                            etorp++;
        !          10239:                    }
        !          10240:                    isatorp[i][y][x]=0;
        !          10241:                }
        !          10242:            }
        !          10243:        }
        !          10244:        move_universe();
        !          10245:        if (finish) {
        !          10246:            finish--;
        !          10247:            if (!finish && (!(numenemies || numos) || (!ent && !base))) {
        !          10248:                done = TRUE;
        !          10249:                timer -= 5;
        !          10250:            }
        !          10251:        }
        !          10252:        else if (!banging && (!(numenemies || numos) || (!ent && !base)))
        !          10253:            finish = 5;
        !          10254:     } while (!done);
        !          10255: }
        !          10256: >posy+curobj->vely+YSIZE00)%YSIZE]
        !          10257:                                 [(curobj->posx+curobj->velx+XSIZE00)%XSIZE];
        !          10258:                    if (to && !to->vely && !to->velx) {
        !          10259:                        unmake_object(curobj);
        !          10260:                        if (i)
        !          10261:                            btorp++;
        !          10262:                        else
        !          10263:                            etorp++;
        !          10264:                    }
        !          10265:                    isatorp[i][y][x]=0;
        !          10266:                }
        !          10267:            }
        !          10268:        }
        !          10269:        move_universe();
        !          10270:        if (finish) {
        !          10271:            finish--;
        !          10272:            if (!finish && (!(numenemies || numos) || (!ent && !base))) {
        !          10273:                done = TRUE;
        !          10274:                timer -= 5;
        !          10275:            }
        !          10276:        }
        !          10277:        else if warp/sig.c   644    171      5        7131  5121750157   5767 /* $Header: sig.c,v 7.0.1.1 86/12/12 17:02:44 lwall Exp $ */
        !          10278: 
        !          10279: /* $Log:       sig.c,v $
        !          10280:  * Revision 7.0.1.1  86/12/12  17:02:44  lwall
        !          10281:  * Baseline for net release.
        !          10282:  * 
        !          10283:  * Revision 7.0  86/10/08  15:13:24  lwall
        !          10284:  * Split into separate files.  Added amoebas and pirates.
        !          10285:  * 
        !          10286:  */
        !          10287: 
        !          10288: #include "EXTERN.h"
        !          10289: #include "warp.h"
        !          10290: #include "play.h"
        !          10291: #include "score.h"
        !          10292: #include "term.h"
        !          10293: #include "util.h"
        !          10294: #include "INTERN.h"
        !          10295: #include "sig.h"
        !          10296: 
        !          10297: void
        !          10298: sig_init()
        !          10299: {
        !          10300: #ifdef lint
        !          10301:     ;
        !          10302: #else
        !          10303:     sigignore(SIGINT);  /* for inquiry of existence via kill call */
        !          10304: #ifdef SIGTTOU
        !          10305:     sigignore(SIGTTOU);
        !          10306: #endif
        !          10307: 
        !          10308:     sigset(SIGHUP, sig_catcher);
        !          10309:     if (!debugging) {
        !          10310:        sigset(SIGQUIT, sig_catcher);
        !          10311:        sigset(SIGILL, sig_catcher);
        !          10312:        sigset(SIGFPE, sig_catcher);
        !          10313:        sigset(SIGBUS, sig_catcher);
        !          10314:        sigset(SIGSEGV, sig_catcher);
        !          10315:        sigset(SIGSYS, sig_catcher);
        !          10316:        sigset(SIGTERM, sig_catcher);
        !          10317:     }
        !          10318: #ifdef SIGXCPU
        !          10319:     sigset(SIGXCPU, sig_catcher);
        !          10320: #endif
        !          10321: #ifdef SIGCONT
        !          10322:     sigset(SIGCONT, cont_catcher);
        !          10323: #endif
        !          10324: #ifdef SIGTSTP
        !          10325:     sigset(SIGTSTP, stop_catcher);
        !          10326:     sigset(SIGSTOP, stop_catcher);
        !          10327: #endif
        !          10328: #endif /* lint */
        !          10329: }
        !          10330: 
        !          10331: #ifdef SIGTSTP
        !          10332: void
        !          10333: cont_catcher()
        !          10334: {
        !          10335: #ifndef lint
        !          10336:     sigset(SIGCONT,cont_catcher);
        !          10337: #endif
        !          10338:     savetty();
        !          10339:     crmode();
        !          10340:     raw();
        !          10341:     noecho();
        !          10342:     nonl();
        !          10343: }
        !          10344: #endif
        !          10345: 
        !          10346: void
        !          10347: mytstp()
        !          10348: {
        !          10349:     resetty();
        !          10350: #ifdef SIGTSTP
        !          10351:     kill(0,SIGTSTP);
        !          10352: #else
        !          10353:     if (fork())
        !          10354:        wait(0);
        !          10355:     else {
        !          10356:        char *shell = getenv("SHELL");
        !          10357: 
        !          10358:        setuid(getuid());
        !          10359:        if (!*shell)
        !          10360:            shell = "/bin/sh";
        !          10361:        execl(shell,shell,0);
        !          10362:        exit(1);
        !          10363:     }
        !          10364: #endif
        !          10365:     rewrite();
        !          10366: }
        !          10367: 
        !          10368: void                                   /* very much void */
        !          10369: finalize(status)
        !          10370: int status;
        !          10371: {
        !          10372:     if (bizarre)
        !          10373:        resetty();
        !          10374:     if (status < 0) {
        !          10375:        chdir("/usr/tmp");
        !          10376:        sigset(SIGILL,SIG_DFL);
        !          10377:        abort();
        !          10378:     }
        !          10379:     exit(status);
        !          10380: }
        !          10381: 
        !          10382: /* come here on signal other than interrupt, stop, or cont */
        !          10383: 
        !          10384: void
        !          10385: sig_catcher(signo)
        !          10386: {
        !          10387: #ifdef VERBOSE
        !          10388:     static char *signame[] = {
        !          10389:        "",
        !          10390:        "HUP",
        !          10391:        "INT",
        !          10392:        "QUIT",
        !          10393:        "ILL",
        !          10394:        "TRAP",
        !          10395:        "IOT",
        !          10396:        "EMT",
        !          10397:        "FPE",
        !          10398:        "KILL",
        !          10399:        "BUS",
        !          10400:        "SEGV",
        !          10401:        "SYS",
        !          10402:        "PIPE",
        !          10403:        "ALRM",
        !          10404:        "TERM",
        !          10405:        "???"
        !          10406: #ifdef SIGTSTP
        !          10407:        ,"STOP",
        !          10408:        "TSTP",
        !          10409:        "CONT",
        !          10410:        "CHLD",
        !          10411:        "TTIN",
        !          10412:        "TTOU",
        !          10413:        "TINT",
        !          10414:        "XCPU",
        !          10415:        "XFSZ"
        !          10416: #ifdef SIGPROF
        !          10417:        ,"VTALARM",
        !          10418:        "PROF"
        !          10419: #endif
        !          10420: #endif
        !          10421:        };
        !          10422: #endif
        !          10423: 
        !          10424: #ifdef SIGTTOU
        !          10425: #ifndef lint
        !          10426:     sigignore(SIGTTOU);
        !          10427: #endif /* lint */
        !          10428: #endif
        !          10429: #ifdef DEBUGGING
        !          10430:     if (debug) {
        !          10431:        printf("\r\nSIG%s--game not saved in debug\r\n",signame[signo]);
        !          10432:        finalize(-1);
        !          10433:     }
        !          10434: #endif
        !          10435:     panic++;
        !          10436:     if (panic >= 2) {
        !          10437:        if (panic >= 3)
        !          10438:            abort();
        !          10439:        chdir(SAVEDIR);
        !          10440:        kill(0,SIGIOT);
        !          10441:     }
        !          10442:     (void) sigset(SIGILL,SIG_DFL);
        !          10443:     if (signo == SIGHUP && (timer < 10 || didkill))
        !          10444:        signo = SIGQUIT;
        !          10445:     if (signo == SIGQUIT) {    /* can't let them bomb out without penalty */
        !          10446:        if (smarts < 20)
        !          10447:            smarts += 4;
        !          10448:        else if (smarts < 35)
        !          10449:            smarts += 2;
        !          10450:        else
        !          10451:            smarts++;
        !          10452:        totalscore -= possiblescore / 2;
        !          10453:     }
        !          10454:     save_game();
        !          10455:     if (signo != SIGHUP && signo != SIGQUIT)
        !          10456: #ifdef VERBOSE
        !          10457:        IF(verbose)
        !          10458:            printf("\r\nCaught %s%s--%s\r\n",
        !          10459:                signo ? "a SIG" : "an internal error", signame[signo],
        !          10460:                experimenting ? "game saved" : "bye bye");
        !          10461:        ELSE
        !          10462: #endif
        !          10463: #ifdef TERSE
        !          10464:            printf("\r\nSignal %d--bye bye\r\n",signo);
        !          10465: #endif
        !          10466:     switch (signo) {
        !          10467:     case SIGBUS:
        !          10468:     case SIGILL:
        !          10469:     case SIGSEGV:
        !          10470:        finalize(-signo);
        !          10471:     }
        !          10472:     finalize(1);                               /* and blow up */
        !          10473: }
        !          10474: 
        !          10475: #ifdef SIGTSTP
        !          10476: /* come here on stop signal */
        !          10477: 
        !          10478: void
        !          10479: stop_catcher()
        !          10480: {
        !          10481:     if (!waiting) {
        !          10482:        resetty();                      /* this is the point of all this */
        !          10483: #ifdef DEBUGGING
        !          10484:        if (debug)
        !          10485:            write(2,"stop_catcher\r\n",13);
        !          10486: #endif
        !          10487:        sigset(SIGTSTP,SIG_DFL);        /* enable stop */
        !          10488: #ifdef BSD42
        !          10489:        sigsetmask(sigblock(0) & ~(1 << (SIGTSTP-1)));
        !          10490: #endif
        !          10491:        kill(0,SIGTSTP);                /* and do the stop */
        !          10492:     }
        !          10493: #ifndef lint
        !          10494:     sigset(SIGTSTP,stop_catcher);      /* unenable the stop */
        !          10495: #endif
        !          10496: }
        !          10497: #endif
        !          10498: igno);
        !          10499:     }
        !          10500:     finalize(1);                               /* and blow up */
        !          10501: }
        !          10502: 
        !          10503: #ifdef SIGTSTP
        !          10504: /* come here on stop signal */
        !          10505: 
        !          10506: void
        !          10507: stop_catcher()
        !          10508: {
        !          10509:     if (!waiting) {
        !          10510:        resetty();                      /* this is the point of all this */
        !          10511: #ifdef DEBUGGING
        !          10512:        if (debug)
        !          10513:            write(2,"stop_catcher\r\n",13);
        !          10514: #endif
        !          10515:        sigset(SIGTSTP,SIG_DFL);        /* enable stop */
        !          10516: #ifdef BSD42
        !          10517:        sigsetmask(sigblock(0) & ~(1 << (SIGTSTP-1)));
        !          10518: #endif
        !          10519:        kill(0,SIGTSTP);                /* and do the stop */
        !          10520:     warp/bang.c   644    171      5        5472  5121750161   6115 /* $Header: bang.c,v 7.0.1.3 86/12/12 16:57:00 lwall Exp $ */
        !          10521: 
        !          10522: /* $Log:       bang.c,v $
        !          10523:  * Revision 7.0.1.3  86/12/12  16:57:00  lwall
        !          10524:  * Made circular explosions.
        !          10525:  * 
        !          10526:  * Revision 7.0.1.2  86/10/20  14:36:02  lwall
        !          10527:  * Picked some lint.
        !          10528:  * 
        !          10529:  * Revision 7.0.1.1  86/10/16  10:49:45  lwall
        !          10530:  * Added Damage.  Fixed random bugs.
        !          10531:  * 
        !          10532:  * Revision 7.0  86/10/08  15:11:57  lwall
        !          10533:  * Split into separate files.  Added amoebas and pirates.
        !          10534:  * 
        !          10535:  */
        !          10536: 
        !          10537: #include "EXTERN.h"
        !          10538: #include "warp.h"
        !          10539: #include "object.h"
        !          10540: #include "move.h"
        !          10541: #include "sig.h"
        !          10542: #include "term.h"
        !          10543: #include "them.h"
        !          10544: #include "INTERN.h"
        !          10545: #include "bang.h"
        !          10546: 
        !          10547: void
        !          10548: bang_init()
        !          10549: {
        !          10550:     ;
        !          10551: }
        !          10552: 
        !          10553: void
        !          10554: make_plink(y,x)
        !          10555: Reg1 int x;
        !          10556: Reg2 int y;
        !          10557: {
        !          10558:     Reg3 OBJECT *obj;
        !          10559: 
        !          10560:     move(y+1,x*2,0);
        !          10561:     beg_qwrite();
        !          10562:     *filler = '@';
        !          10563:     qwrite();
        !          10564:     obj = occupant[y][x];
        !          10565:     if (obj) {
        !          10566:        if (numamoebas && obj->image == ' ')
        !          10567:            qaddc(amb[y][x]);
        !          10568:        else
        !          10569:            qaddc(obj->image);
        !          10570:     }
        !          10571:     else if (numamoebas)
        !          10572:        qaddc(amb[y][x]);
        !          10573:     else
        !          10574:        qaddspace();
        !          10575:     end_qwrite();
        !          10576: }
        !          10577: 
        !          10578: void
        !          10579: make_blast(y,x,mass,size)
        !          10580: Reg1 int x;
        !          10581: Reg2 int y;
        !          10582: int size;
        !          10583: long mass;
        !          10584: {
        !          10585:     bangy[nxtbang] = y;
        !          10586:     bangx[nxtbang] = x;
        !          10587:     bangm[nxtbang] = mass;
        !          10588:     bangs[nxtbang++] = size;
        !          10589:     assert(nxtbang <= XSIZE * YSIZE);
        !          10590:     if (numamoebas && amb[y][x] == '~') {
        !          10591:        if (mass > 10000)
        !          10592:            modify_amoeba(y,x,1,'~', 10);
        !          10593:        else if (mass > 100)
        !          10594:            modify_amoeba(y,x,1,'~', 5);
        !          10595:        bangs[nxtbang-1] = 0;           /* don't propagate */
        !          10596:        return;
        !          10597:     }
        !          10598:     else if (mass >= 0) {
        !          10599:        Reg3 OBJECT *obj;
        !          10600: 
        !          10601:        move(y+1,x*2,0);
        !          10602:        beg_qwrite();
        !          10603:        *filler = '@';
        !          10604:        qwrite();
        !          10605:        *filler = '#';
        !          10606:        qwrite();
        !          10607:        *filler = '@';
        !          10608:        qwrite();
        !          10609:        *filler = '#';
        !          10610:        qwrite();
        !          10611:        *filler = '@';
        !          10612:        qwrite();
        !          10613:        obj = occupant[y][x];
        !          10614:        if (obj) {
        !          10615:            if (numamoebas && obj->image == ' ')
        !          10616:                qaddc(amb[y][x]);
        !          10617:            else
        !          10618:                qaddc(obj->image);
        !          10619:        }
        !          10620:        else if (numamoebas)
        !          10621:            qaddc(amb[y][x]);
        !          10622:        else
        !          10623:            qaddspace();
        !          10624:        end_qwrite();
        !          10625:     }
        !          10626: }
        !          10627: 
        !          10628: void
        !          10629: do_bangs()
        !          10630: {
        !          10631:     Reg1 int x;
        !          10632:     Reg2 int y;
        !          10633:     Reg3 int i;
        !          10634:     Reg4 int j;
        !          10635:     Reg7 int k;
        !          10636:     Reg5 int lastxy;
        !          10637:     Reg6 OBJECT *obj;
        !          10638: 
        !          10639:     /* read blast list and update blast array */
        !          10640:     assert(nxtbang >= 0 && nxtbang <= XSIZE * YSIZE);
        !          10641:     for (i=0; i<nxtbang; i++) {
        !          10642:        if (bangm[i] != 32767)
        !          10643:            bangm[i] *= 4;
        !          10644:        lastxy = bangs[i] << 1;
        !          10645:        if (lastxy >= MAXBDIST)
        !          10646:            lastxy = MAXBDIST - 1;
        !          10647:        for (y=bangy[i]-bangs[i],x=bangx[i]-bangs[i],j=lastxy;
        !          10648:          j>=0;
        !          10649:          y++,x++,--j) {
        !          10650:            yblasted[yy[j] = (y+YSIZE00) % YSIZE] |= 1;
        !          10651:            xblasted[xx[j] = (x+XSIZE00) % XSIZE] |= 1;
        !          10652:        }
        !          10653:        blasted = TRUE;
        !          10654:        for (y=lastxy;y>=0;--y) {
        !          10655:            for (x=lastxy;x>=0;--x) {
        !          10656:                if (lastxy > 2) {
        !          10657:                    j = abs(y-bangs[i]);
        !          10658:                    k = abs(x-bangs[i]);
        !          10659:                    if (j < k)          /* distance is long + 1/2 short */
        !          10660:                        j += k + k;
        !          10661:                    else
        !          10662:                        j += j + k;
        !          10663:                    if (--j > lastxy)
        !          10664:                        continue;
        !          10665:                }
        !          10666:                if (bangm[i] != 32767 ||
        !          10667:                  !(obj=occupant[yy[y]][xx[x]]) || obj->type != Web)
        !          10668:                    blast[yy[y]][xx[x]] += bangm[i];
        !          10669:            }
        !          10670:        }
        !          10671:     }
        !          10672: }
        !          10673: d[yy[j] = (y+YSIZE00) % YSIZE] |= 1;
        !          10674:            xblasted[xx[j] = (x+XSIZE00) % XSIZE] |= 1;
        !          10675:        }
        !          10676:        blasted = TRUE;
        !          10677:        for (y=lastxy;y>=0;--y) {
        !          10678:            for (x=lastxy;x>=0;--x) {
        !          10679:                if (lastxy > 2) {
        !          10680:                    j = abs(warp/config.H   644    171      5        5101  5121750163   6407 /* config.h
        !          10681:  * This file was produced by running the Configure script.
        !          10682:  *
        !          10683:  * Feel free to modify any of this as the need arises.  Note, however,
        !          10684:  * that running Configure again will wipe out any changes you've made.
        !          10685:  */
        !          10686: 
        !          10687: 
        !          10688: #/*undef       EUNICE          /* no file linking? */
        !          10689: #/*undef       VMS             /* other assorted ickies? */
        !          10690: 
        !          10691: /* how to cancel an article */
        !          10692: #define CANCEL "/usr/lib/news/inews -h <%h"    /**/
        !          10693: 
        !          10694: #define        FCNTL           /* should we include fcntl.h? */
        !          10695: 
        !          10696: #define        FTIMER          /* do we have the ftime() routine? */
        !          10697: 
        !          10698: #define        GETHOSTNAME     /* do we have a gethostname function? */
        !          10699: #/*undef       DOUNAME         /* do we have a uname function? */
        !          10700: #/*undef       PHOSTNAME "hostname"    /* how to get host name with popen */
        !          10701: 
        !          10702: #/*undef       GETPWENT        /* need we include slow getpwent? */
        !          10703: 
        !          10704: #define        HAVETERMLIB     /* do we have termlib-style routines? */
        !          10705: 
        !          10706: #/*undef       index strchr    /* cultural */
        !          10707: #/*undef       rindex strrchr  /*  differences? */
        !          10708: 
        !          10709: #define        IOCTL           /* are ioctl args all defined in one place? */
        !          10710: 
        !          10711: #define        NORMSIG         /* use signal rather than sigset? */
        !          10712: 
        !          10713: #/*undef       PORTABLE        /* do we do extra lookups to start up? */
        !          10714: 
        !          10715: #/*undef       SCOREFULL       /* keep scoreboard by fullname? */
        !          10716: 
        !          10717: #/*undef       TERMIO          /* is this a termio system? */
        !          10718: 
        !          10719: #/*undef       USENDIR         /* include ndir.c? */
        !          10720: #/*undef       LIBNDIR         /* include /usr/include/ndir.h? */
        !          10721: 
        !          10722: #/*undef       vfork fork      /* is vfork too virtual? */
        !          10723: 
        !          10724: #/*undef       void int        /* is void to be avoided? */
        !          10725: 
        !          10726: #define        WHOAMI          /* should we include whoami.h? */
        !          10727: 
        !          10728: #define        PASSNAMES /* do names come from the passwd file? */
        !          10729:                                /*  (undef to take name from ~/.fullname) */
        !          10730: #define        BERKNAMES /* if so, are they Berkeley format? */
        !          10731:                                /* (that is, ":name,stuff:") */
        !          10732: #/*undef       USGNAMES /* or are they USG format? */
        !          10733:                                /* (that is, ":stuff-name(stuff):") */
        !          10734: 
        !          10735: /* news library, may use only ~ and %l expansion */
        !          10736: #define NEWSLIB "/usr/lib/news"                /**/
        !          10737: 
        !          10738: /* default shell--ok to be a slow shell like csh */
        !          10739: #define PREFSHELL "/bin/csh"           /**/
        !          10740: 
        !          10741: /* warp private library, may use ~ expansion, %x and %l */
        !          10742: #define PRIVLIB "/a/lwall/src/warp"            /**/
        !          10743: 
        !          10744: /* bits produced by the rand() function */
        !          10745: #define RANDBITS 31            /**/
        !          10746: 
        !          10747: /* How many register declarations are paid attention to? */
        !          10748: 
        !          10749: #define Reg1 register          /**/
        !          10750: #define Reg2 register          /**/
        !          10751: #define Reg3 register          /**/
        !          10752: #define Reg4 register          /**/
        !          10753: #define Reg5 register          /**/
        !          10754: #define Reg6 register          /**/
        !          10755: #define Reg7           /**/
        !          10756: #define Reg8           /**/
        !          10757: #define Reg9           /**/
        !          10758: #define Reg10          /**/
        !          10759: #define Reg11          /**/
        !          10760: #define Reg12          /**/
        !          10761: #define Reg13          /**/
        !          10762: #define Reg14          /**/
        !          10763: #define Reg15          /**/
        !          10764: #define Reg16          /**/
        !          10765: 
        !          10766: /* root uid */
        !          10767: #define ROOTID 0               /**/
        !          10768: 
        !          10769: /* name of the site.  May be overridden by gethostname, uname, etc. */
        !          10770: #define SITENAME "sdcrdcf"             /**/
        !          10771: 
        !          10772: Reg1 register          /**/
        !          10773: #define Reg2 register          /**/
        !          10774: #define Reg3 register          /**/
        !          10775: #define Reg4 register          /**/
        !          10776: #define Reg5 register          /**/
        !          10777: #define Reg6 register          /**/
        !          10778: #define Reg7           /**/
        !          10779: #define Reg8           /**/
        !          10780: #define Reg9           /**/
        !          10781: #define Reg10          /**/
        !          10782: #define Reg11          /**/
        !          10783: #define Reg12          /**/
        !          10784: #define Reg13          /**/
        !          10785: #define Reg14          /**/
        !          10786: #define Reg15          /**/
        !          10787: #define Reg16          /**/
        !          10788: 
        !          10789: /* root uid */
        !          10790: #define ROOTID 0               /**/
        !          10791: 
        !          10792: /* name of the site.  May be overridden warp/ndir.c   644    171      5        4447  5121750165   6147 /* $Header: ndir.c,v 7.0.1.1 86/12/12 17:01:02 lwall Exp $
        !          10793:  *
        !          10794:  * $Log:       ndir.c,v $
        !          10795:  * Revision 7.0.1.1  86/12/12  17:01:02  lwall
        !          10796:  * Baseline for net release.
        !          10797:  * 
        !          10798:  * Revision 7.0  86/10/08  15:12:48  lwall
        !          10799:  * Split into separate files.  Added amoebas and pirates.
        !          10800:  * 
        !          10801:  * Revision 4.3.1.3  85/05/23  11:19:24  lwall
        !          10802:  * Oops, shouldn't have included sys/types.h again.
        !          10803:  * 
        !          10804:  * Revision 4.3.1.2  85/05/15  14:46:00  lwall
        !          10805:  * Changed short to ino_t, which may be ushort on some systems.
        !          10806:  * 
        !          10807:  * Revision 4.3.1.1  85/05/10  11:35:34  lwall
        !          10808:  * Branch for patches.
        !          10809:  * 
        !          10810:  * Revision 4.3  85/05/01  11:42:55  lwall
        !          10811:  * Baseline for release with 4.3bsd.
        !          10812:  * 
        !          10813:  */
        !          10814: 
        !          10815: #include "EXTERN.h"
        !          10816: #include "warp.h"
        !          10817: #include "INTERN.h"
        !          10818: #include "ndir.h"
        !          10819: 
        !          10820: #ifdef USENDIR
        !          10821: /*
        !          10822:  * support for Berkeley directory reading routine on a V7 file system
        !          10823:  */
        !          10824: 
        !          10825: /*
        !          10826:  * open a directory.
        !          10827:  */
        !          10828: DIR *
        !          10829: opendir(name)
        !          10830: char *name;
        !          10831: {
        !          10832:        register DIR *dirp;
        !          10833:        register int fd;
        !          10834: 
        !          10835:        if ((fd = open(name, 0)) == -1)
        !          10836:                return NULL;
        !          10837:        if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
        !          10838:                close (fd);
        !          10839:                return NULL;
        !          10840:        }
        !          10841:        dirp->dd_fd = fd;
        !          10842:        dirp->dd_loc = 0;
        !          10843:        return dirp;
        !          10844: }
        !          10845: 
        !          10846: /*
        !          10847:  * read an old style directory entry and present it as a new one
        !          10848:  */
        !          10849: #ifndef pyr
        !          10850: #define        ODIRSIZ 14
        !          10851: 
        !          10852: struct olddirect {
        !          10853:        ino_t   od_ino;
        !          10854:        char    od_name[ODIRSIZ];
        !          10855: };
        !          10856: #else  /* a Pyramid in the ATT universe */
        !          10857: #define        ODIRSIZ 248
        !          10858: 
        !          10859: struct olddirect {
        !          10860:        long    od_ino;
        !          10861:        short   od_fill1, od_fill2;
        !          10862:        char    od_name[ODIRSIZ];
        !          10863: };
        !          10864: #endif
        !          10865: 
        !          10866: /*
        !          10867:  * get next entry in a directory.
        !          10868:  */
        !          10869: struct direct *
        !          10870: readdir(dirp)
        !          10871: register DIR *dirp;
        !          10872: {
        !          10873:        register struct olddirect *dp;
        !          10874:        static struct direct dir;
        !          10875: 
        !          10876:        for (;;) {
        !          10877:                if (dirp->dd_loc == 0) {
        !          10878:                        dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
        !          10879:                            DIRBLKSIZ);
        !          10880:                        if (dirp->dd_size <= 0)
        !          10881:                                return NULL;
        !          10882:                }
        !          10883:                if (dirp->dd_loc >= dirp->dd_size) {
        !          10884:                        dirp->dd_loc = 0;
        !          10885:                        continue;
        !          10886:                }
        !          10887:                dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc);
        !          10888:                dirp->dd_loc += sizeof(struct olddirect);
        !          10889:                if (dp->od_ino == 0)
        !          10890:                        continue;
        !          10891:                dir.d_ino = dp->od_ino;
        !          10892:                strncpy(dir.d_name, dp->od_name, ODIRSIZ);
        !          10893:                dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */
        !          10894:                dir.d_namlen = strlen(dir.d_name);
        !          10895:                dir.d_reclen = DIRSIZ(&dir);
        !          10896:                return (&dir);
        !          10897:        }
        !          10898: }
        !          10899: 
        !          10900: /*
        !          10901:  * close a directory.
        !          10902:  */
        !          10903: void
        !          10904: closedir(dirp)
        !          10905: register DIR *dirp;
        !          10906: {
        !          10907:        close(dirp->dd_fd);
        !          10908:        dirp->dd_fd = -1;
        !          10909:        dirp->dd_loc = 0;
        !          10910:        free(dirp);
        !          10911: }
        !          10912: #endif /* USENDIR */
        !          10913:  olddirect *)(dirp->dd_buf + dirp->dd_loc);
        !          10914:                dirp->dd_loc += sizeof(struct olddirect);
        !          10915:                if (dp->od_ino == 0)
        !          10916:                        continue;
        !          10917:                dir.d_ino = dp->od_ino;
        !          10918:                strncpy(dir.d_name, dp->od_name, ODIRSIZ);
        !          10919:                dir.d_name[ODIRSIZ] warp/util.h   644    171      5        4150  5121750167   6166 /* $Header: util.h,v 7.0 86/10/08 15:14:37 lwall Exp $ */
        !          10920: 
        !          10921: /* $Log:       util.h,v $
        !          10922:  * Revision 7.0  86/10/08  15:14:37  lwall
        !          10923:  * Split into separate files.  Added amoebas and pirates.
        !          10924:  * 
        !          10925:  */
        !          10926: 
        !          10927: #if RANDBITS < 15 || defined(lint)
        !          10928: #define rand_mod(m) getpid()
        !          10929: #define RANDRAND 0.0
        !          10930: #define HALFRAND 0
        !          10931: #define myrand() getpid()
        !          10932: #else
        !          10933: #if RANDBITS == 15     /* 15 bits of rand()? */
        !          10934: #define RANDRAND 268435456.0 /* that's 2**28 */
        !          10935: #define HALFRAND 0x4000 /* that's 2**14 */
        !          10936: int rand();
        !          10937: #define myrand() (rand()&32767)
        !          10938: #define rand_mod(m) ((int)((double)myrand() / 32768.0 * ((double)(m))))
        !          10939: /* pick number in 0..m-1 */
        !          10940: 
        !          10941: #else
        !          10942: 
        !          10943: #if RANDBITS < 31      /* 16 bits of rand()? */
        !          10944: #define RANDRAND 1073741824.0 /* that's 2**30 */
        !          10945: #define HALFRAND 0x8000 /* that's 2**15 */
        !          10946: unsigned rand();
        !          10947: #define myrand() (rand()&65535)
        !          10948: #define rand_mod(m) ((int)((double)myrand() / 65536.0 * ((double)(m))))
        !          10949: /* pick number in 0..m-1 */
        !          10950: 
        !          10951: #else          /* assume 31 bits */
        !          10952: #define RANDRAND 1152921504606846976.0 /* that's 2**60 */
        !          10953: #define HALFRAND 0x40000000 /* that's 2**30 */
        !          10954: long rand();
        !          10955: #define myrand() rand()
        !          10956: #define rand_mod(m) ((myrand() / 37) % (m)) /* pick number in 0..m-1 */
        !          10957: /*
        !          10958:  * The reason for the /37 above is that our random number generator yields
        !          10959:  * successive evens and odds, for some reason.  This makes strange star maps.
        !          10960:  */
        !          10961: #endif
        !          10962: #endif
        !          10963: #endif
        !          10964: 
        !          10965: 
        !          10966:     /* we get fractions of seconds from calling ftime on timebuf */
        !          10967: 
        !          10968: #ifdef FTIMER
        !          10969: EXT struct timeb timebuf;
        !          10970: #define roundsleep(x) (ftime(&timebuf),sleep(timebuf.millitm > 500?x+1:x))
        !          10971: #else
        !          10972: #define roundsleep(x) sleep(x)
        !          10973: #endif
        !          10974: 
        !          10975: void movc3();
        !          10976: void no_can_do();
        !          10977: int exdis();
        !          10978: 
        !          10979: EXT bool waiting INIT(FALSE);          /* are we waiting for subprocess (in doshell)? */
        !          10980: 
        !          10981: #ifdef NOTDEF
        !          10982: EXT int len_last_line_got INIT(0);
        !          10983:                        /* strlen of some_buf after */
        !          10984:                        /*  some_buf = get_a_line(bufptr,buffersize,fp) */
        !          10985: #endif
        !          10986: 
        !          10987: #ifdef NOTDEF
        !          10988: /* is the string for makedir a directory name or a filename? */
        !          10989: 
        !          10990: #define MD_DIR 0
        !          10991: #define MD_FILE 1
        !          10992: #endif
        !          10993: 
        !          10994: void util_init();
        !          10995: char   *safemalloc();
        !          10996: char   *safecpy();
        !          10997: char   *cpytill();
        !          10998: char   *instr();
        !          10999: #ifdef SETUIDGID
        !          11000:     int                eaccess();
        !          11001: #endif
        !          11002: char   *getwd();
        !          11003: void   cat();
        !          11004: void   prexit();
        !          11005: char   *savestr();
        !          11006: char   *getval();
        !          11007: iting for subprocess (in doshell)? */
        !          11008: 
        !          11009: #ifdef NOTDEF
        !          11010: EXT int len_last_line_got INIT(0);
        !          11011:                        /* strlen of some_buf after */
        !          11012:                        /*  some_buf = get_a_line(bufptr,buffersize,fp) */
        !          11013: #endif
        !          11014: 
        !          11015: #ifdef NOTDEF
        !          11016: /* is the string for makedir a directory name or a filename? */
        !          11017: 
        !          11018: #define MD_DIR 0
        !          11019: #define MD_FILE 1
        !          11020: #endif
        !          11021: 
        !          11022: void util_init();
        !          11023: char   *safemalloc();
        !          11024: char   *safecpy();
        !          11025: char   *cpytill();
        !          11026: char   *instr();
        !          11027: #ifdef SETUIDGIwarp/smp.0   644    171      5        3460  5121750171   5716 *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11028: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11029: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11030: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11031: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11032: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11033: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11034: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11035: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11036: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11037: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11038: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11039: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11040: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11041: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11042: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11043: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11044: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11045: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11046: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11047: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11048: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11049: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11050: *   *   *   *   *   *   *   *  
        !          11051: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11052: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11053: * * * * * * * * warp/smp.1   644    171      5        3460  5121750172   5720   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        !          11054:   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        !          11055:   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        !          11056: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11057: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11058: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11059: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11060: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11061: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11062: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11063: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11064:   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        !          11065: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11066: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11067: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11068: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11069: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11070: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11071: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11072: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11073:   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        !          11074:   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        !          11075:   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
        !          11076: *   *   *   *   *   *   *   *  
        !          11077: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11078: *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *  
        !          11079: *   *   *   *   warp/smp.6   644    171      5        3444  5121750174   5731       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11080:               * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11081: * * *               * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11082: * * * * * *             * * * * * * * * * * *           * * * * * * * * * * * *
        !          11083: * * * * * * * * *         * * * * * * * *                   * * * * * * * * * *
        !          11084: * * * * * * * * * *       * * * * * * *         * * *       * * * * * * * * * *
        !          11085: * * * * * * * * * *       * * * * * *       * * * * * * *     * * * * * * * * *
        !          11086: * * * * * * * * *         * * * * * *     * * * * * * * *       * * * * * * * *
        !          11087: * * * * * * * * *       * * * * * * *   * * * * * * * * *       * * * * * * * *
        !          11088: * * * * * * * *       * * * * * * * *   * * * * * * * * * *         * * * * * *
        !          11089: * * * * * *         * * * * * * * * *   * * * * * * * * * * *       * * * * * *
        !          11090: * * * * *       * * * * * * * * * * *   * * * * * * * * * * * *     * * * * * *
        !          11091: * * * * *     * * * * * * * *       *   * * * * * * * * * * * *     * * * * * *
        !          11092: * * * * *     * * * * * * *         *   * * * * * * * * * * *       * * * * * *
        !          11093: * * * * *     * * * * * *           *   * * * * * * * * * *       * * * * * * *
        !          11094: * * * * * *     * * * *     * * *       * * * * * * * * * *     * * * * * * * *
        !          11095: * * * * * * *             * * * *       * * * * * * * * *         * * * * * * *
        !          11096: * * * * * * * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * *
        !          11097: * * * * * * * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * *
        !          11098: * * * * * * * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * *
        !          11099: * * * * * * * * * * * * * * * * * * * * * * * * * * * *           * * * * * * *
        !          11100: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *                   * *
        !          11101: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11102: * * * * * * * *         * * * * * * *
        !          11103: * * * * * * * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * *
        !          11104: * * * * * * * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * *
        !          11105: * * * * * * * * * * * warp/ndir.h   644    171      5        3042  5121750176   6144 /* $Header: ndir.h,v 7.0 86/10/08 15:12:52 lwall Exp $
        !          11106:  *
        !          11107:  * $Log:       ndir.h,v $
        !          11108:  * Revision 7.0  86/10/08  15:12:52  lwall
        !          11109:  * Split into separate files.  Added amoebas and pirates.
        !          11110:  * 
        !          11111:  * Revision 4.3.1.1  85/05/10  11:35:37  lwall
        !          11112:  * Branch for patches.
        !          11113:  * 
        !          11114:  * Revision 4.3  85/05/01  11:43:00  lwall
        !          11115:  * Baseline for release with 4.3bsd.
        !          11116:  * 
        !          11117:  */
        !          11118: 
        !          11119: #ifdef LIBNDIR
        !          11120: #   include <ndir.h>
        !          11121: #else
        !          11122: #   ifndef USENDIR
        !          11123: #      include <sys/dir.h>
        !          11124: #   else
        !          11125: 
        !          11126: #ifndef DEV_BSIZE
        !          11127: #define        DEV_BSIZE       512
        !          11128: #endif
        !          11129: #define DIRBLKSIZ      DEV_BSIZE
        !          11130: #define        MAXNAMLEN       255
        !          11131: 
        !          11132: struct direct {
        !          11133:        long    d_ino;                  /* inode number of entry */
        !          11134:        short   d_reclen;               /* length of this record */
        !          11135:        short   d_namlen;               /* length of string in d_name */
        !          11136:        char    d_name[MAXNAMLEN + 1];  /* name must be no longer than this */
        !          11137: };
        !          11138: 
        !          11139: /*
        !          11140:  * The DIRSIZ macro gives the minimum record length which will hold
        !          11141:  * the directory entry.  This requires the amount of space in struct direct
        !          11142:  * without the d_name field, plus enough space for the name with a terminating
        !          11143:  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
        !          11144:  */
        !          11145: #undef DIRSIZ
        !          11146: #define DIRSIZ(dp) \
        !          11147:     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
        !          11148: 
        !          11149: /*
        !          11150:  * Definitions for library routines operating on directories.
        !          11151:  */
        !          11152: typedef struct _dirdesc {
        !          11153:        int     dd_fd;
        !          11154:        long    dd_loc;
        !          11155:        long    dd_size;
        !          11156:        char    dd_buf[DIRBLKSIZ];
        !          11157: } DIR;
        !          11158: #ifndef NULL
        !          11159: #define NULL 0
        !          11160: #endif
        !          11161: extern DIR *opendir();
        !          11162: extern struct direct *readdir();
        !          11163: extern long telldir();
        !          11164: extern void seekdir();
        !          11165: #define rewinddir(dirp)        seekdir((dirp), (long)0)
        !          11166: extern void closedir();
        !          11167: 
        !          11168: #   endif
        !          11169: #endif
        !          11170: 
        !          11171: #undef DIRSIZ
        !          11172: #define DIRSIZ(dp) \
        !          11173:     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
        !          11174: 
        !          11175: /*
        !          11176:  * Definitions for library routines operating on directories.
        !          11177:  */
        !          11178: typedef struct _dirdesc {
        !          11179:        int     dd_fd;
        !          11180:        long    dd_loc;
        !          11181:        long    dd_size;
        !          11182:        char    dd_buf[DIRBLKSIZ];
        !          11183: } DIR;
        !          11184: #ifndef NULL
        !          11185: #define NULL 0
        !          11186: #endif
        !          11187: extern DIR *opendir();
        !          11188: extern struct direct *readdir();
        !          11189: extern long telldir();
        !          11190: extern void seekdir();
        !          11191: #define rewinddir(dirp)        seekdir((dirp), (long)0)
        !          11192: extern vwarp/object.h   644    171      5        2754  5121750200   6453 /* $Header: object.h,v 7.0.1.2 86/12/12 17:01:38 lwall Exp $ */
        !          11193: 
        !          11194: /* $Log:       object.h,v $
        !          11195:  * Revision 7.0.1.2  86/12/12  17:01:38  lwall
        !          11196:  * Baseline for net release.
        !          11197:  * 
        !          11198:  * Revision 7.0.1.1  86/10/16  10:52:30  lwall
        !          11199:  * Added Damage.  Fixed random bugs.
        !          11200:  * 
        !          11201:  * Revision 7.0  86/10/08  15:13:04  lwall
        !          11202:  * Split into separate files.  Added amoebas and pirates.
        !          11203:  * 
        !          11204:  */
        !          11205: 
        !          11206: #define Root 0
        !          11207: #define Base 1
        !          11208: #define Enterprise 2
        !          11209: #define Star 3
        !          11210: #define Torp 4
        !          11211: #define Enemy 5
        !          11212: #define Web 6
        !          11213: #define Crusher 7
        !          11214: 
        !          11215: typedef struct object {
        !          11216:     char posx, posy;
        !          11217: #ifdef SIGNEDCHAR
        !          11218:     char velx, vely;
        !          11219: #else
        !          11220:     short velx, vely;
        !          11221: #endif
        !          11222:     struct object *next, *prev, *contend;
        !          11223:     long energy;
        !          11224:     long mass;
        !          11225:     char type;
        !          11226:     char image;
        !          11227:     char strategy;
        !          11228:     char flags;
        !          11229: } OBJECT;
        !          11230: 
        !          11231: #define PIRATE 1       /* we may mutiny */
        !          11232: #define FRIENDLY 2     /* we aren't really an enemy, for now */
        !          11233: #define STATIC 4       /* we are not in the movers list at the moment */
        !          11234: #define COUNTDOWN 8    /* we are counting down for something */
        !          11235: #define CLOAKS 16      /* we can cloak */
        !          11236: 
        !          11237: #ifdef DOINIT
        !          11238: OBJECT root = {0, 0, 0, 0, &root, &root, 0, 0, 0, Root, '?', 0, 0};
        !          11239: #else
        !          11240: EXT OBJECT root;
        !          11241: #endif
        !          11242: 
        !          11243: #ifdef DOINIT
        !          11244: OBJECT free_root = {0, 0, 0, 0, &free_root, &free_root, 0, 0, 0, Root, '?', 0, 0};
        !          11245: #else
        !          11246: EXT OBJECT free_root;
        !          11247: #endif
        !          11248: 
        !          11249: EXT OBJECT *ent;
        !          11250: EXT OBJECT *base;
        !          11251: EXT OBJECT *enemies;
        !          11252: EXT OBJECT *movers;
        !          11253: EXT OBJECT *realapollo;
        !          11254: EXT OBJECT *nuke;
        !          11255: 
        !          11256: EXT OBJECT *occupant[YSIZE][XSIZE];
        !          11257: 
        !          11258: OBJECT *make_object();
        !          11259: 
        !          11260: void unmake_object();
        !          11261: void free_object();
        !          11262: void object_init();
        !          11263:  16    /* we can cloak warp/object.c   644    171      5        2744  5121750201   6446 /* $Header: object.c,v 7.0 86/10/08 15:12:55 lwall Exp $ */
        !          11264: 
        !          11265: /* $Log:       object.c,v $
        !          11266:  * Revision 7.0  86/10/08  15:12:55  lwall
        !          11267:  * Split into separate files.  Added amoebas and pirates.
        !          11268:  * 
        !          11269:  */
        !          11270: 
        !          11271: #include "EXTERN.h"
        !          11272: #include "warp.h"
        !          11273: #include "INTERN.h"
        !          11274: #include "object.h"
        !          11275: 
        !          11276: void
        !          11277: object_init()
        !          11278: {
        !          11279:     ;
        !          11280: }
        !          11281: 
        !          11282: OBJECT *
        !          11283: make_object(typ, img, py, px, vy, vx, energ, mas, where)
        !          11284: char typ;
        !          11285: char img;
        !          11286: int px, py, vx, vy;
        !          11287: long energ, mas;
        !          11288: OBJECT *where;
        !          11289: {
        !          11290:     Reg1 OBJECT *obj;
        !          11291: 
        !          11292:     if (free_root.next == &free_root)
        !          11293: #ifndef lint
        !          11294:        obj = (OBJECT *) malloc(sizeof root);
        !          11295: #else
        !          11296:        obj = Null(OBJECT*);
        !          11297: #endif
        !          11298:     else {
        !          11299:        obj = free_root.next;
        !          11300:        free_root.next = obj->next;
        !          11301:        obj->next->prev = &free_root;
        !          11302:     }
        !          11303:     obj->type = typ;
        !          11304:     obj->image = img;
        !          11305:     obj->next = where;
        !          11306:     obj->prev = where->prev;
        !          11307:     where->prev = obj;
        !          11308:     obj->prev->next = obj;
        !          11309:     obj->velx = vx;
        !          11310:     obj->vely = vy;
        !          11311:     obj->contend = 0;
        !          11312:     obj->strategy = 0;
        !          11313:     obj->flags = 0;
        !          11314:     obj->posx = px;
        !          11315:     obj->posy = py;
        !          11316:     if (typ != Torp && typ != Web) {
        !          11317:        occupant[py][px] = obj;
        !          11318:     }
        !          11319:     obj->energy = energ;
        !          11320:     obj->mass = mas;
        !          11321:     return(obj);
        !          11322: }
        !          11323: 
        !          11324: void
        !          11325: unmake_object(curobj)
        !          11326: Reg1 OBJECT *curobj;
        !          11327: {
        !          11328:     curobj->prev->next = curobj->next;
        !          11329:     curobj->next->prev = curobj->prev;
        !          11330:     if (curobj == movers) {
        !          11331:        movers = curobj->next;
        !          11332:     }
        !          11333:     free_object(curobj);
        !          11334: }
        !          11335: 
        !          11336: void
        !          11337: free_object(curobj)
        !          11338: Reg1 OBJECT *curobj;
        !          11339: {
        !          11340:     curobj->next = free_root.next;
        !          11341:     curobj->prev = &free_root;
        !          11342:     free_root.next->prev = curobj;
        !          11343:     free_root.next = curobj;
        !          11344: }
        !          11345: orp && typ != Web) {
        !          11346:        occupawarp/sm.c   644    171      5        2661  5121750203   5617 /* $Header: sm.c,v 7.0 86/10/08 15:13:35 lwall Exp $ */
        !          11347: 
        !          11348: /* $Log:       sm.c,v $
        !          11349:  * Revision 7.0  86/10/08  15:13:35  lwall
        !          11350:  * Split into separate files.  Added amoebas and pirates.
        !          11351:  * 
        !          11352:  */
        !          11353: 
        !          11354: #include <stdio.h>
        !          11355: #include <ctype.h>
        !          11356: #include "config.h"
        !          11357: 
        !          11358: main()
        !          11359: {
        !          11360:     char screen[23][90], buf[10];
        !          11361:     Reg1 int y;
        !          11362:     Reg2 int x;
        !          11363:     int tmpy, tmpx;
        !          11364: 
        !          11365:     for (x=0; x<79; x++)
        !          11366:        screen[0][x] = ' ';
        !          11367:     screen[0][79] = '\0';
        !          11368:     
        !          11369:     fgets(screen[0],90,stdin);
        !          11370:     if (isdigit(screen[0][0])) {
        !          11371:        int numstars = atoi(screen[0]);
        !          11372: 
        !          11373:        for (y=0; y<23; y++) {
        !          11374:            for (x=0; x<79; x++)
        !          11375:                screen[y][x] = ' ';
        !          11376:            screen[y][79] = '\0';
        !          11377:        }
        !          11378:        
        !          11379:        for ( ; numstars; numstars--) {
        !          11380:            scanf("%d %d\n",&tmpy,&tmpx);
        !          11381:            y = tmpy;
        !          11382:            x = tmpx;
        !          11383:            screen[y][x+x] = '*';
        !          11384:        }
        !          11385: 
        !          11386:        for (y=0; y<23; y++) {
        !          11387:            printf("%s\n",screen[y]);
        !          11388:        }
        !          11389:     }
        !          11390:     else {
        !          11391:        Reg3 int numstars = 0;
        !          11392: 
        !          11393:        for (y=1; y<23; y++) {
        !          11394:            for (x=0; x<79; x++)
        !          11395:                screen[y][x] = ' ';
        !          11396:            screen[y][79] = '\0';
        !          11397:        }
        !          11398:        
        !          11399:        for (y=1; y<23; y++) {
        !          11400:            fgets(screen[y],90,stdin);
        !          11401:        }
        !          11402: 
        !          11403:        for (y=0; y<23; y++) {
        !          11404:            for (x=0; x<80; x += 2) {
        !          11405:                if (screen[y][x] == '*') {
        !          11406:                    numstars++;
        !          11407:                }
        !          11408:                else if (screen[y][x] == '\t' || screen[y][x+1] == '\t') {
        !          11409:                    fprintf(stderr,"Cannot have tabs in starmap--please expand.\n");
        !          11410:                    exit(1);
        !          11411:                }
        !          11412:            }
        !          11413:        }
        !          11414: 
        !          11415:        printf("%d\n",numstars);
        !          11416: 
        !          11417:        for (y=0; y<23; y++) {
        !          11418:            for (x=0; x<80; x += 2) {
        !          11419:                if (screen[y][x] == '*') {
        !          11420:                    printf("%d %d\n",y,x/2);
        !          11421:                }
        !          11422:            }
        !          11423:        }
        !          11424:     }
        !          11425:     exit(0);
        !          11426: }
        !          11427: ;
        !          11428:        }
        !          11429:        
        !          11430:        for (y=1; y<23; y++) {
        !          11431:            fgets(screen[y],90,stdin);
        !          11432:        }
        !          11433: 
        !          11434:        for (y=0; ywarp/smp.4   644    171      5        2601  5121750204   5713 * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11435: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11436: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11437: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11438: 
        !          11439: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11440: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11441: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11442: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11443: 
        !          11444: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11445: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11446: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11447: 
        !          11448: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11449: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11450: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11451: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11452: 
        !          11453: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11454: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11455: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11456: 
        !          11457: *   * * * *   * * * *   * * * *   * * * *
        !          11458: * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *   * * * *
        !          11459: * * * *warp/makedir.SH   644    171      5        2354  5121750206   6706 case $CONFIG in
        !          11460:     '') . config.sh ;;
        !          11461: esac
        !          11462: echo "Extracting makedir (with variable substitutions)"
        !          11463: $spitshell >makedir <<!GROK!THIS!
        !          11464: $startsh
        !          11465: # $Header: makedir.SH,v 7.0 86/10/08 15:12:34 lwall Exp $
        !          11466: # 
        !          11467: # $Log:        makedir.SH,v $
        !          11468: # Revision 7.0  86/10/08  15:12:34  lwall
        !          11469: # Split into separate files.  Added amoebas and pirates.
        !          11470: # 
        !          11471: # Revision 4.3.1.1  85/05/10  11:35:14  lwall
        !          11472: # Branch for patches.
        !          11473: # 
        !          11474: # Revision 4.3  85/05/01  11:42:31  lwall
        !          11475: # Baseline for release with 4.3bsd.
        !          11476: # 
        !          11477: 
        !          11478: export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
        !          11479: 
        !          11480: case \$# in
        !          11481:   0)
        !          11482:     $echo "makedir pathname filenameflag"
        !          11483:     exit 1
        !          11484:     ;;
        !          11485: esac
        !          11486: 
        !          11487: : guarantee one slash before 1st component
        !          11488: case \$1 in
        !          11489:   /*) ;;
        !          11490:   *)  set ./\$1 \$2 ;;
        !          11491: esac
        !          11492: 
        !          11493: : strip last component if it is to be a filename
        !          11494: case X\$2 in
        !          11495:   X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
        !          11496:   *)  set \$1 ;;
        !          11497: esac
        !          11498: 
        !          11499: : return reasonable status if nothing to be created
        !          11500: if $test -d "\$1" ; then
        !          11501:     exit 0
        !          11502: fi
        !          11503: 
        !          11504: list=''
        !          11505: while true ; do
        !          11506:     case \$1 in
        !          11507:     */*)
        !          11508:        list="\$1 \$list"
        !          11509:        set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
        !          11510:        ;;
        !          11511:     *)
        !          11512:        break
        !          11513:        ;;
        !          11514:     esac
        !          11515: done
        !          11516: 
        !          11517: set \$list
        !          11518: 
        !          11519: for dir do
        !          11520:     $mkdir \$dir >/dev/null 2>&1
        !          11521: done
        !          11522: !GROK!THIS!
        !          11523: $eunicefix makedir
        !          11524: chmod 755 makedir
        !          11525: t ./\$1 \$2 ;;
        !          11526: esac
        !          11527: 
        !          11528: : strip last component if it is to be a filename
        !          11529: case X\$2 in
        !          11530:   X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
        !          11531:   *)  set \$1 ;;
        !          11532: esac
        !          11533: 
        !          11534: : return reasonable status if nothing to be created
        !          11535: if $test -d "\$1" ; then
        !          11536:     exit 0
        !          11537: fi
        !          11538: 
        !          11539: list=''
        !          11540: while true ; warp/smp.2   644    171      5        2167  5121750207   5723 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11541: *   * * * *   *                       
        !          11542: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11543: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11544: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11545: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11546: *   * * * *   *                       
        !          11547: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
        !          11548: *   * * * *   *                       
        !          11549: *   * * * *   *                       
        !          11550: *   * * * *   *                       
        !          11551: *   * * * *   *                       
        !          11552: *   * * * *   *                       
        !          11553: *   * * * *   *                       
        !          11554: *   * * * *   *                       
        !          11555: *   * * * *   *                       
        !          11556: *   * * * *   *                       
        !          11557: *   * * * *   *                       
        !          11558: *   * * * *   *                       
        !          11559: *   * * * *   *                       
        !          11560: *   * * * *   *                       
        !          11561: *   * * * *   *                       
        !          11562: *   * * * *   *                       
        !          11563:     
        !          11564: *   * * * *   *                       
        !          11565: *   * * * *   *                       
        !          11566: *   * * * *   *                       
        !          11567: *   * * * *   *                       
        !          11568: *   * * * *   *                       
        !          11569: *   * * * *   *                       
        !          11570: *   * * * *   *                       
        !          11571: *   * * * *   *                       
        !          11572: *   * * * *   *                       
        !          11573: *   * * * *   *                      warp/us.h   644    171      5        2112  5121750211   5622 /* $Header: us.h,v 7.0.1.1 86/10/16 10:53:58 lwall Exp $ */
        !          11574: 
        !          11575: /* $Log:       us.h,v $
        !          11576:  * Revision 7.0.1.1  86/10/16  10:53:58  lwall
        !          11577:  * Added Damage.  Fixed random bugs.
        !          11578:  * 
        !          11579:  * Revision 7.0  86/10/08  15:14:27  lwall
        !          11580:  * Split into separate files.  Added amoebas and pirates.
        !          11581:  * 
        !          11582:  */
        !          11583: 
        !          11584: EXT bool cloaking;
        !          11585: EXT bool cloaked;
        !          11586: 
        !          11587: EXT int status;
        !          11588: EXT int entmode;
        !          11589: 
        !          11590: EXT int evely;
        !          11591: EXT int evelx;
        !          11592: EXT int bvely;
        !          11593: EXT int bvelx;
        !          11594: 
        !          11595: #define MAXDAMAGE 9
        !          11596: #define NOWARP 0
        !          11597: #define NOIMPULSE 1
        !          11598: #define NOPHASERS 2
        !          11599: #define NOTORPS 3
        !          11600: #define NOCLOAKING 4
        !          11601: #define NOSHIELDS 5
        !          11602: #define NOZAPPER 6
        !          11603: #define NODESTRUCT 7
        !          11604: #define NOTRACTORS 8
        !          11605: 
        !          11606: EXT int dam INIT(0);
        !          11607: EXT int lastdam INIT(-1);
        !          11608: EXT int damage INIT(0);
        !          11609: EXT int olddamage INIT(-1);
        !          11610: 
        !          11611: #ifdef DOINIT
        !          11612: char *dammess[MAXDAMAGE] = {
        !          11613:     "WARP",
        !          11614:     "IMPULSE",
        !          11615:     "PHASERS",
        !          11616:     "TORPS",
        !          11617:     "CLOAKING",
        !          11618:     "SHIELDS",
        !          11619:     "ZAPPER",
        !          11620:     "DESTRUCT",
        !          11621:     "TRACTORS"
        !          11622: };
        !          11623: char damflag[MAXDAMAGE] = {0,0,0,0,0,0,0,0,0};
        !          11624: #else
        !          11625: extern char *dammess[];
        !          11626: extern char damflag[];
        !          11627: #endif
        !          11628: 
        !          11629: void do_direction();
        !          11630: void ctrl_direction();
        !          11631: void shift_direction();
        !          11632: void get_commands();
        !          11633: void us_init();
        !          11634: #define NOTRACTORS 8
        !          11635: 
        !          11636: EXT int dam INIT(0);
        !          11637: EXT int lastdam INIT(-1);
        !          11638: EXT int damage INIT(0);
        !          11639: EXT int olddamage INIT(-1);
        !          11640: 
        !          11641: #ifdef DOINIT
        !          11642: char *dammess[MAXDAMAGE] = {
        !          11643:     "WARP",
        !          11644:     "IMPULSE",
        !          11645:     "PHASERS",
        !          11646:     "TORPS",
        !          11647:     "CLOAKING",
        !          11648:     "SHIELDS",
        !          11649:     "ZAPPER",
        !          11650:     "DESTRUCT",
        !          11651:     "TRACTORS"
        !          11652: };
        !          11653: char damflag[MAXDAMAGE] = {0,0,0,0,0,0,0,0,0};
        !          11654: #else
        !          11655: extern char *dammess[];
        !          11656: extern char damflag[];
        !          11657: #endif
        !          11658: 
        !          11659: void do_direction();
        !          11660: void ctrl_warp/bang.h   644    171      5        1106  5121750212   6105 /* $Header: bang.h,v 7.0 86/10/08 15:12:03 lwall Exp $ */
        !          11661: 
        !          11662: /* $Log:       bang.h,v $
        !          11663:  * Revision 7.0  86/10/08  15:12:03  lwall
        !          11664:  * Split into separate files.  Added amoebas and pirates.
        !          11665:  * 
        !          11666:  */
        !          11667: 
        !          11668: EXT long blast[YSIZE][XSIZE];
        !          11669: EXT bool blasted;
        !          11670: EXT bool xblasted[XSIZE];
        !          11671: EXT bool yblasted[YSIZE];
        !          11672: 
        !          11673: EXT char bangy[YSIZE*XSIZE];
        !          11674: EXT char bangx[YSIZE*XSIZE];
        !          11675: EXT char bangs[YSIZE*XSIZE];
        !          11676: 
        !          11677: EXT long bangm[YSIZE*XSIZE];
        !          11678: 
        !          11679: #define MAXBDIST 40
        !          11680: EXT int xx[MAXBDIST];
        !          11681: EXT int yy[MAXBDIST];
        !          11682: 
        !          11683: EXT int nxtbang;
        !          11684: EXT bool banging;
        !          11685: 
        !          11686: void make_plink();
        !          11687: void make_blast();
        !          11688: void do_bangs();
        !          11689: void bang_init();
        !          11690: ng.h,v $
        !          11691:  * Revision 7.0  86/10/08  15:12:03  lwall
        !          11692:  * Split into separate files.  Added amoebas and pirates.
        !          11693:  * 
        !          11694:  */
        !          11695: 
        !          11696: EXT long blast[YSIZE][XSIZE];
        !          11697: EXT bool blasted;
        !          11698: EXT bool xblasted[XSIZE];
        !          11699: EXT bool yblasted[YSIZE];
        !          11700: 
        !          11701: EXT char bangy[YSIZE*XSIZE];
        !          11702: EXT char bangx[YSIZE*XSIZE];
        !          11703: EXT char bangs[YSIZE*XSIZE];
        !          11704: 
        !          11705: EXT long bangm[YSIZE*XSIZE];
        !          11706: 
        !          11707: #define MAXBDIST 40
        !          11708: EXT int xx[MAXBDIST];
        !          11709: EXT int yy[MAXBDIST];
        !          11710: 
        !          11711: EXT int nxtbang;
        !          11712: EXT bool banging;
        !          11713: 
        !          11714: voiwarp/EXTERN.h   644    171      5         622  5121750213   6166 /* $Header: EXTERN.h,v 7.0.1.1 86/12/12 16:46:50 lwall Exp $
        !          11715:  *
        !          11716:  * $Log:       EXTERN.h,v $
        !          11717:  * Revision 7.0.1.1  86/12/12  16:46:50  lwall
        !          11718:  * Guarded the undefs.
        !          11719:  * 
        !          11720:  * Revision 7.0  86/10/08  15:11:31  lwall
        !          11721:  * Split into separate files.  Added amoebas and pirates.
        !          11722:  * 
        !          11723:  */
        !          11724: 
        !          11725: #ifdef EXT
        !          11726: #undef EXT
        !          11727: #endif
        !          11728: #define EXT extern
        !          11729: 
        !          11730: #ifdef INIT
        !          11731: #undef INIT
        !          11732: #endif
        !          11733: #define INIT(x)
        !          11734: 
        !          11735: #ifdef DOINIT
        !          11736: #undef DOINIT
        !          11737: #endif
        !          11738: ZE];
        !          11739: 
        !          11740: #define MAXBDIST 40
        !          11741: EXT int xx[MAXBDIST];
        !          11742: EXT in�m@T];
        !          11743: @��[H&1;���warp/version.c   644    171      5         622  5121750215   6643 /* $Header: version.c,v 7.0 86/10/08 15:14:39 lwall Exp $
        !          11744:  *
        !          11745:  * $Log:       version.c,v $
        !          11746:  * Revision 7.0  86/10/08  15:14:39  lwall
        !          11747:  * Split into separate files.  Added amoebas and pirates.
        !          11748:  * 
        !          11749:  */
        !          11750: 
        !          11751: #include "patchlevel.h"
        !          11752: #include "INTERN.h"
        !          11753: #include "version.h"
        !          11754: 
        !          11755: /* Print out the version number. */
        !          11756: 
        !          11757: void
        !          11758: version()
        !          11759: {
        !          11760:     extern char rcsid[];
        !          11761: 
        !          11762:     printf("%s\r\nPatch level: %d\r\n", rcsid, PATCHLEVEL);
        !          11763: }
        !          11764: ZE];
        !          11765: 
        !          11766: #define MAXBDIST 40
        !          11767: EXT int xx[MAXBDIST];
        !          11768: EXT in�m@T];
        !          11769: @��[H&1;���warp/weapon.h   644    171      5         602  5121750216   6453 /* $Header: weapon.h,v 7.0 86/10/08 15:18:20 lwall Exp $ */
        !          11770: 
        !          11771: /* $Log:       weapon.h,v $
        !          11772:  * Revision 7.0  86/10/08  15:18:20  lwall
        !          11773:  * Split into separate files.  Added amoebas and pirates.
        !          11774:  * 
        !          11775:  */
        !          11776: 
        !          11777: EXT int tractor INIT(0);
        !          11778: 
        !          11779: EXT int etorp;
        !          11780: EXT int btorp;
        !          11781: 
        !          11782: EXT OBJECT *isatorp[2][3][3];
        !          11783: 
        !          11784: EXT int aretorps;
        !          11785: 
        !          11786: void fire_torp();
        !          11787: void attack();
        !          11788: void fire_phaser();
        !          11789: int tract();
        !          11790: void weapon_init();
        !          11791:  PATCHLEVEL);
        !          11792: }
        !          11793: ZE];
        !          11794: 
        !          11795: #define MAXBDIST 40
        !          11796: EXT int xx[MAXBDIST];
        !          11797: EXT in�m@T];
        !          11798: @��[H&1;���warp/INTERN.h   644    171      5         573  5121750217   6171 /* $Header: INTERN.h,v 7.0.1.1 86/12/12 16:51:45 lwall Exp $
        !          11799:  *
        !          11800:  * $Log:       INTERN.h,v $
        !          11801:  * Revision 7.0.1.1  86/12/12  16:51:45  lwall
        !          11802:  * Guarded the undefs.
        !          11803:  * 
        !          11804:  * Revision 7.0  86/10/08  15:11:37  lwall
        !          11805:  * Split into separate files.  Added amoebas and pirates.
        !          11806:  * 
        !          11807:  */
        !          11808: 
        !          11809: #ifdef EXT
        !          11810: #undef EXT
        !          11811: #endif
        !          11812: #define EXT
        !          11813: 
        !          11814: #ifdef INIT
        !          11815: #undef INIT
        !          11816: #endif
        !          11817: #define INIT(x) = x
        !          11818: 
        !          11819: #define DOINIT
        !          11820: nit();
        !          11821:  PATCHLEVEL);
        !          11822: }
        !          11823: ZE];
        !          11824: 
        !          11825: #define MAXBDIST 40
        !          11826: EXT int xx[MAXBDIST];
        !          11827: EXT in�m@T];
        !          11828: @��[H&1;���warp/sig.h   644    171      5         500  5121750220   5734 /* $Header: sig.h,v 7.0 86/10/08 15:13:32 lwall Exp $ */
        !          11829: 
        !          11830: /* $Log:       sig.h,v $
        !          11831:  * Revision 7.0  86/10/08  15:13:32  lwall
        !          11832:  * Split into separate files.  Added amoebas and pirates.
        !          11833:  * 
        !          11834:  */
        !          11835: 
        !          11836: void sig_catcher();
        !          11837: #ifdef SIGTSTP
        !          11838: void cont_catcher();
        !          11839: void stop_catcher();
        !          11840: #endif
        !          11841: void mytstp();
        !          11842: void sig_init();
        !          11843: void finalize();
        !          11844: NIT
        !          11845: #undef INIT
        !          11846: #endif
        !          11847: #define INIT(x) = x
        !          11848: 
        !          11849: #define DOINIT
        !          11850: nit();
        !          11851:  PATCHLEVEL);
        !          11852: }
        !          11853: ZE];
        !          11854: 
        !          11855: #define MAXBDIST 40
        !          11856: EXT int xx[MAXBDIST];
        !          11857: EXT in�m@T];
        !          11858: @��[H&1;~��warp/move.h   644    171      5         450  5121750222   6126 /* $Header: move.h,v 7.0 86/10/08 15:12:46 lwall Exp $ */
        !          11859: 
        !          11860: /* $Log:       move.h,v $
        !          11861:  * Revision 7.0  86/10/08  15:12:46  lwall
        !          11862:  * Split into separate files.  Added amoebas and pirates.
        !          11863:  * 
        !          11864:  */
        !          11865: 
        !          11866: void bounce();
        !          11867: void move_universe();
        !          11868: int lookaround();
        !          11869: int lookfor();
        !          11870: OBJECT *lookimg();
        !          11871: void move_init();
        !          11872: nit();
        !          11873: void finalize();
        !          11874: NIT
        !          11875: #undef INIT
        !          11876: #endif
        !          11877: #define INIT(x) = x
        !          11878: 
        !          11879: #define DOINIT
        !          11880: nit();
        !          11881:  PATCHLEVEL);
        !          11882: }
        !          11883: ZE];
        !          11884: 
        !          11885: #define MAXBDIST 40
        !          11886: EXT int xx[MAXBDIST];
        !          11887: EXT in�m@T];
        !          11888: @��[H&1;��warp/smp.3   644    171      5         437  5121750227   5704         * * * *        
        !          11889:     * * *     * * *    
        !          11890:   * * *   * *   * * *  
        !          11891:   * *   * * * *   * *  
        !          11892: * *   * *     * *   * *
        !          11893: *   * *   * *   * *   *
        !          11894: *   * *   * *   * *   *
        !          11895: * *   * *     * *   * *
        !          11896:   * *   * * * *   * * 
        !          11897:   * * *   * *   * * * 
        !          11898:     * * *     * * * 
        !          11899:         * * * * 
        !          11900: 
        !          11901: 
        !          11902: 
        !          11903: 
        !          11904: 
        !          11905: 
        !          11906: 
        !          11907: 
        !          11908: 
        !          11909: 
        !          11910: 
        !          11911: _init();
        !          11912: nit();
        !          11913: void finalize();
        !          11914: NIT
        !          11915: #undef INIT
        !          11916: #endif
        !          11917: #define INIT(x) = x
        !          11918: 
        !          11919: #define DOINIT
        !          11920: nit();
        !          11921:  PATCHLEVEL);
        !          11922: }
        !          11923: ZE];
        !          11924: 
        !          11925: #define MAXBDIST 40
        !          11926: EXT int xx[MAXBDIST];
        !          11927: EXT in�m@T];
        !          11928: @��[H&1;~��warp/play.h   644    171      5         404  5121750230   6123 /* $Header: play.h,v 7.0 86/10/08 15:13:12 lwall Exp $ */
        !          11929: 
        !          11930: /* $Log:       play.h,v $
        !          11931:  * Revision 7.0  86/10/08  15:13:12  lwall
        !          11932:  * Split into separate files.  Added amoebas and pirates.
        !          11933:  * 
        !          11934:  */
        !          11935: 
        !          11936: EXT int finish INIT(0);
        !          11937: EXT int timer;
        !          11938: 
        !          11939: void play();
        !          11940: void play_init();
        !          11941:        * * * * 
        !          11942: 
        !          11943: 
        !          11944: 
        !          11945: 
        !          11946: 
        !          11947: 
        !          11948: 
        !          11949: 
        !          11950: 
        !          11951: 
        !          11952: 
        !          11953: _init();
        !          11954: nit();
        !          11955: void finalize();
        !          11956: NIT
        !          11957: #undef INIT
        !          11958: #endif
        !          11959: #define INIT(x) = x
        !          11960: 
        !          11961: #define DOINIT
        !          11962: nit();
        !          11963:  PATCHLEVEL);
        !          11964: }
        !          11965: ZE];
        !          11966: 
        !          11967: #define MAXBDIST 40
        !          11968: EXT int xx[MAXBDIST];
        !          11969: EXT in�m@T];
        !          11970: @��[H&1;��warp/them.h   644    171      5         372  5121750231   6120 /* $Header: them.h,v 7.0 86/10/08 15:14:19 lwall Exp $ */
        !          11971: 
        !          11972: /* $Log:       them.h,v $
        !          11973:  * Revision 7.0  86/10/08  15:14:19  lwall
        !          11974:  * Split into separate files.  Added amoebas and pirates.
        !          11975:  * 
        !          11976:  */
        !          11977: 
        !          11978: void their_smarts();
        !          11979: void modify_amoeba();
        !          11980: void them_init();
        !          11981: y_init();
        !          11982:        * * * * 
        !          11983: 
        !          11984: 
        !          11985: 
        !          11986: 
        !          11987: 
        !          11988: 
        !          11989: 
        !          11990: 
        !          11991: 
        !          11992: 
        !          11993: 
        !          11994: _init();
        !          11995: nit();
        !          11996: void finalize();
        !          11997: NIT
        !          11998: #undef INIT
        !          11999: #endif
        !          12000: #define INIT(x) = x
        !          12001: 
        !          12002: #define DOINIT
        !          12003: nit();
        !          12004:  PATCHLEVEL);
        !          12005: }
        !          12006: ZE];
        !          12007: 
        !          12008: #define MAXBDIST 40
        !          12009: EXT int xx[MAXBDIST];
        !          12010: EXT in�m@T];
        !          12011: @��[H&1;��warp/version.h   644    171      5         322  5121750233   6645 /* $Header: version.h,v 7.0 86/10/08 15:14:43 lwall Exp $
        !          12012:  *
        !          12013:  * $Log:       version.h,v $
        !          12014:  * Revision 7.0  86/10/08  15:14:43  lwall
        !          12015:  * Split into separate files.  Added amoebas and pirates.
        !          12016:  * 
        !          12017:  */
        !          12018: 
        !          12019: void version();
        !          12020: void modify_amoeba();
        !          12021: void them_init();
        !          12022: y_init();
        !          12023:        * * * * 
        !          12024: 
        !          12025: 
        !          12026: 
        !          12027: 
        !          12028: 
        !          12029: 
        !          12030: 
        !          12031: 
        !          12032: 
        !          12033: 
        !          12034: 
        !          12035: _init();
        !          12036: nit();
        !          12037: void finalize();
        !          12038: NIT
        !          12039: #undef INIT
        !          12040: #endif
        !          12041: #define INIT(x) = x
        !          12042: 
        !          12043: #define DOINIT
        !          12044: nit();
        !          12045:  PATCHLEVEL);
        !          12046: }
        !          12047: ZE];
        !          12048: 
        !          12049: #define MAXBDIST 40
        !          12050: EXT int xx[MAXBDIST];
        !          12051: EXT in�m@T];
        !          12052: @��[H&1;���warp/init.h   644    171      5         320  5121750234   6122 /* $Header: init.h,v 7.0 86/10/08 15:12:17 lwall Exp $ */
        !          12053: 
        !          12054: /* $Log:       init.h,v $
        !          12055:  * Revision 7.0  86/10/08  15:12:17  lwall
        !          12056:  * Split into separate files.  Added amoebas and pirates.
        !          12057:  * 
        !          12058:  */
        !          12059: 
        !          12060: void initialize();
        !          12061: ;
        !          12062: void modify_amoeba();
        !          12063: void them_init();
        !          12064: y_init();
        !          12065:        * * * * 
        !          12066: 
        !          12067: 
        !          12068: 
        !          12069: 
        !          12070: 
        !          12071: 
        !          12072: 
        !          12073: 
        !          12074: 
        !          12075: 
        !          12076: 
        !          12077: _init();
        !          12078: nit();
        !          12079: void finalize();
        !          12080: NIT
        !          12081: #undef INIT
        !          12082: #endif
        !          12083: #define INIT(x) = x
        !          12084: 
        !          12085: #define DOINIT
        !          12086: nit();
        !          12087:  PATCHLEVEL);
        !          12088: }
        !          12089: ZE];
        !          12090: 
        !          12091: #define MAXBDIST 40
        !          12092: EXT int xx[MAXBDIST];
        !          12093: EXT in�m@T];
        !          12094: @��[H&1;��warp/smp.5   644    171      5         255  5121750235   5703 * * *
        !          12095: *   *
        !          12096: * * *
        !          12097: 
        !          12098: 
        !          12099: 
        !          12100: 
        !          12101: 
        !          12102: 
        !          12103: 
        !          12104: 
        !          12105:                                         * * *
        !          12106:                                         *   *
        !          12107:                                         * * *
        !          12108: 
        !          12109: 
        !          12110: 
        !          12111: 
        !          12112: 
        !          12113: 
        !          12114: 
        !          12115: 
        !          12116: 
        !          12117: rates.
        !          12118:  * 
        !          12119:  */
        !          12120: 
        !          12121: void initialize();
        !          12122: ;
        !          12123: void modify_amoeba();
        !          12124: void them_init();
        !          12125: y_init();
        !          12126:        * * * * 
        !          12127: 
        !          12128: 
        !          12129: 
        !          12130: 
        !          12131: 
        !          12132: 
        !          12133: 
        !          12134: 
        !          12135: 
        !          12136: 
        !          12137: 
        !          12138: _init();
        !          12139: nit();
        !          12140: void finalize();
        !          12141: NIT
        !          12142: #undef INIT
        !          12143: #endif
        !          12144: #define INIT(x) = x
        !          12145: 
        !          12146: #define DOINIT
        !          12147: nit();
        !          12148:  PATCHLEVEL);
        !          12149: }
        !          12150: ZE];
        !          12151: 
        !          12152: #define MAXBDIST 40
        !          12153: EXT int xx[MAXBDIST];
        !          12154: EXT in�m@T];
        !          12155: @��[H&1;~��warp/warp.news   644    171      5         210  5121750236   6655                          ***  WARP NEWS  ***
        !          12156: 
        !          12157: Welcome to warp!  Please send any gripes, comments, fantastic ideas, etc.
        !          12158: to [email protected] (Larry Wall).
        !          12159:                       * * *
        !          12160: 
        !          12161: 
        !          12162: 
        !          12163: 
        !          12164: 
        !          12165: 
        !          12166: 
        !          12167: 
        !          12168: 
        !          12169: rates.
        !          12170:  * 
        !          12171:  */
        !          12172: 
        !          12173: void initialize();
        !          12174: ;
        !          12175: void modify_amoeba();
        !          12176: void them_init();
        !          12177: y_init();
        !          12178:        * * * * 
        !          12179: 
        !          12180: 
        !          12181: 
        !          12182: 
        !          12183: 
        !          12184: 
        !          12185: 
        !          12186: 
        !          12187: 
        !          12188: 
        !          12189: 
        !          12190: _init();
        !          12191: nit();
        !          12192: void finalize();
        !          12193: NIT
        !          12194: #undef INIT
        !          12195: #endif
        !          12196: #define INIT(x) = x
        !          12197: 
        !          12198: #define DOINIT
        !          12199: nit();
        !          12200:  PATCHLEVEL);
        !          12201: }
        !          12202: ZE];
        !          12203: 
        !          12204: #define MAXBDIST 40
        !          12205: EXT int xx[MAXBDIST];
        !          12206: EXT in�m@T];
        !          12207: @��[H&1;���warp/patchlevel.h   644    171      5          25  5121750237   7273 #define PATCHLEVEL 2
        !          12208: ***
        !          12209: 
        !          12210: Welcome to warp!  Please send any gripes, comments, fantastic ideas, etc.
        !          12211: to [email protected] (Larry Wall).
        !          12212:                       * * *
        !          12213: 
        !          12214: 
        !          12215: 
        !          12216: 
        !          12217: 
        !          12218: 
        !          12219: 
        !          12220: 
        !          12221: 
        !          12222: rates.
        !          12223:  * 
        !          12224:  */
        !          12225: 
        !          12226: void initialize();
        !          12227: ;
        !          12228: void modify_amoeba();
        !          12229: void them_init();
        !          12230: y_init();
        !          12231:        * * * * 
        !          12232: 
        !          12233: 
        !          12234: 
        !          12235: 
        !          12236: 
        !          12237: 
        !          12238: 
        !          12239: 
        !          12240: 
        !          12241: 
        !          12242: 
        !          12243: _init();
        !          12244: nit();
        !          12245: void finalize();
        !          12246: NIT
        !          12247: #undef INIT
        !          12248: #endif
        !          12249: #define INIT(x) = x
        !          12250: 
        !          12251: #define DOINIT
        !          12252: nit();
        !          12253:  PATCHLEVEL);
        !          12254: }
        !          12255: ZE];
        !          12256: 
        !          12257: #define MAXBDIST 40
        !          12258: EXT int xx[MAXBDIST];
        !          12259: EXT in�m@T];
        !          12260: @��[H&1;���warp/UU/myread   755    171      5         424  5162423514   6556 ans='!'
        !          12261: while expr "X$ans" : "X!" >/dev/null; do
        !          12262:     read ans
        !          12263:     case "$ans" in
        !          12264:     !)
        !          12265:        sh
        !          12266:        echo " "
        !          12267:        echo  "$rp \c"
        !          12268:        ;;
        !          12269:     !*)
        !          12270:        set `expr "X$ans" : "X!\(.*\)$"`
        !          12271:        sh -c "$*"
        !          12272:        echo " "
        !          12273:        echo  "$rp \c"
        !          12274:        ;;
        !          12275:     esac
        !          12276: done
        !          12277: rp='Your answer:'
        !          12278: case "$ans" in
        !          12279: '') ans="$dflt";;
        !          12280: esac
        !          12281: �m@���}:{��y��1;:��warp/UU/filexp   755    171      5        1126  5162423565   6612 : use /bin/sh
        !          12282: : expand filename
        !          12283: case "$1" in
        !          12284: ~/*|~)
        !          12285:     echo $1 | sed "s|~|${HOME-$LOGDIR}|"
        !          12286:     ;;
        !          12287: ~*)
        !          12288:     if test -f /bin/csh; then
        !          12289:        /bin/csh -f -c "glob $1"
        !          12290:        echo ""
        !          12291:     else
        !          12292:        name=`expr x$1 : '..\([^/]*\)'`
        !          12293:        dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
        !          12294:        if test ! -d "$dir"; then
        !          12295:            me=`basename $0`
        !          12296:            echo "$me: can't locate home directory for: $name" >&2
        !          12297:            exit 1
        !          12298:        fi
        !          12299:        case "$1" in
        !          12300:        */*)
        !          12301:            echo $dir/`expr x$1 : '..[^/]*/\(.*\)'`
        !          12302:            ;;
        !          12303:        *)
        !          12304:            echo $dir
        !          12305:            ;;
        !          12306:        esac
        !          12307:     fi
        !          12308:     ;;
        !          12309: *)
        !          12310:     echo $1
        !          12311:     ;;
        !          12312: esac
        !          12313: DIR}|"
        !          12314:     ;;
        !          12315: ~*)
        !          12316:     if test -f /bin/csh; then
        !          12317:        /bin/csh -f -c "glob $1"
        !          12318:        echo ""
        !          12319:     else
        !          12320:        name=`expr x$1 : '..\([^/]*\)'`
        !          12321:        dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
        !          12322:        if test ! -d "$dir"; then
        !          12323:            me=`basename $0`
        !          12324:            echo "$me: can't locate home directory for: $name" >&2
        !          12325:            exit 1
        !          12326:        fi
        !          12327:        case "$1" in
        !          12328:        */*)
        !          12329:            echo $dir/`expr x$1 : '..[^/]*/\(.*\warp/UU/grimble   644      0      1        6761  5162423567   6700 _addch.o
        !          12330: _addchnstr.o
        !          12331: _addchstr.o
        !          12332: _addnstr.o
        !          12333: _addstr.o
        !          12334: _attroff.o
        !          12335: _attron.o
        !          12336: _attrset.o
        !          12337: _beep.o
        !          12338: _bkgd.o
        !          12339: _bkgdset.o
        !          12340: _border.o
        !          12341: _box.o
        !          12342: _clear.o
        !          12343: _clrtobot.o
        !          12344: _clrtoeol.o
        !          12345: _crmode.o
        !          12346: _del_curterm.o
        !          12347: _delch.o
        !          12348: _deleteln.o
        !          12349: _echo.o
        !          12350: _echochar.o
        !          12351: _erase.o
        !          12352: _fixterm.o
        !          12353: _flash.o
        !          12354: _garbagedwin.o
        !          12355: _garbagdlins.o
        !          12356: _getch.o
        !          12357: _getstr.o
        !          12358: _halfdelay.o
        !          12359: _hline.o
        !          12360: _inch.o
        !          12361: _inchnstr.o
        !          12362: _inchstr.o
        !          12363: _innstr.o
        !          12364: _insch.o
        !          12365: _insdelln.o
        !          12366: _insertln.o
        !          12367: _insnstr.o
        !          12368: _insstr.o
        !          12369: _instr.o
        !          12370: _intrflush.o
        !          12371: _meta.o
        !          12372: _move.o
        !          12373: _mvaddchnstr.o
        !          12374: _mvaddch.o
        !          12375: _mvaddchstr.o
        !          12376: _mvaddnstr.o
        !          12377: _mvaddstr.o
        !          12378: _mvdelch.o
        !          12379: _mvgetch.o
        !          12380: _mvgetstr.o
        !          12381: _mvhline.o
        !          12382: _mvinch.o
        !          12383: _mvinchnstr.o
        !          12384: _mvinchstr.o
        !          12385: _mvinnstr.o
        !          12386: _mvinsch.o
        !          12387: _mvinsnstr.o
        !          12388: _mvinsstr.o
        !          12389: _mvinstr.o
        !          12390: _mvvline.o
        !          12391: _mvwaddchnst.o
        !          12392: _mvwaddchstr.o
        !          12393: _mvwaddch.o
        !          12394: _mvwaddnstr.o
        !          12395: _mvwaddstr.o
        !          12396: _mvwdelch.o
        !          12397: _mvwgetch.o
        !          12398: _mvwgetstr.o
        !          12399: _mvwhline.o
        !          12400: _mvwinch.o
        !          12401: _mvwinchnst.o
        !          12402: _mvwinchstr.o
        !          12403: _mvwinnstr.o
        !          12404: _mvwinsch.o
        !          12405: _mvwinsnstr.o
        !          12406: _mvwinsstr.o
        !          12407: _mvwinstr.o
        !          12408: _mvwvline.o
        !          12409: _newterm.o
        !          12410: _nl.o
        !          12411: _nocrmode.o
        !          12412: _noecho.o
        !          12413: _nonl.o
        !          12414: _noqiflush.o
        !          12415: _overlay.o
        !          12416: _overwrite.o
        !          12417: _qiflush.o
        !          12418: _refresh.o
        !          12419: _resetterm.o
        !          12420: _saveterm.o
        !          12421: _scr_init.o
        !          12422: _scr_restore.o
        !          12423: _scr_set.o
        !          12424: _scrl.o
        !          12425: _scroll.o
        !          12426: _set_curterm.o
        !          12427: _set_term.o
        !          12428: _setscrreg.o
        !          12429: _slk_init.o
        !          12430: _standend.o
        !          12431: _standout.o
        !          12432: _subpad.o
        !          12433: _timeout.o
        !          12434: _touchline.o
        !          12435: _unctrl.o
        !          12436: _vline.o
        !          12437: _waddchstr.o
        !          12438: _waddstr.o
        !          12439: _wclear.o
        !          12440: _wdeleteln.o
        !          12441: _werase.o
        !          12442: _winsertln.o
        !          12443: _winsstr.o
        !          12444: _wstandend.o
        !          12445: _wstandout.o
        !          12446: V2._sprintw.o
        !          12447: V2.__sscans.o
        !          12448: V2.makenew.o
        !          12449: V3.box.o
        !          12450: V3.initscr.o
        !          12451: V3.m_addch.o
        !          12452: V3.m_addstr.o
        !          12453: V3.m_clear.o
        !          12454: V3.m_erase.o
        !          12455: V3.m_initscr.o
        !          12456: V3.m_move.o
        !          12457: V3.m_newterm.o
        !          12458: V3.m_refresh.o
        !          12459: V3.newterm.o
        !          12460: V3.pechochar.o
        !          12461: V3.upd_old_y.o
        !          12462: V3.vidattr.o
        !          12463: V3.vidputs.o
        !          12464: V3.waddch.o
        !          12465: V3.wattroff.o
        !          12466: V3.wattron.o
        !          12467: V3.wattrset.o
        !          12468: V3.wechochar.o
        !          12469: V3.winsch.o
        !          12470: baudrate.o
        !          12471: cbreak.o
        !          12472: chkinput.o
        !          12473: clearok.o
        !          12474: copywin.o
        !          12475: curs_set.o
        !          12476: curserr.o
        !          12477: curses.o
        !          12478: def_prog.o
        !          12479: delay.o
        !          12480: delay_out.o
        !          12481: delkey.o
        !          12482: delkeymap.o
        !          12483: delscreen.o
        !          12484: delterm.o
        !          12485: delwin.o
        !          12486: derwin.o
        !          12487: doupdate.o
        !          12488: draino.o
        !          12489: dupwin.o
        !          12490: endwin.o
        !          12491: erasechar.o
        !          12492: flushinp.o
        !          12493: getattrs.o
        !          12494: getbegyx.o
        !          12495: getbkgd.o
        !          12496: getmaxyx.o
        !          12497: getparyx.o
        !          12498: getsyx.o
        !          12499: gettmode.o
        !          12500: getwin.o
        !          12501: getyx.o
        !          12502: has_ic.o
        !          12503: has_il.o
        !          12504: idcok.o
        !          12505: idlok.o
        !          12506: immedok.o
        !          12507: init_acs.o
        !          12508: init_costs.o
        !          12509: initscr.o
        !          12510: is_linetou.o
        !          12511: is_wintou.o
        !          12512: keyname.o
        !          12513: keypad.o
        !          12514: killchar.o
        !          12515: leaveok.o
        !          12516: longname.o
        !          12517: makenew.o
        !          12518: memSset.o
        !          12519: meta.o
        !          12520: mvcur.o
        !          12521: mvderwin.o
        !          12522: mvprintw.o
        !          12523: mvscanw.o
        !          12524: mvwin.o
        !          12525: mvwprintw.o
        !          12526: mvwscanw.o
        !          12527: napms.o
        !          12528: newkey.o
        !          12529: newpad.o
        !          12530: newscreen.o
        !          12531: newwin.o
        !          12532: nocbreak.o
        !          12533: nodelay.o
        !          12534: noraw.o
        !          12535: notimeout.o
        !          12536: outch.o
        !          12537: overlap.o
        !          12538: pechochar.o
        !          12539: pnoutref.o
        !          12540: prefresh.o
        !          12541: printw.o
        !          12542: putp.o
        !          12543: putwin.o
        !          12544: quick_echo.o
        !          12545: raw.o
        !          12546: redrawwin.o
        !          12547: reset_sh.o
        !          12548: resetty.o
        !          12549: restart.o
        !          12550: ring.o
        !          12551: ripoffline.o
        !          12552: savetty.o
        !          12553: scanw.o
        !          12554: scr_all.o
        !          12555: scr_dump.o
        !          12556: scr_ll_dump.o
        !          12557: scr_reset.o
        !          12558: scrollok.o
        !          12559: setcurscreen.o
        !          12560: setcurterm.o
        !          12561: setecho.o
        !          12562: setkeymap.o
        !          12563: setnonl.o
        !          12564: setqiflush.o
        !          12565: setsyx.o
        !          12566: setterm.o
        !          12567: setupterm.o
        !          12568: slk_atroff.o
        !          12569: slk_atron.o
        !          12570: slk_atrset.o
        !          12571: slk_clear.o
        !          12572: slk_label.o
        !          12573: slk_noutref.o
        !          12574: slk_refresh.o
        !          12575: slk_restore.o
        !          12576: slk_set.o
        !          12577: slk_start.o
        !          12578: slk_touch.o
        !          12579: subwin.o
        !          12580: syncok.o
        !          12581: tcsearch.o
        !          12582: termattrs.o
        !          12583: termcap.o
        !          12584: termerr.o
        !          12585: termname.o
        !          12586: tgetch.o
        !          12587: tgoto.o
        !          12588: tifget.o
        !          12589: tifnames.o
        !          12590: tiget.o
        !          12591: tinames.o
        !          12592: tinputfd.o
        !          12593: tnames.o
        !          12594: touchwin.o
        !          12595: tparm.o
        !          12596: tputs.o
        !          12597: trace.o
        !          12598: tstp.o
        !          12599: ttimeout.o
        !          12600: typeahead.o
        !          12601: unctrl.o
        !          12602: ungetch.o
        !          12603: untouchwin.o
        !          12604: vidputs.o
        !          12605: vidupdate.o
        !          12606: vsscanf.o
        !          12607: vwprintw.o
        !          12608: vwscanw.o
        !          12609: waddch.o
        !          12610: waddchnstr.o
        !          12611: waddnstr.o
        !          12612: wattroff.o
        !          12613: wattron.o
        !          12614: wattrset.o
        !          12615: wbkgd.o
        !          12616: wbkgdset.o
        !          12617: wborder.o
        !          12618: wclrtobot.o
        !          12619: wclrtoeol.o
        !          12620: wdelch.o
        !          12621: wechochar.o
        !          12622: wgetch.o
        !          12623: wgetstr.o
        !          12624: whline.o
        !          12625: winch.o
        !          12626: winchnstr.o
        !          12627: winchstr.o
        !          12628: winnstr.o
        !          12629: winsch.o
        !          12630: winsdelln.o
        !          12631: winsnstr.o
        !          12632: winstr.o
        !          12633: wmove.o
        !          12634: wnoutref.o
        !          12635: wprintw.o
        !          12636: wredrawln.o
        !          12637: wrefresh.o
        !          12638: wscanw.o
        !          12639: wscrl.o
        !          12640: wsetscrreg.o
        !          12641: wsyncdown.o
        !          12642: wsyncup.o
        !          12643: wtimeout.o
        !          12644: wtouchln.o
        !          12645: wvline.o
        !          12646: can_change.o
        !          12647: color_cont.o
        !          12648: init_color.o
        !          12649: init_pair.o
        !          12650: has_colors.o
        !          12651: pair_cont.o
        !          12652: start_col.o
        !          12653: update.o
        !          12654: vsscanwarp/UU/core   644      0      1      220000  5162423605   6220 �[��&�"��&Р�Р�Р�   �<�Аc��U��I��U���U�@(�����&Р�Р�Р�&����0�Ѐ
Р��� �����f�����I���Ѐ
��     �����f�����I����@������<(�h^��u����0��@� �&<  �lw�0��X��0���u�h     ��]�0�Р�И�        �$�
        !          12655: ��������x �&�x     �&��&�`&`&����     �     ��������j&�X&+&м���H��n#���Ѐ
�N#��n#����
        !          12656: �+&�$&�G�g$м��(��N#�����G��G�D
        !          12657: ��"��G�*�x
        !          12658: �F���G��(�d�@��x
        !          12659: �v��*�d��
        !          12660: ���*��*�d�(��$��/shliblibc_s�����Є9�&���
        !          12661: �;core�G��
        !          12662: �&�(r�(r�D�+��0�d��f��f�
        !          12663: core3009����
        !          12664: �H��/usrbinawkb/libjobs.a��        �h�
        !          12665: �D�
        !          12666: ���b��]B�v&�[����$��&�f'&�$��&��&��`&�`&���v&�p�T���&f'&�X&�&����Є@Ѐ&��cР�]B�lU)�������    �\���f�(���I�(�Ѐ
�
�������&� &����&��&��`&�`&��     �<���f��c��I��c�@��c�d
�<(�h^�� �����f�����I���Ѐ
�����
�<(�h^��u����0��@� �&�
�lw�0��X��0���u� ��]�0�Р�И�     �$�
        !          12667: ��f�4�]B��&З�xL��&���L��&��&��`&+&�r��F�g$�Si�9Є�])�(���!�ШF�(r�N#��F����"ШF�(r��,�ШFИ_�h��(r��_гn#�+&�r��F�g$И_�(rШFИ_�H�����(��fЈ3�(r��9i�9�x�A�(r��f��f�
        !          12668: �����fЌ�K>�
        !          12669: ��{��8�  �8� ����&д�$����       J&���������
        !          12670: o���awk $6 != "" {print substr($6,2,100)} le ��8�      �8�
        !          12671: Ш�|�t��&&&�f�H��@�&*���
        !          12672: �libc_s9300����@�H@&��B`&�&�J&"� x܇`=&&H&hyZ&&H&h     @�&&�J&!awkym29300�'�)�!�&2 2��� �hI���meI���]��\*X&�&�&�C��G�4D�&�`&�`&�`& B!&�f�H&�
�༔��f�`&X&`&`&@&h��������������������������������������������������������������������������������������������������������������������������������X&&�&�\X&&�&�����������|&��@�������&&& &0&1&2&4&5&7&8&<&(+-/I&J&K&L&{��������&������������'&g;g��������1&g;g��������W&g;g��������X&g;g��������f&g;g��������i&g;g���������&g;g���������;g���������&g;g���������&g;g���������)g���������)g���������&g;g���������&g;g���������&g;g����7!#ECD����"�������-.�0.�r%&Rs�CD(+�7�,)�7�RIG�
�B9@>'?�AB����@;1�Az^q�x<=����7�wl/��tMLfKFighYjX2  W$��&^��8����7�����^���7-.�V�b��^����_`cdeZ[\]7��*b!#r^"ks�-.�� %&_`cdeZ[\]nopmb!#"7" %&q�� %&_`cde�Z[\]��b!#7"��� %&_`cdeZ[\]^Tb!#7y"�� %&_`cdeZ[\]7^!#
        !          12673: "bU %&!#�"_` %&�!#7�"�b %&�nopm�����_`cdeZ[\]7b!#7" %&_`cdeZ[\]7!#�"�+ %&b7y�!#53"_` %&���!�"7� %&�!#"� %&7�!#" %&7�7�!#53"!#" %&*7� %&7�!#" %&7�!#" %&7y7�!#!#"" %& %&7�7�!#r"!#s" %&� %&J!#!#"qr"s %&� %&!#"!#" %&q %&!#" %&�!#!#"" %&�� %&���!#!#"" %& %&nopm���!#"6 %&66PQ6�nopm���666666664NO66S666666646{|}~4a6664:H666644644u4v4444664�������44�HH444444��44�������������$�����������������������������������������������������������������IHFE���������������������������&��������������������������������9/z&)�����������������������������������������������������J&J&�������M���������������CA#h�������8�������5������������������������������������������""�������������r��t5OC(����������������M�����������������&�����������������������������������������������J&�������������������������������������������������&3����������������4/z&)�����������&���������������������������������������'���!��������� ���J&���J&���J&���������~B//sF�9(}�|�{8C6z-4&y1��&xv&&

        !          12674: 
        !          12675: 
        !          12676:                     &     &  


     
&&&       &     &�����������&&����&{��������&����{����������������/����(0&��������8&4&&5& &7&-+I&J&1&<&2&����K&L&����&����&;{.&/&{,��������:&����9&����(������������������������+-*/%I&J&-&(������������((((����������������[����}��������������������&&'&(&)&{&&����&!&#&$&��������������������}����@&=&>&?&^$(������������))))������������������������)����,,��������������������������������������������������������������������(((}}{/;&����B&C&D&����)��������),,,]����"&����}����9&|������������������������(0&��������2&��������)����2&������������&��������.&/&)������������������������);%&},),))������������)��������;2&��������;����)))����)����)����������������������������Bu&C<uDEFGP7 !"J����A`auu����8 GFE56%HI1234t��������muJJfh����
����>@RSTUVW^+_,-./09#ijlnoqr����ce����=uQYZ[\$KLM����;psNO����X]k:bd;;?')*     
        !          12677: v��������;&(;����;����y����xw�����k,k,<Xt<Xt�kkkk��44Ldkk���8Pp����(D`|�����k0kkLl����,�       kkkkkT �     �     kk� � �     �     
        !          12678: $
        !          12679: @
        !          12680: \
        !          12681: x
        !          12682: �
        !          12683: �
        !          12684: 0kk�
        !          12685: �
        !          12686: �
        !          12687: �
        !          12688: ,k8Xxk�����, Dhyacc stack overflowsyntax errorbailing out$zero&null$record$record$record$recordillegal statement@�@&~~ (08@HPdx������,@Th|����4h������������0DLT\dx����,~D\������������� ����0H`��$�@�>>#
        !          12689: >:>;>>>>>>>>>>>>>>9>9>9>9>9>>9>9>9>9>9>9>9>9>9>9>9>>!>>>&#;>XPOXX\[\Z\NMINFNGNCNBNENLNAN?NNHNDN=<
        "99999999999&92999999999 QWTVRUSY@KK999999979%9996995999999999999'9)9999(99998999J99*999199,9/999$999949-99099939.9+9=9
O=>a9:
O
P'k4}4~6SS;V4}6=;6�9SS
OXZ !QU"#=W$9]
O[Yb c#g%$h&\\\\\\\\\\%i'&j?@g�<()h�*+,,q-67.</)m0?@1!d!e(l2+p/v0w2{3453|R*n8K�-r.t*o-sAj�.ul�\`m�n�p�AB !1x1yo�#q�1z$s�t�o�u�8�v�w�y�%z�&x�8�8�C\`s�x�DEFG'{�HIA��()��*+,��-����.��/J0AS1������2��8���C345DEFG����HI��<�S8�KL��M��������������J����TTTTTTTTTT������L�����������N��L�Lk����KL^M__________����<�������<�`<�N<�L�<�<�"f"f"f"f"f"f"f"f"f"fL�`"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f"f?�?�?�?�?�?�?�TTTTTTTTTTTTTTTTTTTT^^^^^^^^^^^^^^^^^^^^`�`�^``�`�`�`�`�`�`�`�`�`�����������������������������������������^`���������������������A@�A@�A@|>@Q@\A@�@@0Q@tA@�@@HQ@�A@�A@�<@�;@xQ@LA@�A@�Q@�A@�:@�A@�:@�A@�:@�A@�:@�A@�:@�A@�:@�G@�:@�A@�:@�A@;@�A@;@�A@;@�A@;@�B@$;@�A@,;@�H@4;@�A@@;@B@H;@B@T;@LC@`;@�I@l;@�A@�R@x;@�A@�R@�;@<B@�R@�;@�A@�R@�;@�A@�;@�A@�R@�;@�A@�R@�;@<B@�R@�;@�A@�R@�;@�A@�R@�;@�B@�R@�;@�B@�R@�;@4B@�R@<@�A@�R@<@C@�R@<@,B@�R@(<@�A@4<@�A@<<@�A@H<@B@T<@�A@`<@4<@l<@�A@x<@�A@�<@�A@�<@�G@�<@�A@�<@�A@�<@�J@�<@�A@�<@�A@�<@�A@�<@�A@�<@�A@�<@�A@�<@�A@�<@�A@=@�A@=@�A@=@�A@$=@�B@0=@T9@<=@�A@D=@�A@P=@�A@\=@�A@d=@�A@l=@�A@t=@DB@|=@M@�=@�A@�=@�A@�=@�A@�=@�A@�=@�A@�=@�A@�=@�A@�=@D@8R@�=@�A@�=@dM@�=@�A@PR@�=@N@�A@�=@�A@�=@�A@�=@�A@�=@�A@>@�A@�R@>@\B@�R@>@�B@�R@>@�A@�R@$>@�C@�R@0>@�A@8>@C@�R@@>@�B@�R@H>@�B@�R@P>@\C@�R@X>@�B@�R@`>@C@�R@h>@�A@�R@p>@�C@�R@|>@dC@�R@�>@�C@�R@�>@4C@�R@�>@�C@�R@�>@�C@�R@�>@tC@�R@�>@D@�R@�>@<D@�R@�>@�A@�>@�A@dS@�A@�>@�A@|S@�A@�S@�A@�>@�A@�>@�A@�>@�A@�>@�A@�>@�A@?@�A@?@�A@?@�A@?@�A@ ?@�A@(?@dN@0?@�N@�A@�W@8?@\E@�R@@?@�A@�R@H?@�E@�R@T?@�D@�R@\?@LD@�R@d?@�D@�R@l?@dD@�R@t?@�A@�R@|?@�A@�R@�?@�D@�R@�?@E@�R@�?@�A@�R@�?@E@�R@�?@�A@�R@�?@�D@�R@�?@�D@�R@�?@lE@�R@�?@tE@�R@�?@4E@�R@�?@lE@�R@�?@�E@�R@�?@O@�F@�R@�?@�F@�R@@@�E@�R@@@�E@�R@@@�A@�R@@@�A@�R@(@@�E@�R@4@@�E@�R@<@@�E@�R@D@@�A@�R@L@@�E@�R@X@@F@�R@`@@LF@�R@h@@�A@�R@p@@$F@�R@|@@�F@�R@�@@�A@�@@�A@�R@�@@lG@�R@�@@�A@�R@�@@tF@�R@�@@|F@�R@�@@�A@�R@�@@�F@�R@�@@�F@�R@�@@�A@�R@�@@|F@�R@�@@�F@�R@�@@�A@�R@A@|H@�R@A@�F@�R@A@�G@�R@A@�A@�R@$A@�A@�R@0A@�G@�R@<A@�A@�R@DA@�A@�R@PA@�G@�R@\A@�A@�R@dA@�A@�R@pA@�A@�R@|A@�P@Q@&&&&&&&&    
        !          12690: &&&&&&&&&&&&&&&&&&&&&  &&&&&&&&&&&&&&&0000000000&&&&&&&AAAAAAAAAAAAAAAAAAAAAAAAAA&&&&A&AAAAAAAAAAAAAAAAAAAAAAAAAA&&&&&&`�@}$record%onewline in regular expressionnewline in stringstring too longnewline in character classstring too longbad switch yylook %d�#�#�#�#L$X$h$$unknown type %d in penter
        !          12691: unknown type %d in freetrregular expression too long
        !          12692: unknown type %d in cfollunknown type %d in first
        !          12693: awk: Usage: awk [-f source | 'cmds'] [files]
        !          12694: rcan't open %s-d-S-Rnot restored
        !          12695: awk.outnot saved
        !          12696: �_@&&�_@&�_@&`@&`@&      `@&`@&`@&`@     &`@
        !          12697: &`@&$`@&+`@
&/`@&5`@&:`@&A`@&E`@&L`@&S`@&Y`@&_`@&f`@&l`@&r`@&w`@&~`@&�`@&�`@&�`@&�`@&�`@ &�`@!&�`@"&�`@#&�`@$&�`@%&�`@&&�`@'&�`@(&�`@)&�`@*&�`@+&�`@,&�`@-&�`@.&�`@/&�`@0&�`@1&a@2&a@3&
        !          12698: a@4&a@5&a@6&a@7&$a@8&,a@9&2a@:&:a@;&=a@<&Da@=&Ha@>&La@?&Qa@@&Va@A&Za@B&_a@C&da@D&ja@E&sa@F&{a@G&�a@H&�a@I&�a@J&�a@K&�a@L&�a@M&�a@N&�a@O&�a@P&�a@Q&�a@R&�a@S&�a@T&FIRSTTOKENFINALFATALLTLEGTGEEQNEMATCHNOTMATCHAPPENDADDMINUSMULTDIVIDEMODUMINUSASSIGNADDEQSUBEQMULTEQDIVEQMODEQJUMPXBEGINXENDNLPRINTPRINTFSPRINTFSPLITIFELSEWHILEFORINNEXTEXITBREAKCONTINUEPROGRAMPASTATPASTAT2ASGNOPBORANDNOTNUMBERVARARRAYFNCNSUBSTRLSUBSTRINDEXGETLINERELOPMATCHOPORSTRINGDOTCCLNCCLCHARCATSTARPLUSQUESTPOSTINCRPREINCRPOSTDECRPREDECRINCRDECRFIELDINDIRECTJUMPTRUEJUMPFALSEPUSHGETRECNEWSTATIN_INITIN_EXITLASTTOKENlex: %c
        !          12699: lex:? %o
        !          12700: lex: %s
        !          12701: lex:? %o
        !          12702: �@�00$zero&null$recordFS RS
        !          12703: OFS ORS
        !          12704: OFMT%.6gFILENAMENFNRout of space in makesymtabsymbol table overflow at %sillegal reference to array %sfunny variable %o: %s %s %g %ocan't set $0illegal reference to array %sfunny variable %o: %s %s %g %ocan't set $0illegal reference to array %sfunny variable %o: %s %s %g %oillegal reference to array %sfunny variable %o: %s %s %g %o%.20gout of space in tostring on %s0�@��@&&Dq@��@&&��@&&��@�?&&��@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&�?�@�wq@$recordrcan't open %srecord `%.20s...' too longrecord `%.20s...' has too many fieldsrecord `%.20s...' has too many fieldsNFfield %d: |%s|
        !          12705: built giant record `%.20s...'trying to access field %dawk: %s near line %d
        !          12706: awk: 
        !          12707:  record number %g
        !          12708: ��@&Dr@dr@�r@�r@�r@&�r@&�@��F�FG�F�F�F�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�K�O�O�O�O$PxP�R�R�R�R�R0^�]8^@^illegal statement %ounexpected break, continue or nextunexpected break, continue or nextunknown boolean operator %dunknown relational operator %dout of temporaries in gettempsubstr: m=%d, n=%d, s=%s
        !          12709: format item %.20s... too long%snot enough arguments in printf(%s)division by zerodivision by zeroillegal arithmetic operator %ddivision by zerodivision by zeroillegal assignment operator %d%ssplit: s=|%s|, a=%s, sep=|%c|
        !          12710: %d%d%s is not an arrayillegal jump type %dillegal function type %dstring %.20s ... too long to print%stoo many output files %dwawcan't open file %s%sout of space in nodealloc$record�`�`�`�E�E�E�E�E�EDD�`�N�N�N�N�N�N�Q�Q�Q�Q�Q�Q�`�`�`�`�_V|N�V�Y�`HZH[�\�]�]�]�]<A�T$U�`�D�D�D�`�` C`^$H�`4J�B�`�`�`�`�`�`�`�`�S�`�`�`�P�P�P�P�`�`�`�G�`�`�`�`�`�`�`8{@9{@:{@;{@?{@D{@H{@M{@R{@W{@[{@`{@a{@e{@i{@m{@q{@u{@x{@|{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@�{@|@&|@|@|@|@|@|@|@"|@#|@$|@%|@&|@'|@(|@)|@*|@,|@-|@.|@/|@2|@5|@8|@;|@<|@=|@>|@A|@B|@C|@D|@E|@F|@G|@ <  <=  >  >=  ==  !=  ~  !~  +  -  *  /  %  - =  +=  -=  *=  /=  %= printprintfsprintf splitif(while(for(instatnextexitbreakcontinueL&L&L& ||  &&  !L&fncnsubstrsindexgetline ++++----$(empty restore file
        !          12711: Unknown error: 
        !          12712: �~@�~@�~@�~@�~@@@(@:@L@\@o@�@�@�@�@�@�@�@�@�@�@�@/�@C�@W�@h�@w�@��@��@��@��@Ѐ@܀@�@�@�@2�@N�@g�@v�@��@��@��@Ձ@�@�@"�@+�@4�@=�@U�@l�@��@��@��@��@ɂ@ނ@�@��@�@�@$�@<�@Z�@p�@��@��@��@��@у@��@�@�@�@�@�@*�@3�@<�@W�@t�@��@��@ׄ@��@5�@\�@e�@n�@w�@��@��@��@��@��@��@��@��@ȅ@х@ۅ@�@�@��@�@
�@�@!�@+�@5�@?�@I�@S�@]�@g�@q�@{�@��@��@��@��@��@��@��@ˆ@Ն@߆@�@�@��@�@�@�@%�@>�@H�@X�@f�@u�@��@��@�Error 0Not ownerNo such file or directoryNo such processInterrupted system callI/O errorNo such device or addressArg list too longExec format errorBad file numberNo child processesNo more processesNot enough spacePermission deniedBad addressBlock device requiredDevice busyFile existsCross-device linkNo such deviceNot a directoryIs a directoryInvalid argumentFile table overflowToo many open filesNot a typewriterText file busyFile too largeNo space left on deviceIllegal seekRead-only file systemToo many linksBroken pipeArgument out of domainResult too largeNo message of desired typeIdentifier removedChannel number out of rangeLevel 2 not synchronizedLevel 3 haltedLevel 3 resetLink number out of rangeProtocol driver not attachedNo CSI structure availableLevel 2 haltedDeadlock situation detected/avoidedNo record locks availableError 47Error 48Error 49Bad exchange descriptorBad request descriptorMessage tables fullAnode table overflowBad request codeInvalid slotFile locking deadlockBad font file formatError 58Error 59Not a stream deviceNo data availableTimer expiredOut of stream resourcesMachine is not on the networkPackage not installedObject is remoteLink has been severedAdvertise errorSrmount errorCommunication error on sendProtocol errorError 72Error 73Multihop attemptedError 75Error 76Not a data messageError 78Error 79Name not unique on networkFile descriptor in bad stateRemote address changedCan not access a needed shared libraryAccessing a corrupted shared library.lib section in a.out corruptedAttempting to link in more shared libraries than system limitCan not exec a shared library directlyError 87Error 88Error 89Error 90Error 91Error 92Error 93Error 94Error 95Error 96Error 97Error 98Error 99Error 100Error 101Error 102Error 103Error 104Error 105Error 106Error 107Error 108Error 109Error 110Error 111Error 112Error 113Error 114Error 115Error 116Error 117Error 118Error 119Error 121Error 122Error 123Error 124Error 125Error 126Error 127Error 128Error 129Error 130Error 131Error 132Error 133Error 134Structure needs cleaningError 136Not a name fileNot availableIs a name fileremote i/o errorreserved for future useError 142/bin/shsh-cgmdmdmdm�mgm�m�m�m�m�mpm�m�m�m�m�mgm�m�m|m�@�         (((((                  H����������������&&&&&&&&&&&&&&&&&&&&������ &  
        !          12713: 
 !"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~&CHRCLASSascii/lib/chrclass/��@��@&&��@��@��@��@��@�@��@�@������loglog10: DOMAIN error
        !          12714: : SING error
        !          12715: �@�sqrtsqrt: DOMAIN error
        !          12716: �;f��F>�?�qmD�C���qmD�C��&�9��B.�@�9��B.�@�����������G��+eG�?�?�;f���?�@�exp�?�@��?0C0C0C�?�@�)��@{��@))(�@,T�@,��@)&/i��K������P�@��@&&,�@D�@��@t�@�@4�@��@��@d�@d�@&Q@ &0trb��dS@hU@hU@XY@�Y@TZ@,�@,�@@<@&��L�@<�@|�@��@��@�@p�@��@�@��@d�@&<��# 1 "/tmp/Cppsym9300"#1"/tmp/Cppsym9300"&&# 1 "/tmp/Cppsym9300"
        !          12717: exit 1
        !          12718: ��@0��@��@��@��@0��@��@�@��@
�@$zero&null-�@0�@��@9�@$recordA�@ a�@d�@<�@i�@FSq�@
        !          12719: ��@��@l�@��@��@RS��@ ��@��@��@��@OFS��@
        !          12720: ��@��@��@��@ORS�@%.6g%�@(�@��@1�@OFMTQ�@T�@<��a�@FILENAME��@��@@��@��@NF��@��@�?�@��@NR��@&&�d@��@��@&��@��@    ��@��@ &�@&��@�@     &��@��@)�@&&�d@I�@&L�@@
        !          12721: Q�@2a�@&,�@��@&��@Y@
        !          12722: ��@100��@&d�@��@5&�@T�@��@��@&��@��@+&�@��@�@*&��@��@�@$HA��
        !          12723: 2@d�@�`��@��$��@@2@$���I��@$Hd22|�@@���@��@5&��@��@T���_��@�_t�@�K@�J@p����� EK�F&��@�?d�@�q@0 �@�"`d�@�q@�E�E�����Ʒ@ŭ@@@d�@�;&��@�d@�d@,d@���`�E4��S@��@�@�d@�E�F��@�@�E��@0�@p���@��@&��@Dr@���U��@�T����@��@+&��@��@����A��@<A����@��@*&�J@�����#@��@����.��@�K@�J@������<��<��b��p��w�����������������-k$6 != "" {print substr($6,2,100)}HOME=/usr/bobHZ=100LOGNAME=bobMAIL=/usr/mail/bobPATH=.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etcPS1=# TERM=vt100TZ=CST6CDTwarp/config.sh   644    171      5        3227  5162423673   6651 : use /bin/sh
        !          12724: # config.sh
        !          12725: # This file was produced by running the Configure script.
        !          12726: 
        !          12727: d_eunice='/*undef'
        !          12728: eunicefix=':'
        !          12729: define='define'
        !          12730: loclist='
        !          12731: expr
        !          12732: sed
        !          12733: echo
        !          12734: cat
        !          12735: rm
        !          12736: mv
        !          12737: cp
        !          12738: tr
        !          12739: mkdir
        !          12740: sort
        !          12741: uniq
        !          12742: grep
        !          12743: '
        !          12744: expr='expr'
        !          12745: sed='sed'
        !          12746: echo='echo'
        !          12747: cat='cat'
        !          12748: rm='rm'
        !          12749: mv='mv'
        !          12750: cp='cp'
        !          12751: tail=''
        !          12752: tr='tr'
        !          12753: mkdir='mkdir'
        !          12754: sort='sort'
        !          12755: uniq='uniq'
        !          12756: grep='grep'
        !          12757: trylist='
        !          12758: test
        !          12759: egrep
        !          12760: Mcc
        !          12761: '
        !          12762: test='test'
        !          12763: inews=''
        !          12764: egrep='/usr/bin/egrep'
        !          12765: more=''
        !          12766: pg=''
        !          12767: Mcc='Mcc'
        !          12768: vi=''
        !          12769: mailx=''
        !          12770: Log='$Log'
        !          12771: Header='$Header'
        !          12772: cc='cc'
        !          12773: contains='grep'
        !          12774: cpp='cc -E'
        !          12775: d_charsprf='/*undef'
        !          12776: d_fcntl='define'
        !          12777: d_ftime='define'
        !          12778: d_gethname='/*undef'
        !          12779: d_douname='define'
        !          12780: d_phostname='/*undef'
        !          12781: d_getpwent='/*undef'
        !          12782: d_havetlib='define'
        !          12783: termlib='-lcurses'
        !          12784: d_index='define'
        !          12785: d_ioctl='define'
        !          12786: d_normsig='define'
        !          12787: jobslib=''
        !          12788: d_portable='define'
        !          12789: d_rdchk='/*undef'
        !          12790: d_scorfl='/*undef'
        !          12791: d_sgndchr='define'
        !          12792: d_termio='define'
        !          12793: d_usendir='define'
        !          12794: d_libndir='/*undef'
        !          12795: ndirc='ndir.c'
        !          12796: ndiro='ndir.o'
        !          12797: d_whoami='/*undef'
        !          12798: hostname='mwcsales'
        !          12799: phostname='hostname'
        !          12800: mydomain='.uucp'
        !          12801: libc='/lib/libc.a'
        !          12802: libnm='/usr/lib/libtermlib.a'
        !          12803: mansrc='/usr/man/man1'
        !          12804: manext='1'
        !          12805: models='none'
        !          12806: split=''
        !          12807: small=''
        !          12808: medium=''
        !          12809: large=''
        !          12810: huge=''
        !          12811: ccflags=''
        !          12812: ldflags=''
        !          12813: n=''
        !          12814: c='\c'
        !          12815: nametype='bsd'
        !          12816: d_passnames='define'
        !          12817: d_berknames='define'
        !          12818: d_usgnames='/*undef'
        !          12819: passcat='cat /etc/passwd'
        !          12820: package='warp'
        !          12821: prefshell='/bin/sh'
        !          12822: randbits='23'
        !          12823: registers='6'
        !          12824: reg1='register'
        !          12825: reg2='register'
        !          12826: reg3='register'
        !          12827: reg4='register'
        !          12828: reg5='register'
        !          12829: reg6='register'
        !          12830: reg7=''
        !          12831: reg8=''
        !          12832: reg9=''
        !          12833: reg10=''
        !          12834: reg11=''
        !          12835: reg12=''
        !          12836: reg13=''
        !          12837: reg14=''
        !          12838: reg15=''
        !          12839: reg16=''
        !          12840: rootid='0'
        !          12841: spitshell='cat'
        !          12842: shsharp='true'
        !          12843: sharpbang=': use '
        !          12844: startsh=': use /bin/sh'
        !          12845: voidflags='7'
        !          12846: bin='/usr/games'
        !          12847: chowner='daemon'
        !          12848: privlib='/usr/games/lib/warp'
        !          12849: CONFIG=true
        !          12850: '
        !          12851: d_passnames='define'
        !          12852: d_berknames='define'
        !          12853: d_usgnames='/*undef'
        !          12854: passcat='cat /etc/passwd'
        !          12855: package='warp'
        !          12856: prefshell='/bin/sh'
        !          12857: randbits='23'
        !          12858: registers='6'
        !          12859: reg1='register'
        !          12860: reg2='register'
        !          12861: reg3='register'
        !          12862: reg4='register'
        !          12863: reg5='register'
        !          12864: reg6='register'
        !          12865: reg7=''
        !          12866: reg8=''
        !          12867: reg9=''
        !          12868: reg10=''
        !          12869: reg11=''
        !          12870: reg12=''
        !          12871: reg13=''
        !          12872: reg14=''
        !          12873: reg15=''
        !          12874: reg16=''
        !          12875: rootid='0'
        !          12876: spitshell='cawarp/Makefile   644    171      5       32120  5162431313   6510 # $Header: Makefile.SH,v 7.0.1.1 86/12/12 16:54:03 lwall Exp $
        !          12877: #
        !          12878: # $Log:        Makefile.SH,v $
        !          12879: # Revision 7.0.1.1  86/12/12  16:54:03  lwall
        !          12880: # Frozen for net release.
        !          12881: # 
        !          12882: # Revision 7.0  86/10/08  15:11:42  lwall
        !          12883: # Split into separate files.  Added amoebas and pirates.
        !          12884: # 
        !          12885: #
        !          12886: CC = cc
        !          12887: bin = /usr/games
        !          12888: mansrc = /usr/man/man1
        !          12889: manext = 1
        !          12890: CFLAGS =  -O
        !          12891: LDFLAGS = 
        !          12892: CHOWNER = daemon
        !          12893: privlib = /usr/games/lib/warp
        !          12894: NDIRC = ndir.c
        !          12895: NDIRO = ndir.o
        !          12896: LARGE =  
        !          12897: SMALL = 
        !          12898: 
        !          12899: libs =  -lcurses  /usr/lib/libtermlib.a -lm
        !          12900: 
        !          12901: public = warp
        !          12902: private = warp.doc smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
        !          12903: manpages = warp.man
        !          12904: util = Makefile makedepend makedir smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
        !          12905: 
        !          12906: sh = Makefile.SH makedepend.SH makedir.SH
        !          12907: 
        !          12908: h1 = bang.h init.h intrp.h move.h ndir.h
        !          12909: h2 = patchlevel.h object.h play.h score.h
        !          12910: h3 = sig.h term.h them.h us.h
        !          12911: h4 = util.h version.h warp.h weapon.h
        !          12912: 
        !          12913: h = $(h1) $(h2) $(h3) $(h4)
        !          12914: 
        !          12915: c1 = bang.c init.c intrp.c move.c
        !          12916: c2 = object.c play.c score.c
        !          12917: c3 = sig.c term.c them.c us.c
        !          12918: c4 = util.c version.c warp.c weapon.c
        !          12919: 
        !          12920: c = $(c1) $(c2) $(c3) $(c4) $(NDIRC)
        !          12921: 
        !          12922: obj1 = bang.o init.o intrp.o move.o
        !          12923: obj2 = object.o play.o score.o
        !          12924: obj3 = sig.o term.o them.o us.o
        !          12925: obj4 = util.o version.o warp.o weapon.o
        !          12926: 
        !          12927: obj = $(obj1) $(obj2) $(obj3) $(obj4) $(NDIRO)
        !          12928: 
        !          12929: lintflags = -phbvxac
        !          12930: 
        !          12931: add1 = Makefile.old 
        !          12932: add2 = bsd config.h config.sh eunice filexp
        !          12933: add3 = loc makedepend 
        !          12934: add4 = 
        !          12935: add5 = pdp11 warp usg v7
        !          12936: 
        !          12937: addedbyconf = $(add1) $(add2) $(add3) $(add4) $(add5)
        !          12938: 
        !          12939: # grrr
        !          12940: SHELL = /bin/sh
        !          12941: 
        !          12942: .c.o:
        !          12943:        $(CC) -c $(CFLAGS) $(LARGE) $*.c
        !          12944: 
        !          12945: all: $(public) $(private) $(util)
        !          12946:        touch all
        !          12947: 
        !          12948: warp: $(obj)
        !          12949:        $(CC) $(LDFLAGS) $(obj) $(LARGE) $(libs) -o warp
        !          12950: 
        !          12951: # if a .h file depends on another .h file...
        !          12952: $(h):
        !          12953:        touch $@
        !          12954: 
        !          12955: install: warp
        !          12956: # won't work with csh
        !          12957:        export PATH || exit 1
        !          12958:        - mv $(bin)/warp $(bin)/warp.old
        !          12959:        - if test `pwd` != $(bin); then cp $(public) $(bin); fi
        !          12960:        - cd $(bin); chmod 755 $(public); chown '$(CHOWNER)' $(public)
        !          12961:        - chmod 4711 $(bin)/warp
        !          12962:        - chmod 755 makedir
        !          12963:        - ./makedir `./filexp $(privlib)`
        !          12964:        - \
        !          12965: if test `pwd` != `./filexp $(privlib)`; then \
        !          12966: cp $(private) `./filexp $(privlib)`; \
        !          12967: fi
        !          12968:        - \
        !          12969: cd `./filexp $(privlib)`; \
        !          12970: chmod 755 $(private); \
        !          12971: chown '$(CHOWNER)' . $(private) \
        !          12972: cp /dev/null save.blurfl
        !          12973:        - \
        !          12974: if test ! -f `./filexp $(privlib)/warp.news`; then \
        !          12975: cp warp.news `./filexp $(privlib)`; \
        !          12976: fi
        !          12977:        - \
        !          12978: if test `pwd` != $(mansrc); then \
        !          12979: for page in $(manpages); do \
        !          12980: cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
        !          12981: done; \
        !          12982: fi
        !          12983: 
        !          12984: clean:
        !          12985:        rm -f core *.o
        !          12986: 
        !          12987: realclean:
        !          12988:        rm -f warp *.o core $(addedbyconf) $(util)
        !          12989: 
        !          12990: # The following lint has practically everything turned on.  Unfortunately,
        !          12991: # you have to wade through a lot of mumbo jumbo that can't be suppressed.
        !          12992: # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
        !          12993: # for that spot.
        !          12994: 
        !          12995: lint:
        !          12996:        lint $(lintflags) $(defs) $(c) > warp.fuzz
        !          12997: 
        !          12998: smap.0: smp.0 sm
        !          12999:        sm <smp.0 >smap.0
        !          13000: smap.1: smp.1 sm
        !          13001:        sm <smp.1 >smap.1
        !          13002: smap.2: smp.2 sm
        !          13003:        sm <smp.2 >smap.2
        !          13004: smap.3: smp.3 sm
        !          13005:        sm <smp.3 >smap.3
        !          13006: smap.4: smp.4 sm
        !          13007:        sm <smp.4 >smap.4
        !          13008: smap.5: smp.5 sm
        !          13009:        sm <smp.5 >smap.5
        !          13010: smap.6: smp.6 sm
        !          13011:        sm <smp.6 >smap.6
        !          13012: smap.7: smp.7 sm
        !          13013:        sm <smp.7 >smap.7
        !          13014: sm: sm.c
        !          13015:        cc sm.c $(SMALL) -o sm
        !          13016: 
        !          13017: depend: makedepend
        !          13018:        makedepend
        !          13019: 
        !          13020: clist:
        !          13021:        echo $(c) | tr ' ' '\012' >.clist
        !          13022: 
        !          13023: hlist:
        !          13024:        echo $(h) | tr ' ' '\012' >.hlist
        !          13025: 
        !          13026: shlist:
        !          13027:        echo $(sh) | tr ' ' '\012' >.shlist
        !          13028: 
        !          13029: # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
        !          13030: # If this runs make out of memory, delete /usr/include lines.
        !          13031: bang.o: /usr/include/ctype.h
        !          13032: bang.o: /usr/include/errno.h
        !          13033: bang.o: /usr/include/fcntl.h
        !          13034: bang.o: /usr/include/signal.h
        !          13035: bang.o: /usr/include/stdio.h
        !          13036: bang.o: /usr/include/sys/errno.h
        !          13037: bang.o: /usr/include/sys/fcntl.h
        !          13038: bang.o: /usr/include/sys/ioctl.h
        !          13039: bang.o: /usr/include/sys/signal.h
        !          13040: bang.o: /usr/include/sys/stat.h
        !          13041: bang.o: /usr/include/sys/termio.h
        !          13042: bang.o: /usr/include/sys/timeb.h
        !          13043: bang.o: /usr/include/sys/types.h
        !          13044: bang.o: /usr/include/termio.h
        !          13045: bang.o: EXTERN.h
        !          13046: bang.o: INTERN.h
        !          13047: bang.o: bang.c
        !          13048: bang.o: bang.h
        !          13049: bang.o: config.h
        !          13050: bang.o: move.h
        !          13051: bang.o: object.h
        !          13052: bang.o: sig.h
        !          13053: bang.o: term.h
        !          13054: bang.o: them.h
        !          13055: bang.o: warp.h
        !          13056: init.o: /usr/include/ctype.h
        !          13057: init.o: /usr/include/errno.h
        !          13058: init.o: /usr/include/fcntl.h
        !          13059: init.o: /usr/include/signal.h
        !          13060: init.o: /usr/include/stdio.h
        !          13061: init.o: /usr/include/sys/errno.h
        !          13062: init.o: /usr/include/sys/fcntl.h
        !          13063: init.o: /usr/include/sys/ioctl.h
        !          13064: init.o: /usr/include/sys/signal.h
        !          13065: init.o: /usr/include/sys/stat.h
        !          13066: init.o: /usr/include/sys/termio.h
        !          13067: init.o: /usr/include/sys/timeb.h
        !          13068: init.o: /usr/include/sys/types.h
        !          13069: init.o: /usr/include/termio.h
        !          13070: init.o: EXTERN.h
        !          13071: init.o: INTERN.h
        !          13072: init.o: bang.h
        !          13073: init.o: config.h
        !          13074: init.o: init.c
        !          13075: init.o: init.h
        !          13076: init.o: move.h
        !          13077: init.o: object.h
        !          13078: init.o: play.h
        !          13079: init.o: score.h
        !          13080: init.o: term.h
        !          13081: init.o: them.h
        !          13082: init.o: us.h
        !          13083: init.o: util.h
        !          13084: init.o: warp.h
        !          13085: init.o: weapon.h
        !          13086: intrp.o: /usr/include/ctype.h
        !          13087: intrp.o: /usr/include/errno.h
        !          13088: intrp.o: /usr/include/fcntl.h
        !          13089: intrp.o: /usr/include/signal.h
        !          13090: intrp.o: /usr/include/stdio.h
        !          13091: intrp.o: /usr/include/sys/errno.h
        !          13092: intrp.o: /usr/include/sys/fcntl.h
        !          13093: intrp.o: /usr/include/sys/ioctl.h
        !          13094: intrp.o: /usr/include/sys/signal.h
        !          13095: intrp.o: /usr/include/sys/stat.h
        !          13096: intrp.o: /usr/include/sys/termio.h
        !          13097: intrp.o: /usr/include/sys/timeb.h
        !          13098: intrp.o: /usr/include/sys/types.h
        !          13099: intrp.o: /usr/include/termio.h
        !          13100: intrp.o: EXTERN.h
        !          13101: intrp.o: INTERN.h
        !          13102: intrp.o: config.h
        !          13103: intrp.o: intrp.c
        !          13104: intrp.o: intrp.h
        !          13105: intrp.o: sig.h
        !          13106: intrp.o: term.h
        !          13107: intrp.o: util.h
        !          13108: intrp.o: warp.h
        !          13109: move.o: /usr/include/ctype.h
        !          13110: move.o: /usr/include/errno.h
        !          13111: move.o: /usr/include/fcntl.h
        !          13112: move.o: /usr/include/signal.h
        !          13113: move.o: /usr/include/stdio.h
        !          13114: move.o: /usr/include/sys/errno.h
        !          13115: move.o: /usr/include/sys/fcntl.h
        !          13116: move.o: /usr/include/sys/ioctl.h
        !          13117: move.o: /usr/include/sys/signal.h
        !          13118: move.o: /usr/include/sys/stat.h
        !          13119: move.o: /usr/include/sys/termio.h
        !          13120: move.o: /usr/include/sys/timeb.h
        !          13121: move.o: /usr/include/sys/types.h
        !          13122: move.o: /usr/include/termio.h
        !          13123: move.o: EXTERN.h
        !          13124: move.o: INTERN.h
        !          13125: move.o: bang.h
        !          13126: move.o: config.h
        !          13127: move.o: move.c
        !          13128: move.o: move.h
        !          13129: move.o: object.h
        !          13130: move.o: play.h
        !          13131: move.o: score.h
        !          13132: move.o: term.h
        !          13133: move.o: them.h
        !          13134: move.o: us.h
        !          13135: move.o: util.h
        !          13136: move.o: warp.h
        !          13137: move.o: weapon.h
        !          13138: object.o: /usr/include/ctype.h
        !          13139: object.o: /usr/include/errno.h
        !          13140: object.o: /usr/include/fcntl.h
        !          13141: object.o: /usr/include/signal.h
        !          13142: object.o: /usr/include/stdio.h
        !          13143: object.o: /usr/include/sys/errno.h
        !          13144: object.o: /usr/include/sys/fcntl.h
        !          13145: object.o: /usr/include/sys/ioctl.h
        !          13146: object.o: /usr/include/sys/signal.h
        !          13147: object.o: /usr/include/sys/stat.h
        !          13148: object.o: /usr/include/sys/termio.h
        !          13149: object.o: /usr/include/sys/timeb.h
        !          13150: object.o: /usr/include/sys/types.h
        !          13151: object.o: /usr/include/termio.h
        !          13152: object.o: EXTERN.h
        !          13153: object.o: INTERN.h
        !          13154: object.o: config.h
        !          13155: object.o: object.c
        !          13156: object.o: object.h
        !          13157: object.o: warp.h
        !          13158: play.o: /usr/include/ctype.h
        !          13159: play.o: /usr/include/errno.h
        !          13160: play.o: /usr/include/fcntl.h
        !          13161: play.o: /usr/include/signal.h
        !          13162: play.o: /usr/include/stdio.h
        !          13163: play.o: /usr/include/sys/errno.h
        !          13164: play.o: /usr/include/sys/fcntl.h
        !          13165: play.o: /usr/include/sys/ioctl.h
        !          13166: play.o: /usr/include/sys/signal.h
        !          13167: play.o: /usr/include/sys/stat.h
        !          13168: play.o: /usr/include/sys/termio.h
        !          13169: play.o: /usr/include/sys/timeb.h
        !          13170: play.o: /usr/include/sys/types.h
        !          13171: play.o: /usr/include/termio.h
        !          13172: play.o: EXTERN.h
        !          13173: play.o: INTERN.h
        !          13174: play.o: bang.h
        !          13175: play.o: config.h
        !          13176: play.o: move.h
        !          13177: play.o: object.h
        !          13178: play.o: play.c
        !          13179: play.o: play.h
        !          13180: play.o: score.h
        !          13181: play.o: term.h
        !          13182: play.o: them.h
        !          13183: play.o: us.h
        !          13184: play.o: util.h
        !          13185: play.o: warp.h
        !          13186: play.o: weapon.h
        !          13187: score.o: /usr/include/ctype.h
        !          13188: score.o: /usr/include/errno.h
        !          13189: score.o: /usr/include/fcntl.h
        !          13190: score.o: /usr/include/signal.h
        !          13191: score.o: /usr/include/stdio.h
        !          13192: score.o: /usr/include/sys/errno.h
        !          13193: score.o: /usr/include/sys/fcntl.h
        !          13194: score.o: /usr/include/sys/ioctl.h
        !          13195: score.o: /usr/include/sys/signal.h
        !          13196: score.o: /usr/include/sys/stat.h
        !          13197: score.o: /usr/include/sys/termio.h
        !          13198: score.o: /usr/include/sys/timeb.h
        !          13199: score.o: /usr/include/sys/types.h
        !          13200: score.o: /usr/include/termio.h
        !          13201: score.o: EXTERN.h
        !          13202: score.o: INTERN.h
        !          13203: score.o: config.h
        !          13204: score.o: intrp.h
        !          13205: score.o: object.h
        !          13206: score.o: play.h
        !          13207: score.o: score.c
        !          13208: score.o: score.h
        !          13209: score.o: sig.h
        !          13210: score.o: term.h
        !          13211: score.o: us.h
        !          13212: score.o: util.h
        !          13213: score.o: warp.h
        !          13214: score.o: weapon.h
        !          13215: sig.o: /usr/include/ctype.h
        !          13216: sig.o: /usr/include/errno.h
        !          13217: sig.o: /usr/include/fcntl.h
        !          13218: sig.o: /usr/include/signal.h
        !          13219: sig.o: /usr/include/stdio.h
        !          13220: sig.o: /usr/include/sys/errno.h
        !          13221: sig.o: /usr/include/sys/fcntl.h
        !          13222: sig.o: /usr/include/sys/ioctl.h
        !          13223: sig.o: /usr/include/sys/signal.h
        !          13224: sig.o: /usr/include/sys/stat.h
        !          13225: sig.o: /usr/include/sys/termio.h
        !          13226: sig.o: /usr/include/sys/timeb.h
        !          13227: sig.o: /usr/include/sys/types.h
        !          13228: sig.o: /usr/include/termio.h
        !          13229: sig.o: EXTERN.h
        !          13230: sig.o: INTERN.h
        !          13231: sig.o: config.h
        !          13232: sig.o: play.h
        !          13233: sig.o: score.h
        !          13234: sig.o: sig.c
        !          13235: sig.o: sig.h
        !          13236: sig.o: term.h
        !          13237: sig.o: util.h
        !          13238: sig.o: warp.h
        !          13239: term.o: /usr/include/ctype.h
        !          13240: term.o: /usr/include/errno.h
        !          13241: term.o: /usr/include/fcntl.h
        !          13242: term.o: /usr/include/signal.h
        !          13243: term.o: /usr/include/stdio.h
        !          13244: term.o: /usr/include/sys/errno.h
        !          13245: term.o: /usr/include/sys/fcntl.h
        !          13246: term.o: /usr/include/sys/ioctl.h
        !          13247: term.o: /usr/include/sys/signal.h
        !          13248: term.o: /usr/include/sys/stat.h
        !          13249: term.o: /usr/include/sys/termio.h
        !          13250: term.o: /usr/include/sys/timeb.h
        !          13251: term.o: /usr/include/sys/types.h
        !          13252: term.o: /usr/include/termio.h
        !          13253: term.o: EXTERN.h
        !          13254: term.o: INTERN.h
        !          13255: term.o: bang.h
        !          13256: term.o: config.h
        !          13257: term.o: intrp.h
        !          13258: term.o: object.h
        !          13259: term.o: play.h
        !          13260: term.o: score.h
        !          13261: term.o: sig.h
        !          13262: term.o: term.c
        !          13263: term.o: term.h
        !          13264: term.o: us.h
        !          13265: term.o: util.h
        !          13266: term.o: warp.h
        !          13267: term.o: weapon.h
        !          13268: them.o: /usr/include/ctype.h
        !          13269: them.o: /usr/include/errno.h
        !          13270: them.o: /usr/include/fcntl.h
        !          13271: them.o: /usr/include/signal.h
        !          13272: them.o: /usr/include/stdio.h
        !          13273: them.o: /usr/include/sys/errno.h
        !          13274: them.o: /usr/include/sys/fcntl.h
        !          13275: them.o: /usr/include/sys/ioctl.h
        !          13276: them.o: /usr/include/sys/signal.h
        !          13277: them.o: /usr/include/sys/stat.h
        !          13278: them.o: /usr/include/sys/termio.h
        !          13279: them.o: /usr/include/sys/timeb.h
        !          13280: them.o: /usr/include/sys/types.h
        !          13281: them.o: /usr/include/termio.h
        !          13282: them.o: EXTERN.h
        !          13283: them.o: INTERN.h
        !          13284: them.o: bang.h
        !          13285: them.o: config.h
        !          13286: them.o: move.h
        !          13287: them.o: object.h
        !          13288: them.o: score.h
        !          13289: them.o: term.h
        !          13290: them.o: them.c
        !          13291: them.o: them.h
        !          13292: them.o: us.h
        !          13293: them.o: util.h
        !          13294: them.o: warp.h
        !          13295: them.o: weapon.h
        !          13296: us.o: /usr/include/ctype.h
        !          13297: us.o: /usr/include/errno.h
        !          13298: us.o: /usr/include/fcntl.h
        !          13299: us.o: /usr/include/signal.h
        !          13300: us.o: /usr/include/stdio.h
        !          13301: us.o: /usr/include/sys/errno.h
        !          13302: us.o: /usr/include/sys/fcntl.h
        !          13303: us.o: /usr/include/sys/ioctl.h
        !          13304: us.o: /usr/include/sys/signal.h
        !          13305: us.o: /usr/include/sys/stat.h
        !          13306: us.o: /usr/include/sys/termio.h
        !          13307: us.o: /usr/include/sys/timeb.h
        !          13308: us.o: /usr/include/sys/types.h
        !          13309: us.o: /usr/include/termio.h
        !          13310: us.o: EXTERN.h
        !          13311: us.o: INTERN.h
        !          13312: us.o: bang.h
        !          13313: us.o: config.h
        !          13314: us.o: object.h
        !          13315: us.o: play.h
        !          13316: us.o: sig.h
        !          13317: us.o: term.h
        !          13318: us.o: us.c
        !          13319: us.o: us.h
        !          13320: us.o: util.h
        !          13321: us.o: warp.h
        !          13322: us.o: weapon.h
        !          13323: util.o: /usr/include/ctype.h
        !          13324: util.o: /usr/include/errno.h
        !          13325: util.o: /usr/include/fcntl.h
        !          13326: util.o: /usr/include/signal.h
        !          13327: util.o: /usr/include/stdio.h
        !          13328: util.o: /usr/include/sys/errno.h
        !          13329: util.o: /usr/include/sys/fcntl.h
        !          13330: util.o: /usr/include/sys/ioctl.h
        !          13331: util.o: /usr/include/sys/signal.h
        !          13332: util.o: /usr/include/sys/stat.h
        !          13333: util.o: /usr/include/sys/termio.h
        !          13334: util.o: /usr/include/sys/timeb.h
        !          13335: util.o: /usr/include/sys/types.h
        !          13336: util.o: /usr/include/termio.h
        !          13337: util.o: EXTERN.h
        !          13338: util.o: INTERN.h
        !          13339: util.o: config.h
        !          13340: util.o: ndir.h
        !          13341: util.o: object.h
        !          13342: util.o: sig.h
        !          13343: util.o: term.h
        !          13344: util.o: util.c
        !          13345: util.o: util.h
        !          13346: util.o: warp.h
        !          13347: version.o: INTERN.h
        !          13348: version.o: patchlevel.h
        !          13349: version.o: version.c
        !          13350: version.o: version.h
        !          13351: warp.o: /usr/include/ctype.h
        !          13352: warp.o: /usr/include/errno.h
        !          13353: warp.o: /usr/include/fcntl.h
        !          13354: warp.o: /usr/include/signal.h
        !          13355: warp.o: /usr/include/stdio.h
        !          13356: warp.o: /usr/include/sys/errno.h
        !          13357: warp.o: /usr/include/sys/fcntl.h
        !          13358: warp.o: /usr/include/sys/ioctl.h
        !          13359: warp.o: /usr/include/sys/signal.h
        !          13360: warp.o: /usr/include/sys/stat.h
        !          13361: warp.o: /usr/include/sys/termio.h
        !          13362: warp.o: /usr/include/sys/timeb.h
        !          13363: warp.o: /usr/include/sys/types.h
        !          13364: warp.o: /usr/include/termio.h
        !          13365: warp.o: EXTERN.h
        !          13366: warp.o: INTERN.h
        !          13367: warp.o: bang.h
        !          13368: warp.o: config.h
        !          13369: warp.o: init.h
        !          13370: warp.o: intrp.h
        !          13371: warp.o: move.h
        !          13372: warp.o: object.h
        !          13373: warp.o: play.h
        !          13374: warp.o: score.h
        !          13375: warp.o: sig.h
        !          13376: warp.o: term.h
        !          13377: warp.o: them.h
        !          13378: warp.o: us.h
        !          13379: warp.o: util.h
        !          13380: warp.o: version.h
        !          13381: warp.o: warp.c
        !          13382: warp.o: warp.h
        !          13383: warp.o: weapon.h
        !          13384: weapon.o: /usr/include/ctype.h
        !          13385: weapon.o: /usr/include/errno.h
        !          13386: weapon.o: /usr/include/fcntl.h
        !          13387: weapon.o: /usr/include/signal.h
        !          13388: weapon.o: /usr/include/stdio.h
        !          13389: weapon.o: /usr/include/sys/errno.h
        !          13390: weapon.o: /usr/include/sys/fcntl.h
        !          13391: weapon.o: /usr/include/sys/ioctl.h
        !          13392: weapon.o: /usr/include/sys/signal.h
        !          13393: weapon.o: /usr/include/sys/stat.h
        !          13394: weapon.o: /usr/include/sys/termio.h
        !          13395: weapon.o: /usr/include/sys/timeb.h
        !          13396: weapon.o: /usr/include/sys/types.h
        !          13397: weapon.o: /usr/include/termio.h
        !          13398: weapon.o: EXTERN.h
        !          13399: weapon.o: INTERN.h
        !          13400: weapon.o: bang.h
        !          13401: weapon.o: config.h
        !          13402: weapon.o: move.h
        !          13403: weapon.o: object.h
        !          13404: weapon.o: score.h
        !          13405: weapon.o: sig.h
        !          13406: weapon.o: term.h
        !          13407: weapon.o: them.h
        !          13408: weapon.o: us.h
        !          13409: weapon.o: util.h
        !          13410: weapon.o: warp.h
        !          13411: weapon.o: weapon.c
        !          13412: weapon.o: weapon.h
        !          13413: ndir.o: /usr/include/ctype.h
        !          13414: ndir.o: /usr/include/errno.h
        !          13415: ndir.o: /usr/include/fcntl.h
        !          13416: ndir.o: /usr/include/signal.h
        !          13417: ndir.o: /usr/include/stdio.h
        !          13418: ndir.o: /usr/include/sys/errno.h
        !          13419: ndir.o: /usr/include/sys/fcntl.h
        !          13420: ndir.o: /usr/include/sys/ioctl.h
        !          13421: ndir.o: /usr/include/sys/signal.h
        !          13422: ndir.o: /usr/include/sys/stat.h
        !          13423: ndir.o: /usr/include/sys/termio.h
        !          13424: ndir.o: /usr/include/sys/timeb.h
        !          13425: ndir.o: /usr/include/sys/types.h
        !          13426: ndir.o: /usr/include/termio.h
        !          13427: ndir.o: EXTERN.h
        !          13428: ndir.o: INTERN.h
        !          13429: ndir.o: config.h
        !          13430: ndir.o: ndir.c
        !          13431: ndir.o: ndir.h
        !          13432: ndir.o: warp.h
        !          13433: Makefile: Makefile.SH config.sh ; /bin/sh Makefile.SH
        !          13434: makedepend: makedepend.SH config.sh ; /bin/sh makedepend.SH
        !          13435: makedir: makedir.SH config.sh ; /bin/sh makedir.SH
        !          13436: # WARNING: Put nothing here or make depend will gobble it up!
        !          13437:  /usr/include/sys/signal.h
        !          13438: ndir.o: /usr/include/sys/stat.h
        !          13439: ndir.o: /usr/include/sys/termio.h
        !          13440: ndir.o: /usr/include/sys/timeb.h
        !          13441: ndir.o: /usr/include/sys/types.h
        !          13442: ndir.o: /usr/include/termio.h
        !          13443: ndir.o: EXTERN.h
        !          13444: ndir.o: INTERN.h
        !          13445: ndir.o: config.h
        !          13446: ndir.o: ndir.c
        !          13447: ndir.o: ndir.h
        !          13448: ndir.o: warp.h
        !          13449: Makefile: Makefile.SH config.sh ; /bin/sh Makefile.SH
        !          13450: makedepend: makedepend.SH config.sh ; /bin/sh makedepend.SH
        !          13451: makedir: makedir.SH config.sh ; /warp/makedepend   755    171      5        7127  5162423702   7067 : use /bin/sh
        !          13452: # $Header: makedepend.SH,v 7.0.1.1 86/12/12 17:00:05 lwall Exp $
        !          13453: #
        !          13454: # $Log:        makedepend.SH,v $
        !          13455: # Revision 7.0.1.1  86/12/12  17:00:05  lwall
        !          13456: # Baseline for net release.
        !          13457: # 
        !          13458: # Revision 4.3.1.2  85/05/13  15:53:42  lwall
        !          13459: # Made cpp look in /usr/local/include too.
        !          13460: # 
        !          13461: # Revision 4.3.1.1  85/05/10  11:35:10  lwall
        !          13462: # Branch for patches.
        !          13463: # 
        !          13464: # Revision 4.3  85/05/01  11:42:26  lwall
        !          13465: # Baseline for release with 4.3bsd.
        !          13466: # 
        !          13467: 
        !          13468: export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
        !          13469: 
        !          13470: cat='cat'
        !          13471: cp='cp'
        !          13472: cpp='cc -E'
        !          13473: echo='echo'
        !          13474: egrep='/usr/bin/egrep'
        !          13475: expr='expr'
        !          13476: mv='mv'
        !          13477: rm='rm'
        !          13478: sed='sed'
        !          13479: sort='sort'
        !          13480: test='test'
        !          13481: tr='tr'
        !          13482: uniq='uniq'
        !          13483: 
        !          13484: $cat /dev/null >.deptmp
        !          13485: $echo "(Note: this is going to take a while.)"
        !          13486: $rm -f *.c.c c/*.c.c
        !          13487: if test -f Makefile; then
        !          13488:     mf=Makefile
        !          13489: else
        !          13490:     mf=makefile
        !          13491: fi
        !          13492: if test -f $mf; then
        !          13493:     defrule=`<$mf sed -n               \
        !          13494:        -e '/^\.c\.o:.*;/{'             \
        !          13495:        -e    's/\$\*\.c//'             \
        !          13496:        -e    's/^[^;]*;[        ]*//p' \
        !          13497:        -e    q                         \
        !          13498:        -e '}'                          \
        !          13499:        -e '/^\.c\.o: *$/{'             \
        !          13500:        -e    N                         \
        !          13501:        -e    's/\$\*\.c//'             \
        !          13502:        -e    's/^.*\n[  ]*//p'         \
        !          13503:        -e    q                         \
        !          13504:        -e '}'`
        !          13505: fi
        !          13506: case "$defrule" in
        !          13507: '') defrule='$(CC) -c $(CFLAGS)' ;;
        !          13508: esac
        !          13509: 
        !          13510: make clist || ($echo "Searching for .c files..."; \
        !          13511:        $echo *.c */*.c | $tr ' ' '\012' | $egrep -v '\*' >.clist)
        !          13512: for file in `$cat .clist`; do
        !          13513: # for file in `cat /dev/null`; do
        !          13514:     filebase=`basename $file .c`
        !          13515:     $echo "Finding dependencies for $filebase.o."
        !          13516:     $sed -n <$file >$file.c \
        !          13517:        -e "/^${filebase}_init(/q" \
        !          13518:        -e '/^#/{' \
        !          13519:        -e 's|/\*.*$||' \
        !          13520:        -e 's|\\$||' \
        !          13521:        -e p \
        !          13522:        -e '}'
        !          13523:     $cpp -I/usr/local/include -I. -I./h $file.c | \
        !          13524:     $sed \
        !          13525:        -e '/^# *[0-9]/!d' \
        !          13526:        -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
        !          13527:        -e 's|: \./|: |' \
        !          13528:        -e 's|\.c\.c|.c|' | \
        !          13529:     $uniq | $sort | $uniq >> .deptmp
        !          13530: done
        !          13531: 
        !          13532: $sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'
        !          13533: 
        !          13534: make shlist || ($echo "Searching for .SH files..."; \
        !          13535:        $echo *.SH */*.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
        !          13536: if $test -s .deptmp; then
        !          13537:     for file in `cat .shlist`; do
        !          13538:        $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
        !          13539:            /bin/sh $file >> .deptmp
        !          13540:     done
        !          13541:     $echo "Updating Makefile..."
        !          13542:     $echo "# If this runs make out of memory, delete /usr/include lines." \
        !          13543:        >> Makefile.new
        !          13544:     $sed 's|^\(.*\.o:\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
        !          13545:        >>Makefile.new
        !          13546: else
        !          13547:     make hlist || ($echo "Searching for .h files..."; \
        !          13548:        $echo *.h */*.h | $tr ' ' '\012' | $egrep -v '\*' >.hlist)
        !          13549:     $echo "You don't seem to have a proper C preprocessor.  Using grep instead."
        !          13550:     $egrep '^#include ' `cat .clist` `cat .hlist`  >.deptmp
        !          13551:     $echo "Updating Makefile..."
        !          13552:     <.clist $sed -n                                                    \
        !          13553:        -e '/\//{'                                                      \
        !          13554:        -e   's|^\(.*\)/\(.*\)\.c|\2.o: \1/\2.c; '"$defrule \1/\2.c|p"  \
        !          13555:        -e   d                                                          \
        !          13556:        -e '}'                                                          \
        !          13557:        -e 's|^\(.*\)\.c|\1.o: \1.c|p' >> Makefile.new
        !          13558:     <.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed
        !          13559:     <.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \
        !          13560:        $sed 's|^[^;]*/||' | \
        !          13561:        $sed -f .hsed >> Makefile.new
        !          13562:     <.deptmp $sed -n 's|c:#include <\(.*\)>.*$|o: /usr/include/\1|p' \
        !          13563:        >> Makefile.new
        !          13564:     <.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
        !          13565:        $sed -f .hsed >> Makefile.new
        !          13566:     <.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
        !          13567:        >> Makefile.new
        !          13568:     for file in `$cat .shlist`; do
        !          13569:        $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
        !          13570:            /bin/sh $file >> Makefile.new
        !          13571:     done
        !          13572: fi
        !          13573: $rm -f Makefile.old
        !          13574: $cp Makefile Makefile.old
        !          13575: $cp Makefile.new Makefile
        !          13576: $rm Makefile.new
        !          13577: $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
        !          13578: $rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed
        !          13579: 
        !          13580:       $sed -f .hsed >> Makefile.new
        !          13581:     <.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
        !          13582:        >> Makefile.new
        !          13583:     for file in `$cat .shlist`; do
        !          13584:        $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
        !          13585:            /bin/sh $file >> Makefile.new
        !          13586:     done
        !          13587: fi
        !          13588: $rm -f Makefile.old
        !          13589: $cp Makefile Makefile.old
        !          13590: $cp Makefile.new Makefile
        !          13591: $rm Makefile.new
        !          13592: $echo "# WARNING: Put nothing here or make depend will gobble it uwarp/makedir   755    171      5        2036  5162423703   6401 : use /bin/sh
        !          13593: # $Header: makedir.SH,v 7.0 86/10/08 15:12:34 lwall Exp $
        !          13594: # 
        !          13595: # $Log:        makedir.SH,v $
        !          13596: # Revision 7.0  86/10/08  15:12:34  lwall
        !          13597: # Split into separate files.  Added amoebas and pirates.
        !          13598: # 
        !          13599: # Revision 4.3.1.1  85/05/10  11:35:14  lwall
        !          13600: # Branch for patches.
        !          13601: # 
        !          13602: # Revision 4.3  85/05/01  11:42:31  lwall
        !          13603: # Baseline for release with 4.3bsd.
        !          13604: # 
        !          13605: 
        !          13606: export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
        !          13607: 
        !          13608: case $# in
        !          13609:   0)
        !          13610:     echo "makedir pathname filenameflag"
        !          13611:     exit 1
        !          13612:     ;;
        !          13613: esac
        !          13614: 
        !          13615: : guarantee one slash before 1st component
        !          13616: case $1 in
        !          13617:   /*) ;;
        !          13618:   *)  set ./$1 $2 ;;
        !          13619: esac
        !          13620: 
        !          13621: : strip last component if it is to be a filename
        !          13622: case X$2 in
        !          13623:   X1) set `echo $1 | sed 's:\(.*\)/[^/]*$:\1:'` ;;
        !          13624:   *)  set $1 ;;
        !          13625: esac
        !          13626: 
        !          13627: : return reasonable status if nothing to be created
        !          13628: if test -d "$1" ; then
        !          13629:     exit 0
        !          13630: fi
        !          13631: 
        !          13632: list=''
        !          13633: while true ; do
        !          13634:     case $1 in
        !          13635:     */*)
        !          13636:        list="$1 $list"
        !          13637:        set `echo $1 | sed 's:\(.*\)/:\1 :'`
        !          13638:        ;;
        !          13639:     *)
        !          13640:        break
        !          13641:        ;;
        !          13642:     esac
        !          13643: done
        !          13644: 
        !          13645: set $list
        !          13646: 
        !          13647: for dir do
        !          13648:     mkdir $dir >/dev/null 2>&1
        !          13649: done
        !          13650: : guarantee one slash before 1st component
        !          13651: case $1 in
        !          13652:   /*) ;;
        !          13653:   *)  set ./$1 $2 ;;
        !          13654: esac
        !          13655: 
        !          13656: : strip last component if it is to be a filename
        !          13657: case X$2 in
        !          13658:   X1) set `echo $1 | sed 's:\(.*\)/[^/]*$:\1:'` ;;
        !          13659:   *)  set $1 ;;
        !          13660: esac
        !          13661: 
        !          13662: : return reasonable status if nothing to be created
        !          13663: if test -d "$1" ; then
        !          13664:     exit 0
        !          13665: fi
        !          13666: 
        !          13667: list=''
        !          13668: while true ; do
        !          13669:     case $1 in
        !          13670:     */*)
        !          13671:        list="$1 $list"
        !          13672:        set `echo $1 | sed 's:\(.*\)/:\1 :'`
        !          13673:        ;;
        !          13674:     *)
        !          13675:        break
        !          13676:        ;;
        !          13677:     esac
        !          13678: done
        !          13679: 
        !          13680: set $list
        !          13681: 
        !          13682: for dir do
        !          13683:     mkwarp/myread   755    171      1         424  5122147173   6221 ans='!'
        !          13684: while expr "X$ans" : "X!" >/dev/null; do
        !          13685:     read ans
        !          13686:     case "$ans" in
        !          13687:     !)
        !          13688:        sh
        !          13689:        echo " "
        !          13690:        echo  "$rp \c"
        !          13691:        ;;
        !          13692:     !*)
        !          13693:        set `expr "X$ans" : "X!\(.*\)$"`
        !          13694:        sh -c "$*"
        !          13695:        echo " "
        !          13696:        echo  "$rp \c"
        !          13697:        ;;
        !          13698:     esac
        !          13699: done
        !          13700: rp='Your answer:'
        !          13701: case "$ans" in
        !          13702: '') ans="$dflt";;
        !          13703: esac
        !          13704: atus if nothing to be created
        !          13705: if test -d "$1" ; then
        !          13706:     exit 0
        !          13707: fi
        !          13708: 
        !          13709: list=''
        !          13710: while true ; do
        !          13711:     case $1 in
        !          13712:     */*)
        !          13713:        list="$1 $list"
        !          13714:        set `echo $1 | sed 's:\(.*\)/:\1 :'`
        !          13715:        ;;
        !          13716:     *�m@
        !          13717:    @��[H&1;��warp/config.h   644    171      5       20254  5122143756   6502 /* config.h
        !          13718:  * This file was produced by running the config.h.SH script, which
        !          13719:  * gets its values from config.sh, which is generally produced by
        !          13720:  * running Configure.
        !          13721:  *
        !          13722:  * Feel free to modify any of this as the need arises.  Note, however,
        !          13723:  * that running config.h.SH again will wipe out any changes you've made.
        !          13724:  * For a more permanent change edit config.sh and rerun config.h.SH.
        !          13725:  */
        !          13726: 
        !          13727: 
        !          13728: /* EUNICE:
        !          13729:  *     This symbol, if defined, indicates that the program is being compiled
        !          13730:  *     under the EUNICE package under VMS.  The program will need to handle
        !          13731:  *     things like files that don't go away the first time you unlink them,
        !          13732:  *     due to version numbering.  It will also need to compensate for lack
        !          13733:  *     of a respectable link() command.
        !          13734:  */
        !          13735: /* VMX:
        !          13736:  *     This symbol, if defined, indicates that the program is running under
        !          13737:  *     VMS.  It is currently only set in conjunction with the EUNICE symbol.
        !          13738:  */
        !          13739: #/*undef       EUNICE          /**/
        !          13740: #/*undef       VMS             /**/
        !          13741: 
        !          13742: /* CHARSPRINTF:
        !          13743:  *     This symbol is defined if this system declares "char *sprintf()" in
        !          13744:  *     stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
        !          13745:  *     is up to the package author to declare sprintf correctly based on the
        !          13746:  *     symbol.
        !          13747:  */
        !          13748: #/*undef       CHARSPRINTF     /**/
        !          13749: 
        !          13750: /* FCNTL:
        !          13751:  *     This symbol, if defined, indicates to the C program that it should
        !          13752:  *     include fcntl.h.
        !          13753:  */
        !          13754: #define        FCNTL           /**/
        !          13755: 
        !          13756: /* FTIMER:
        !          13757:  *     This symbol, if defined, indicates that the ftime() routine exists.
        !          13758:  */
        !          13759: #define        FTIMER          /**/
        !          13760: 
        !          13761: /* GETHOSTNAME:
        !          13762:  *     This symbol, if defined, indicates that the C program may use the
        !          13763:  *     gethostname() routine to derive the host name.  See also DOUNAME
        !          13764:  *     and PHOSTNAME.
        !          13765:  */
        !          13766: /* DOUNAME:
        !          13767:  *     This symbol, if defined, indicates that the C program may use the
        !          13768:  *     uname() routine to derive the host name.  See also GETHOSTNAME and
        !          13769:  *     PHOSTNAME.
        !          13770:  */
        !          13771: /* PHOSTNAME:
        !          13772:  *     This symbol, if defined, indicates that the C program may use the
        !          13773:  *     contents of PHOSTNAME as a command to feed to the popen() routine
        !          13774:  *     to derive the host name.  See also GETHOSTNAME and DOUNAME.
        !          13775:  */
        !          13776: #/*undef       GETHOSTNAME     /**/
        !          13777: #/*undef       DOUNAME         /**/
        !          13778: #/*undef       PHOSTNAME ""    /**/
        !          13779: 
        !          13780: /* GETPWENT:
        !          13781:  *     This symbol, if defined, indicates that the getpwent() routine
        !          13782:  *     should be used instead of the getpw() routine.
        !          13783:  */
        !          13784: #/*undef       GETPWENT        /**/
        !          13785: 
        !          13786: /* HAVETERMLIB:
        !          13787:  *     This symbol, when defined, indicates that termlib-style routines
        !          13788:  *     are available.  There is nothing to include.
        !          13789:  */
        !          13790: #define        HAVETERMLIB     /**/
        !          13791: 
        !          13792: /* index:
        !          13793:  *     This preprocessor symbol is defined, along with rindex, if the system
        !          13794:  *     uses the strchr and strrchr routines instead.
        !          13795:  */
        !          13796: /* rindex:
        !          13797:  *     This preprocessor symbol is defined, along with index, if the system
        !          13798:  *     uses the strchr and strrchr routines instead.
        !          13799:  */
        !          13800: #define        index strchr    /* cultural */
        !          13801: #define        rindex strrchr  /*  differences? */
        !          13802: 
        !          13803: /* IOCTL:
        !          13804:  *     This symbol, if defined, indicates that sys/ioctl.h exists and should
        !          13805:  *     be included.
        !          13806:  */
        !          13807: #define        IOCTL           /**/
        !          13808: 
        !          13809: /* NORMSIG:
        !          13810:  *     This symbol, if defined, indicates that normal signal handling routines
        !          13811:  *     should be used, as opposed to the ones in 4.1bsd (sigset, etc.).
        !          13812:  */
        !          13813: #define        NORMSIG         /**/
        !          13814: 
        !          13815: /* PORTABLE:
        !          13816:  *     This symbol, if defined, indicates to the C program that it should
        !          13817:  *     not assume that it is running on the machine it was compiled on.
        !          13818:  *     The program should be prepared to look up the host name, translate
        !          13819:  *     generic filenames, use PATH, etc.
        !          13820:  */
        !          13821: #/*undef       PORTABLE        /**/
        !          13822: 
        !          13823: /* RDCHK:
        !          13824:  *     This symbol, if defined, indicates that the rdchk routine is available
        !          13825:  *     to find out if there is input pending on an IO channel.  Generally
        !          13826:  *     the routine is used only if FIONREAD and O_NDELAY aren't available.
        !          13827:  */
        !          13828: #/*undef       RDCHK           /**/
        !          13829: 
        !          13830: /* SCOREFULL:
        !          13831:  *     This symbol, if defined, indicates that any scoreboard kept by the
        !          13832:  *     program should be kept on the basis of the user's full name as opposed
        !          13833:  *     to the user's login name.  If the user can change his full name he
        !          13834:  *     can enter multiple scores if this is defined.
        !          13835:  */
        !          13836: #/*undef       SCOREFULL       /**/
        !          13837: 
        !          13838: /* SIGNEDCHAR:
        !          13839:  *     This symbol, if defined, indicates that characters are a signed type.
        !          13840:  *     If not defined, things declared as signed characters (and that make
        !          13841:  *     use of negative values) should probably be declared as shorts instead.
        !          13842:  */
        !          13843: #define        SIGNEDCHAR      /**/
        !          13844: 
        !          13845: /* TERMIO:
        !          13846:  *     This symbol, if defined, indicates that the program should include
        !          13847:  *     termio.h rather than sgtty.h.  There are also differences in the
        !          13848:  *     ioctl() calls that depend on the value of this symbol.
        !          13849:  */
        !          13850: #define        TERMIO          /**/
        !          13851: 
        !          13852: /* USENDIR:
        !          13853:  *     This symbol, if defined, indicates that the program should compile
        !          13854:  *     the ndir.c code provided with the package.
        !          13855:  */
        !          13856: /* LIBNDIR:
        !          13857:  *     This symbol, if defined, indicates that the program should include the
        !          13858:  *     system's version of ndir.h, rather than the one with this package.
        !          13859:  */
        !          13860: #define        USENDIR         /**/
        !          13861: #/*undef       LIBNDIR         /**/
        !          13862: 
        !          13863: /* WHOAMI:
        !          13864:  *     This symbol, if defined, indicates that the program may include
        !          13865:  *     whoami.h.
        !          13866:  */
        !          13867: #/*undef       WHOAMI          /**/
        !          13868: 
        !          13869: /* HOSTNAME:
        !          13870:  *     This symbol contains name of the host the program is going to run on.
        !          13871:  *     The domain is not kept with hostname, but must be gotten from MYDOMAIN.
        !          13872:  *     The dot comes with MYDOMAIN, and need not be supplied by the program.
        !          13873:  *     If gethostname() or uname() exist, HOSTNAME may be ignored.
        !          13874:  */
        !          13875: /* MYDOMAIN:
        !          13876:  *     This symbol contains the domain of the host the program is going to
        !          13877:  *     run on.  The domain must be appended to HOSTNAME to form a complete
        !          13878:  *     host name.  The dot comes with MYDOMAIN, and need not be supplied by
        !          13879:  *     the program.  If the host name is derived from PHOSTNAME, the domain
        !          13880:  *     may or may not already be there, and the program should check.
        !          13881:  */
        !          13882: #define HOSTNAME "dalek"               /**/
        !          13883: #define MYDOMAIN ".uucp"               /**/
        !          13884: 
        !          13885: /* PASSNAMES:
        !          13886:  *     This symbol, if defined, indicates that full names are stored in
        !          13887:  *     the /etc/passwd file.
        !          13888:  */
        !          13889: /* BERKNAMES:
        !          13890:  *     This symbol, if defined, indicates that full names are stored in
        !          13891:  *     the /etc/passwd file in Berkeley format (name first thing, everything
        !          13892:  *     up to first comma, with & replaced by capitalized login id, yuck).
        !          13893:  */
        !          13894: /* USGNAMES:
        !          13895:  *     This symbol, if defined, indicates that full names are stored in
        !          13896:  *     the /etc/passwd file in USG format (everything after - and before ( is
        !          13897:  *     the name).
        !          13898:  */
        !          13899: #define        PASSNAMES /*  (undef to take name from ~/.fullname) */
        !          13900: #define        BERKNAMES /* (that is, ":name,stuff:") */
        !          13901: #/*undef       USGNAMES  /* (that is, ":stuff-name(stuff):") */
        !          13902: 
        !          13903: /* PREFSHELL:
        !          13904:  *     This symbol contains the full name of the preferred user shell on this
        !          13905:  *     system.  Usual values are /bin/csh, /bin/ksh, /bin/sh.
        !          13906:  */
        !          13907: #define PREFSHELL "/bin/sh"            /**/
        !          13908: 
        !          13909: /* RANDBITS:
        !          13910:  *     This symbol contains the number of bits of random number the rand()
        !          13911:  *     function produces.  Usual values are 15, 16, and 31.
        !          13912:  */
        !          13913: #define RANDBITS 15            /**/
        !          13914: 
        !          13915: /* Reg1:
        !          13916:  *     This symbol, along with Reg2, Reg3, etc. is either the word "register"
        !          13917:  *     or null, depending on whether the C compiler pays attention to this
        !          13918:  *     many register declarations.  The intent is that you don't have to
        !          13919:  *     order your register declarations in the order of importance, so you
        !          13920:  *     can freely declare register variables in sub-blocks of code and as
        !          13921:  *     function parameters.  Do not use Reg<n> more than once per routine.
        !          13922:  */
        !          13923: 
        !          13924: #define Reg1 register          /**/
        !          13925: #define Reg2 register          /**/
        !          13926: #define Reg3           /**/
        !          13927: #define Reg4           /**/
        !          13928: #define Reg5           /**/
        !          13929: #define Reg6           /**/
        !          13930: #define Reg7           /**/
        !          13931: #define Reg8           /**/
        !          13932: #define Reg9           /**/
        !          13933: #define Reg10          /**/
        !          13934: #define Reg11          /**/
        !          13935: #define Reg12          /**/
        !          13936: #define Reg13          /**/
        !          13937: #define Reg14          /**/
        !          13938: #define Reg15          /**/
        !          13939: #define Reg16          /**/
        !          13940: 
        !          13941: /* ROOTID:
        !          13942:  *     This symbol contains the uid of root, normally 0.
        !          13943:  */
        !          13944: #define ROOTID 0               /**/
        !          13945: 
        !          13946: /* VOIDFLAGS:
        !          13947:  *     This symbol indicates how much support of the void type is given by this
        !          13948:  *     compiler.  What various bits mean:
        !          13949:  *
        !          13950:  *         1 = supports declaration of void
        !          13951:  *         2 = supports arrays of pointers to functions returning void
        !          13952:  *         4 = supports comparisons between pointers to void functions and
        !          13953:  *                 addresses of void functions
        !          13954:  *
        !          13955:  *     The package designer should define VOIDUSED to indicate the requirements
        !          13956:  *     of the package.  This can be done either by #defining VOIDUSED before
        !          13957:  *     including config.h, or by defining defvoidused in Myinit.U.
        !          13958:  */
        !          13959: #ifndef VOIDUSED
        !          13960: #define VOIDUSED 7
        !          13961: #endif
        !          13962: #define VOIDFLAGS 0
        !          13963: #if (VOIDFLAGS & VOIDUSED) != VOIDUSED
        !          13964: #define void int               /* is void to be avoided? */
        !          13965: #define M_VOID         /* Xenix strikes again */
        !          13966: #endif
        !          13967: 
        !          13968: /* warp private library, may use ~ expansion, %x and %l */
        !          13969: #define PRIVLIB "/usr/games/lib/warp"          /**/
        !          13970: 
        !          13971: package designer should define VOIDUSED to indicate the requirements
        !          13972:  *     of the package.  This can be done either by #defining VOIDUSED before
        !          13973:  *     including config.h, or by defining defvoidused in Myinit.U.
        !          13974:  */
        !          13975: #ifndef VOIDUSED
        !          13976: #define VOIDUSED 7
        !          13977: #endif
        !          13978: #define VOIDFLAGS 0
        !          13979: #if (VOIDFLAGS & VOIDUSED) != VOIDUSED
        !          13980: #define void int               /* is void warp/con.tar   666    171      1       27000  5122154030   6332 config.h   644     10      5       20254  5122143756   5501 /* config.h
        !          13981:  * This file was produced by running the config.h.SH script, which
        !          13982:  * gets its values from config.sh, which is generally produced by
        !          13983:  * running Configure.
        !          13984:  *
        !          13985:  * Feel free to modify any of this as the need arises.  Note, however,
        !          13986:  * that running config.h.SH again will wipe out any changes you've made.
        !          13987:  * For a more permanent change edit config.sh and rerun config.h.SH.
        !          13988:  */
        !          13989: 
        !          13990: 
        !          13991: /* EUNICE:
        !          13992:  *     This symbol, if defined, indicates that the program is being compiled
        !          13993:  *     under the EUNICE package under VMS.  The program will need to handle
        !          13994:  *     things like files that don't go away the first time you unlink them,
        !          13995:  *     due to version numbering.  It will also need to compensate for lack
        !          13996:  *     of a respectable link() command.
        !          13997:  */
        !          13998: /* VMX:
        !          13999:  *     This symbol, if defined, indicates that the program is running under
        !          14000:  *     VMS.  It is currently only set in conjunction with the EUNICE symbol.
        !          14001:  */
        !          14002: #/*undef       EUNICE          /**/
        !          14003: #/*undef       VMS             /**/
        !          14004: 
        !          14005: /* CHARSPRINTF:
        !          14006:  *     This symbol is defined if this system declares "char *sprintf()" in
        !          14007:  *     stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
        !          14008:  *     is up to the package author to declare sprintf correctly based on the
        !          14009:  *     symbol.
        !          14010:  */
        !          14011: #/*undef       CHARSPRINTF     /**/
        !          14012: 
        !          14013: /* FCNTL:
        !          14014:  *     This symbol, if defined, indicates to the C program that it should
        !          14015:  *     include fcntl.h.
        !          14016:  */
        !          14017: #define        FCNTL           /**/
        !          14018: 
        !          14019: /* FTIMER:
        !          14020:  *     This symbol, if defined, indicates that the ftime() routine exists.
        !          14021:  */
        !          14022: #define        FTIMER          /**/
        !          14023: 
        !          14024: /* GETHOSTNAME:
        !          14025:  *     This symbol, if defined, indicates that the C program may use the
        !          14026:  *     gethostname() routine to derive the host name.  See also DOUNAME
        !          14027:  *     and PHOSTNAME.
        !          14028:  */
        !          14029: /* DOUNAME:
        !          14030:  *     This symbol, if defined, indicates that the C program may use the
        !          14031:  *     uname() routine to derive the host name.  See also GETHOSTNAME and
        !          14032:  *     PHOSTNAME.
        !          14033:  */
        !          14034: /* PHOSTNAME:
        !          14035:  *     This symbol, if defined, indicates that the C program may use the
        !          14036:  *     contents of PHOSTNAME as a command to feed to the popen() routine
        !          14037:  *     to derive the host name.  See also GETHOSTNAME and DOUNAME.
        !          14038:  */
        !          14039: #/*undef       GETHOSTNAME     /**/
        !          14040: #/*undef       DOUNAME         /**/
        !          14041: #/*undef       PHOSTNAME ""    /**/
        !          14042: 
        !          14043: /* GETPWENT:
        !          14044:  *     This symbol, if defined, indicates that the getpwent() routine
        !          14045:  *     should be used instead of the getpw() routine.
        !          14046:  */
        !          14047: #/*undef       GETPWENT        /**/
        !          14048: 
        !          14049: /* HAVETERMLIB:
        !          14050:  *     This symbol, when defined, indicates that termlib-style routines
        !          14051:  *     are available.  There is nothing to include.
        !          14052:  */
        !          14053: #define        HAVETERMLIB     /**/
        !          14054: 
        !          14055: /* index:
        !          14056:  *     This preprocessor symbol is defined, along with rindex, if the system
        !          14057:  *     uses the strchr and strrchr routines instead.
        !          14058:  */
        !          14059: /* rindex:
        !          14060:  *     This preprocessor symbol is defined, along with index, if the system
        !          14061:  *     uses the strchr and strrchr routines instead.
        !          14062:  */
        !          14063: #define        index strchr    /* cultural */
        !          14064: #define        rindex strrchr  /*  differences? */
        !          14065: 
        !          14066: /* IOCTL:
        !          14067:  *     This symbol, if defined, indicates that sys/ioctl.h exists and should
        !          14068:  *     be included.
        !          14069:  */
        !          14070: #define        IOCTL           /**/
        !          14071: 
        !          14072: /* NORMSIG:
        !          14073:  *     This symbol, if defined, indicates that normal signal handling routines
        !          14074:  *     should be used, as opposed to the ones in 4.1bsd (sigset, etc.).
        !          14075:  */
        !          14076: #define        NORMSIG         /**/
        !          14077: 
        !          14078: /* PORTABLE:
        !          14079:  *     This symbol, if defined, indicates to the C program that it should
        !          14080:  *     not assume that it is running on the machine it was compiled on.
        !          14081:  *     The program should be prepared to look up the host name, translate
        !          14082:  *     generic filenames, use PATH, etc.
        !          14083:  */
        !          14084: #/*undef       PORTABLE        /**/
        !          14085: 
        !          14086: /* RDCHK:
        !          14087:  *     This symbol, if defined, indicates that the rdchk routine is available
        !          14088:  *     to find out if there is input pending on an IO channel.  Generally
        !          14089:  *     the routine is used only if FIONREAD and O_NDELAY aren't available.
        !          14090:  */
        !          14091: #/*undef       RDCHK           /**/
        !          14092: 
        !          14093: /* SCOREFULL:
        !          14094:  *     This symbol, if defined, indicates that any scoreboard kept by the
        !          14095:  *     program should be kept on the basis of the user's full name as opposed
        !          14096:  *     to the user's login name.  If the user can change his full name he
        !          14097:  *     can enter multiple scores if this is defined.
        !          14098:  */
        !          14099: #/*undef       SCOREFULL       /**/
        !          14100: 
        !          14101: /* SIGNEDCHAR:
        !          14102:  *     This symbol, if defined, indicates that characters are a signed type.
        !          14103:  *     If not defined, things declared as signed characters (and that make
        !          14104:  *     use of negative values) should probably be declared as shorts instead.
        !          14105:  */
        !          14106: #define        SIGNEDCHAR      /**/
        !          14107: 
        !          14108: /* TERMIO:
        !          14109:  *     This symbol, if defined, indicates that the program should include
        !          14110:  *     termio.h rather than sgtty.h.  There are also differences in the
        !          14111:  *     ioctl() calls that depend on the value of this symbol.
        !          14112:  */
        !          14113: #define        TERMIO          /**/
        !          14114: 
        !          14115: /* USENDIR:
        !          14116:  *     This symbol, if defined, indicates that the program should compile
        !          14117:  *     the ndir.c code provided with the package.
        !          14118:  */
        !          14119: /* LIBNDIR:
        !          14120:  *     This symbol, if defined, indicates that the program should include the
        !          14121:  *     system's version of ndir.h, rather than the one with this package.
        !          14122:  */
        !          14123: #define        USENDIR         /**/
        !          14124: #/*undef       LIBNDIR         /**/
        !          14125: 
        !          14126: /* WHOAMI:
        !          14127:  *     This symbol, if defined, indicates that the program may include
        !          14128:  *     whoami.h.
        !          14129:  */
        !          14130: #/*undef       WHOAMI          /**/
        !          14131: 
        !          14132: /* HOSTNAME:
        !          14133:  *     This symbol contains name of the host the program is going to run on.
        !          14134:  *     The domain is not kept with hostname, but must be gotten from MYDOMAIN.
        !          14135:  *     The dot comes with MYDOMAIN, and need not be supplied by the program.
        !          14136:  *     If gethostname() or uname() exist, HOSTNAME may be ignored.
        !          14137:  */
        !          14138: /* MYDOMAIN:
        !          14139:  *     This symbol contains the domain of the host the program is going to
        !          14140:  *     run on.  The domain must be appended to HOSTNAME to form a complete
        !          14141:  *     host name.  The dot comes with MYDOMAIN, and need not be supplied by
        !          14142:  *     the program.  If the host name is derived from PHOSTNAME, the domain
        !          14143:  *     may or may not already be there, and the program should check.
        !          14144:  */
        !          14145: #define HOSTNAME "dalek"               /**/
        !          14146: #define MYDOMAIN ".uucp"               /**/
        !          14147: 
        !          14148: /* PASSNAMES:
        !          14149:  *     This symbol, if defined, indicates that full names are stored in
        !          14150:  *     the /etc/passwd file.
        !          14151:  */
        !          14152: /* BERKNAMES:
        !          14153:  *     This symbol, if defined, indicates that full names are stored in
        !          14154:  *     the /etc/passwd file in Berkeley format (name first thing, everything
        !          14155:  *     up to first comma, with & replaced by capitalized login id, yuck).
        !          14156:  */
        !          14157: /* USGNAMES:
        !          14158:  *     This symbol, if defined, indicates that full names are stored in
        !          14159:  *     the /etc/passwd file in USG format (everything after - and before ( is
        !          14160:  *     the name).
        !          14161:  */
        !          14162: #define        PASSNAMES /*  (undef to take name from ~/.fullname) */
        !          14163: #define        BERKNAMES /* (that is, ":name,stuff:") */
        !          14164: #/*undef       USGNAMES  /* (that is, ":stuff-name(stuff):") */
        !          14165: 
        !          14166: /* PREFSHELL:
        !          14167:  *     This symbol contains the full name of the preferred user shell on this
        !          14168:  *     system.  Usual values are /bin/csh, /bin/ksh, /bin/sh.
        !          14169:  */
        !          14170: #define PREFSHELL "/bin/sh"            /**/
        !          14171: 
        !          14172: /* RANDBITS:
        !          14173:  *     This symbol contains the number of bits of random number the rand()
        !          14174:  *     function produces.  Usual values are 15, 16, and 31.
        !          14175:  */
        !          14176: #define RANDBITS 15            /**/
        !          14177: 
        !          14178: /* Reg1:
        !          14179:  *     This symbol, along with Reg2, Reg3, etc. is either the word "register"
        !          14180:  *     or null, depending on whether the C compiler pays attention to this
        !          14181:  *     many register declarations.  The intent is that you don't have to
        !          14182:  *     order your register declarations in the order of importance, so you
        !          14183:  *     can freely declare register variables in sub-blocks of code and as
        !          14184:  *     function parameters.  Do not use Reg<n> more than once per routine.
        !          14185:  */
        !          14186: 
        !          14187: #define Reg1 register          /**/
        !          14188: #define Reg2 register          /**/
        !          14189: #define Reg3           /**/
        !          14190: #define Reg4           /**/
        !          14191: #define Reg5           /**/
        !          14192: #define Reg6           /**/
        !          14193: #define Reg7           /**/
        !          14194: #define Reg8           /**/
        !          14195: #define Reg9           /**/
        !          14196: #define Reg10          /**/
        !          14197: #define Reg11          /**/
        !          14198: #define Reg12          /**/
        !          14199: #define Reg13          /**/
        !          14200: #define Reg14          /**/
        !          14201: #define Reg15          /**/
        !          14202: #define Reg16          /**/
        !          14203: 
        !          14204: /* ROOTID:
        !          14205:  *     This symbol contains the uid of root, normally 0.
        !          14206:  */
        !          14207: #define ROOTID 0               /**/
        !          14208: 
        !          14209: /* VOIDFLAGS:
        !          14210:  *     This symbol indicates how much support of the void type is given by this
        !          14211:  *     compiler.  What various bits mean:
        !          14212:  *
        !          14213:  *         1 = supports declaration of void
        !          14214:  *         2 = supports arrays of pointers to functions returning void
        !          14215:  *         4 = supports comparisons between pointers to void functions and
        !          14216:  *                 addresses of void functions
        !          14217:  *
        !          14218:  *     The package designer should define VOIDUSED to indicate the requirements
        !          14219:  *     of the package.  This can be done either by #defining VOIDUSED before
        !          14220:  *     including config.h, or by defining defvoidused in Myinit.U.
        !          14221:  */
        !          14222: #ifndef VOIDUSED
        !          14223: #define VOIDUSED 7
        !          14224: #endif
        !          14225: #define VOIDFLAGS 0
        !          14226: #if (VOIDFLAGS & VOIDUSED) != VOIDUSED
        !          14227: #define void int               /* is void to be avoided? */
        !          14228: #define M_VOID         /* Xenix strikes again */
        !          14229: #endif
        !          14230: 
        !          14231: /* warp private library, may use ~ expansion, %x and %l */
        !          14232: #define PRIVLIB "/usr/games/lib/warp"          /**/
        !          14233: 
        !          14234: package designer should define VOIDUSED to indicate the requirements
        !          14235:  *     of the package.  This can be done either by #defining VOIDUSED before
        !          14236:  *     including config.h, or by defining defvoidused in Myinit.U.
        !          14237:  */
        !          14238: #ifndef VOIDUSED
        !          14239: #define VOIDUSED 7
        !          14240: #endif
        !          14241: #define VOIDFLAGS 0
        !          14242: #if (VOIDFLAGS & VOIDUSED) != VOIDUSED
        !          14243: #define void int               /* is void config.sh   644     10      5        3240  5122144267   5636 : use /bin/sh
        !          14244: # config.sh
        !          14245: # This file was produced by running the Configure script.
        !          14246: 
        !          14247: d_eunice='/*undef'
        !          14248: eunicefix=':'
        !          14249: define='define'
        !          14250: loclist='
        !          14251: expr
        !          14252: sed
        !          14253: echo
        !          14254: cat
        !          14255: rm
        !          14256: mv
        !          14257: cp
        !          14258: tr
        !          14259: mkdir
        !          14260: sort
        !          14261: uniq
        !          14262: grep
        !          14263: '
        !          14264: expr='/bin/expr'
        !          14265: sed='/bin/sed'
        !          14266: echo='/bin/echo'
        !          14267: cat='/bin/cat'
        !          14268: rm='/bin/rm'
        !          14269: mv='/bin/mv'
        !          14270: cp='/bin/cp'
        !          14271: tail=''
        !          14272: tr='/usr/bin/tr'
        !          14273: mkdir='/bin/mkdir'
        !          14274: sort='/bin/sort'
        !          14275: uniq='/usr/bin/uniq'
        !          14276: grep='/bin/grep'
        !          14277: trylist='
        !          14278: test
        !          14279: egrep
        !          14280: Mcc
        !          14281: '
        !          14282: test='test'
        !          14283: inews=''
        !          14284: egrep='/usr/bin/egrep'
        !          14285: more=''
        !          14286: pg=''
        !          14287: Mcc='Mcc'
        !          14288: vi=''
        !          14289: mailx=''
        !          14290: Log='$Log'
        !          14291: Header='$Header'
        !          14292: cc='cc'
        !          14293: contains='grep'
        !          14294: cpp='cc -E'
        !          14295: d_charsprf='/*undef'
        !          14296: d_fcntl='define'
        !          14297: d_ftime='define'
        !          14298: d_gethname='/*undef'
        !          14299: d_douname='/*undef'
        !          14300: d_phostname='/*undef'
        !          14301: d_getpwent='/*undef'
        !          14302: d_havetlib='/*undef'
        !          14303: termlib='-lcurses'
        !          14304: d_index='define'
        !          14305: d_ioctl='/*undef'
        !          14306: d_normsig='define'
        !          14307: jobslib=''
        !          14308: d_portable='/*undef'
        !          14309: d_rdchk='/*undef'
        !          14310: d_scorfl='/*undef'
        !          14311: d_sgndchr='define'
        !          14312: d_termio='/*undef'
        !          14313: d_usendir='define'
        !          14314: d_libndir='/*undef'
        !          14315: ndirc='ndir.c'
        !          14316: ndiro='ndir.o'
        !          14317: d_whoami='/*undef'
        !          14318: hostname='dalek'
        !          14319: phostname=''
        !          14320: mydomain='.uucp'
        !          14321: libc='/lib/libc.a'
        !          14322: libnm=''
        !          14323: mansrc='/usr/man/man1'
        !          14324: manext='1'
        !          14325: models='none'
        !          14326: split=''
        !          14327: small=''
        !          14328: medium=''
        !          14329: large=''
        !          14330: huge=''
        !          14331: ccflags=''
        !          14332: ldflags=''
        !          14333: n=''
        !          14334: c='\c'
        !          14335: nametype='bsd'
        !          14336: d_passnames='define'
        !          14337: d_berknames='define'
        !          14338: d_usgnames='/*undef'
        !          14339: passcat='cat /etc/passwd'
        !          14340: package='warp'
        !          14341: prefshell='/bin/sh'
        !          14342: randbits='15'
        !          14343: registers='2'
        !          14344: reg1='register'
        !          14345: reg2='register'
        !          14346: reg3=''
        !          14347: reg4=''
        !          14348: reg5=''
        !          14349: reg6=''
        !          14350: reg7=''
        !          14351: reg8=''
        !          14352: reg9=''
        !          14353: reg10=''
        !          14354: reg11=''
        !          14355: reg12=''
        !          14356: reg13=''
        !          14357: reg14=''
        !          14358: reg15=''
        !          14359: reg16=''
        !          14360: rootid='0'
        !          14361: spitshell='cat'
        !          14362: shsharp='true'
        !          14363: sharpbang=': use '
        !          14364: startsh=': use /bin/sh'
        !          14365: voidflags='0'
        !          14366: bin='/usr/games'
        !          14367: chowner='daemon'
        !          14368: privlib='/usr/games/lib/warp'
        !          14369: CONFIG=true
        !          14370: ags=''
        !          14371: n=''
        !          14372: c='\c'
        !          14373: nametype='bsd'
        !          14374: d_passnames='define'
        !          14375: d_berknames='define'
        !          14376: d_usgnames='/*undef'
        !          14377: passcat='cat /etc/passwd'
        !          14378: package='warp'
        !          14379: prefshell='/bin/sh'
        !          14380: randbits='15'
        !          14381: registers='2'
        !          14382: reg1='register'
        !          14383: reg2='register'
        !          14384: reg3=''
        !          14385: reg4=''
        !          14386: reg5=''
        !          14387: reg6=''
        !          14388: reg7=''
        !          14389: reg8=''
        !          14390: reg9=''
        !          14391: reg10=''
        !          14392: reg11=''
        !          14393: reg12=''
        !          14394: reg13=''
        !          14395: reg14=''
        !          14396: reg15=''
        !          14397: reg16=''
        !          14398: rootid='0'
        !          14399: spitwarp/makedepend.out   644    171      1        1466  5122154152   7662    makedepend
        !          14400: (Note: this is going to take a while.)
        !          14401:        echo bang.c init.c intrp.c move.c object.c play.c score.c sig.c term.c them.c us.c util.c version.c warp.c weapon.c ndir.c | tr ' ' '\012' >.clist
        !          14402: Finding dependencies for bang.o.
        !          14403: Finding dependencies for init.o.
        !          14404: Finding dependencies for intrp.o.
        !          14405: Finding dependencies for move.o.
        !          14406: Finding dependencies for object.o.
        !          14407: Finding dependencies for play.o.
        !          14408: Finding dependencies for score.o.
        !          14409: Finding dependencies for sig.o.
        !          14410: Finding dependencies for term.o.
        !          14411: Finding dependencies for them.o.
        !          14412: Finding dependencies for us.o.
        !          14413: Finding dependencies for util.o.
        !          14414: Finding dependencies for version.o.
        !          14415: Finding dependencies for warp.o.
        !          14416: Finding dependencies for weapon.o.
        !          14417: Finding dependencies for ndir.o.
        !          14418:        echo Makefile.SH makedepend.SH makedir.SH | tr ' ' '\012' >.shlist
        !          14419: Updating Makefile...
        !          14420: endencies for move.o.
        !          14421: Finding dependencies for object.o.
        !          14422: Finding dependencies for play.o.
        !          14423: Finding dependencies for score.o.
        !          14424: Finding dependencies for sig.o.
        !          14425: Finding dependencies for term.o.
        !          14426: Finding depenwarp/Makefile.old   644    171      1        6656  5162431313   7260 # $Header: Makefile.SH,v 7.0.1.1 86/12/12 16:54:03 lwall Exp $
        !          14427: #
        !          14428: # $Log:        Makefile.SH,v $
        !          14429: # Revision 7.0.1.1  86/12/12  16:54:03  lwall
        !          14430: # Frozen for net release.
        !          14431: # 
        !          14432: # Revision 7.0  86/10/08  15:11:42  lwall
        !          14433: # Split into separate files.  Added amoebas and pirates.
        !          14434: # 
        !          14435: #
        !          14436: CC = cc
        !          14437: bin = /usr/games
        !          14438: mansrc = /usr/man/man1
        !          14439: manext = 1
        !          14440: CFLAGS =  -O
        !          14441: LDFLAGS = 
        !          14442: CHOWNER = daemon
        !          14443: privlib = /usr/games/lib/warp
        !          14444: NDIRC = ndir.c
        !          14445: NDIRO = ndir.o
        !          14446: LARGE =  
        !          14447: SMALL = 
        !          14448: 
        !          14449: libs =  -lcurses  /usr/lib/libtermlib.a -lm
        !          14450: 
        !          14451: public = warp
        !          14452: private = warp.doc smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
        !          14453: manpages = warp.man
        !          14454: util = Makefile makedepend makedir smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
        !          14455: 
        !          14456: sh = Makefile.SH makedepend.SH makedir.SH
        !          14457: 
        !          14458: h1 = bang.h init.h intrp.h move.h ndir.h
        !          14459: h2 = patchlevel.h object.h play.h score.h
        !          14460: h3 = sig.h term.h them.h us.h
        !          14461: h4 = util.h version.h warp.h weapon.h
        !          14462: 
        !          14463: h = $(h1) $(h2) $(h3) $(h4)
        !          14464: 
        !          14465: c1 = bang.c init.c intrp.c move.c
        !          14466: c2 = object.c play.c score.c
        !          14467: c3 = sig.c term.c them.c us.c
        !          14468: c4 = util.c version.c warp.c weapon.c
        !          14469: 
        !          14470: c = $(c1) $(c2) $(c3) $(c4) $(NDIRC)
        !          14471: 
        !          14472: obj1 = bang.o init.o intrp.o move.o
        !          14473: obj2 = object.o play.o score.o
        !          14474: obj3 = sig.o term.o them.o us.o
        !          14475: obj4 = util.o version.o warp.o weapon.o
        !          14476: 
        !          14477: obj = $(obj1) $(obj2) $(obj3) $(obj4) $(NDIRO)
        !          14478: 
        !          14479: lintflags = -phbvxac
        !          14480: 
        !          14481: add1 = Makefile.old 
        !          14482: add2 = bsd config.h config.sh eunice filexp
        !          14483: add3 = loc makedepend 
        !          14484: add4 = 
        !          14485: add5 = pdp11 warp usg v7
        !          14486: 
        !          14487: addedbyconf = $(add1) $(add2) $(add3) $(add4) $(add5)
        !          14488: 
        !          14489: # grrr
        !          14490: SHELL = /bin/sh
        !          14491: 
        !          14492: .c.o:
        !          14493:        $(CC) -c $(CFLAGS) $(LARGE) $*.c
        !          14494: 
        !          14495: all: $(public) $(private) $(util)
        !          14496:        touch all
        !          14497: 
        !          14498: warp: $(obj)
        !          14499:        $(CC) $(LDFLAGS) $(obj) $(LARGE) $(libs) -o warp
        !          14500: 
        !          14501: # if a .h file depends on another .h file...
        !          14502: $(h):
        !          14503:        touch $@
        !          14504: 
        !          14505: install: warp
        !          14506: # won't work with csh
        !          14507:        export PATH || exit 1
        !          14508:        - mv $(bin)/warp $(bin)/warp.old
        !          14509:        - if test `pwd` != $(bin); then cp $(public) $(bin); fi
        !          14510:        - cd $(bin); chmod 755 $(public); chown '$(CHOWNER)' $(public)
        !          14511:        - chmod 4711 $(bin)/warp
        !          14512:        - chmod 755 makedir
        !          14513:        - ./makedir `./filexp $(privlib)`
        !          14514:        - \
        !          14515: if test `pwd` != `./filexp $(privlib)`; then \
        !          14516: cp $(private) `./filexp $(privlib)`; \
        !          14517: fi
        !          14518:        - \
        !          14519: cd `./filexp $(privlib)`; \
        !          14520: chmod 755 $(private); \
        !          14521: chown '$(CHOWNER)' . $(private) \
        !          14522: cp /dev/null save.blurfl
        !          14523:        - \
        !          14524: if test ! -f `./filexp $(privlib)/warp.news`; then \
        !          14525: cp warp.news `./filexp $(privlib)`; \
        !          14526: fi
        !          14527:        - \
        !          14528: if test `pwd` != $(mansrc); then \
        !          14529: for page in $(manpages); do \
        !          14530: cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
        !          14531: done; \
        !          14532: fi
        !          14533: 
        !          14534: clean:
        !          14535:        rm -f core *.o
        !          14536: 
        !          14537: realclean:
        !          14538:        rm -f warp *.o core $(addedbyconf) $(util)
        !          14539: 
        !          14540: # The following lint has practically everything turned on.  Unfortunately,
        !          14541: # you have to wade through a lot of mumbo jumbo that can't be suppressed.
        !          14542: # If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
        !          14543: # for that spot.
        !          14544: 
        !          14545: lint:
        !          14546:        lint $(lintflags) $(defs) $(c) > warp.fuzz
        !          14547: 
        !          14548: smap.0: smp.0 sm
        !          14549:        sm <smp.0 >smap.0
        !          14550: smap.1: smp.1 sm
        !          14551:        sm <smp.1 >smap.1
        !          14552: smap.2: smp.2 sm
        !          14553:        sm <smp.2 >smap.2
        !          14554: smap.3: smp.3 sm
        !          14555:        sm <smp.3 >smap.3
        !          14556: smap.4: smp.4 sm
        !          14557:        sm <smp.4 >smap.4
        !          14558: smap.5: smp.5 sm
        !          14559:        sm <smp.5 >smap.5
        !          14560: smap.6: smp.6 sm
        !          14561:        sm <smp.6 >smap.6
        !          14562: smap.7: smp.7 sm
        !          14563:        sm <smp.7 >smap.7
        !          14564: sm: sm.c
        !          14565:        cc sm.c $(SMALL) -o sm
        !          14566: 
        !          14567: depend: makedepend
        !          14568:        makedepend
        !          14569: 
        !          14570: clist:
        !          14571:        echo $(c) | tr ' ' '\012' >.clist
        !          14572: 
        !          14573: hlist:
        !          14574:        echo $(h) | tr ' ' '\012' >.hlist
        !          14575: 
        !          14576: shlist:
        !          14577:        echo $(sh) | tr ' ' '\012' >.shlist
        !          14578: 
        !          14579: # AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
        !          14580: $(obj):
        !          14581:        @ echo "You haven't done a "'"make depend" yet!'; exit 1
        !          14582: makedepend: makedepend.SH
        !          14583:        /bin/sh makedepend.SH
        !          14584: sm <smp.4 >smap.4
        !          14585: smap.5: smp.5 sm
        !          14586:        sm <smp.5 >smap.5
        !          14587: smap.6: smp.6 sm
        !          14588:        sm <smp.6 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.