Annotation of 42BSD/games/mille/varpush.c, revision 1.1

1.1     ! root        1: # include      "mille.h"
        !             2: 
        !             3: /*
        !             4:  * @(#)varpush.c       1.1 (Berkeley) 4/1/82
        !             5:  */
        !             6: 
        !             7: int    read(), write();
        !             8: 
        !             9: /*
        !            10:  *     push variables around via the routine func() on the file
        !            11:  * channel file.  func() is either read or write.
        !            12:  */
        !            13: varpush(file, func)
        !            14: reg int        file;
        !            15: reg int        (*func)(); {
        !            16: 
        !            17:        int     temp;
        !            18: 
        !            19:        (*func)(file, &Debug, sizeof Debug);
        !            20:        (*func)(file, &Finished, sizeof Finished);
        !            21:        (*func)(file, &Order, sizeof Order);
        !            22:        (*func)(file, &End, sizeof End);
        !            23:        (*func)(file, &On_exit, sizeof On_exit);
        !            24:        (*func)(file, &Handstart, sizeof Handstart);
        !            25:        (*func)(file, &Numgos, sizeof Numgos);
        !            26:        (*func)(file,  Numseen, sizeof Numseen);
        !            27:        (*func)(file, &Play, sizeof Play);
        !            28:        (*func)(file, &Window, sizeof Window);
        !            29:        (*func)(file,  Deck, sizeof Deck);
        !            30:        (*func)(file, &Discard, sizeof Discard);
        !            31:        (*func)(file,  Player, sizeof Player);
        !            32:        if (func == read) {
        !            33:                read(file, &temp, sizeof temp);
        !            34:                Topcard = &Deck[temp];
        !            35:                if (Debug) {
        !            36:                        char    buf[80];
        !            37: over:
        !            38:                        printf("Debug file:");
        !            39:                        gets(buf);
        !            40:                        if ((outf = fopen(buf, "w")) == NULL) {
        !            41:                                perror(buf);
        !            42:                                goto over;
        !            43:                        }
        !            44:                        if (strcmp(buf, "/dev/null") != 0)
        !            45:                                setbuf(outf, 0);
        !            46:                }
        !            47:        }
        !            48:        else {
        !            49:                temp = Topcard - Deck;
        !            50:                write(file, &temp, sizeof temp);
        !            51:        }
        !            52: }

unix.superglobalmegacorp.com

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