Annotation of researchv10no/games/trek/log.c, revision 1.1

1.1     ! root        1: # include "trek.h"
        !             2: 
        !             3: # define       LOGFILE "/usr/src/games/trek/log"
        !             4: 
        !             5: /**
        !             6:  **    write out log
        !             7:  **/
        !             8: 
        !             9: extern long    score();
        !            10: extern CVNTAB  Skitab[];
        !            11: extern CVNTAB  Lentab[];
        !            12: 
        !            13: char *reason[] {
        !            14:        "win......",
        !            15:        "time.....",
        !            16:        "energy...",
        !            17:        "destroyed",
        !            18:        "barrier..",
        !            19:        "nova.....",
        !            20:        "supernova",
        !            21:        "suffocate",
        !            22:        "no help..",
        !            23:        "too fast.",
        !            24:        "burned...",
        !            25:        "destruct.",
        !            26:        "captured.",
        !            27:        "no crew..",
        !            28:        "cheating."
        !            29: };
        !            30: 
        !            31: int    stdout;
        !            32: 
        !            33: long writelog(n)
        !            34: int    n;
        !            35: {
        !            36:        register int            f, uid;
        !            37:        long                    s;
        !            38:        char                    *date;
        !            39: 
        !            40:        s=score();
        !            41:        if(Game.tourn && (f=open(LOGFILE,1))>=0) {
        !            42:                uid=getuid()&0377;
        !            43:                date=ctime(&inittime); date[10]=0;
        !            44:                lseek(f,0L,2);
        !            45:                stdout=f;
        !            46:                printf("%d\t%s\t%D\t%s\t%s\t%s\t%.2f%c\t%d/%d\t%d\t%d\t%d\t%d\t%d\n",
        !            47:                        uid,
        !            48:                        date+4,
        !            49:                        s,
        !            50:                        reason[n],
        !            51:                        (Skitab[Game.skill-1].abrev),
        !            52:                        (Lentab[Game.length].abrev),
        !            53:                        Status.date-Initial.date,
        !            54:                        Status.ship,
        !            55:                        Game.gkillk, Game.gkillk+Status.kling,
        !            56:                        Game.helps,
        !            57:                        Game.killb,
        !            58:                        Game.kills,
        !            59:                        Game.killinhab,
        !            60:                        Game.deaths
        !            61:                        );
        !            62:                stdout=1;
        !            63:                close(f);
        !            64:        }
        !            65:        return(s);
        !            66: }
        !            67: 

unix.superglobalmegacorp.com

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