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, (char *) &Debug, sizeof Debug); 20: (*func)(file, (char *) &Finished, sizeof Finished); 21: (*func)(file, (char *) &Order, sizeof Order); 22: (*func)(file, (char *) &End, sizeof End); 23: (*func)(file, (char *) &On_exit, sizeof On_exit); 24: (*func)(file, (char *) &Handstart, sizeof Handstart); 25: (*func)(file, (char *) &Numgos, sizeof Numgos); 26: (*func)(file, (char *) Numseen, sizeof Numseen); 27: (*func)(file, (char *) &Play, sizeof Play); 28: (*func)(file, (char *) &Window, sizeof Window); 29: (*func)(file, (char *) Deck, sizeof Deck); 30: (*func)(file, (char *) &Discard, sizeof Discard); 31: (*func)(file, (char *) Player, sizeof Player); 32: if (func == read) { 33: read(file, (char *) &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, NULL); 46: } 47: } 48: else { 49: temp = Topcard - Deck; 50: write(file, (char *) &temp, sizeof temp); 51: } 52: }