1 /* 2 * Copyright (c) 1982 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)varpush.c 5.6 (Berkeley) 06/01/90"; 10 #endif /* not lint */ 11 12 # include <paths.h> 13 # include "mille.h" 14 15 /* 16 * @(#)varpush.c 1.1 (Berkeley) 4/1/82 17 */ 18 19 int read(), write(); 20 21 /* 22 * push variables around via the routine func() on the file 23 * channel file. func() is either read or write. 24 */ 25 varpush(file, func) 26 reg int file; 27 reg int (*func)(); { 28 29 int temp; 30 31 (*func)(file, (char *) &Debug, sizeof Debug); 32 (*func)(file, (char *) &Finished, sizeof Finished); 33 (*func)(file, (char *) &Order, sizeof Order); 34 (*func)(file, (char *) &End, sizeof End); 35 (*func)(file, (char *) &On_exit, sizeof On_exit); 36 (*func)(file, (char *) &Handstart, sizeof Handstart); 37 (*func)(file, (char *) &Numgos, sizeof Numgos); 38 (*func)(file, (char *) Numseen, sizeof Numseen); 39 (*func)(file, (char *) &Play, sizeof Play); 40 (*func)(file, (char *) &Window, sizeof Window); 41 (*func)(file, (char *) Deck, sizeof Deck); 42 (*func)(file, (char *) &Discard, sizeof Discard); 43 (*func)(file, (char *) Player, sizeof Player); 44 if (func == read) { 45 read(file, (char *) &temp, sizeof temp); 46 Topcard = &Deck[temp]; 47 #ifdef DEBUG 48 if (Debug) { 49 char buf[80]; 50 over: 51 printf("Debug file:"); 52 gets(buf); 53 if ((outf = fopen(buf, "w")) == NULL) { 54 perror(buf); 55 goto over; 56 } 57 if (strcmp(buf, _PATH_DEVNULL) != 0) 58 setbuf(outf, (char *)NULL); 59 } 60 #endif 61 } 62 else { 63 temp = Topcard - Deck; 64 write(file, (char *) &temp, sizeof temp); 65 } 66 } 67