|
|
1.1 root 1: /*
2: * Copyright (c) 1982 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that the above copyright notice and this paragraph are
7: * duplicated in all such forms and that any documentation,
8: * advertising materials, and other materials related to such
9: * distribution and use acknowledge that the software was developed
10: * by the University of California, Berkeley. The name of the
11: * University may not be used to endorse or promote products derived
12: * from this software without specific prior written permission.
13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16: */
17:
18: #ifndef lint
19: static char sccsid[] = "@(#)varpush.c 5.4 (Berkeley) 6/18/88";
20: #endif /* not lint */
21:
22: # include "mille.h"
23:
24: /*
25: * @(#)varpush.c 1.1 (Berkeley) 4/1/82
26: */
27:
28: int read(), write();
29:
30: /*
31: * push variables around via the routine func() on the file
32: * channel file. func() is either read or write.
33: */
34: varpush(file, func)
35: reg int file;
36: reg int (*func)(); {
37:
38: int temp;
39:
40: (*func)(file, (char *) &Debug, sizeof Debug);
41: (*func)(file, (char *) &Finished, sizeof Finished);
42: (*func)(file, (char *) &Order, sizeof Order);
43: (*func)(file, (char *) &End, sizeof End);
44: (*func)(file, (char *) &On_exit, sizeof On_exit);
45: (*func)(file, (char *) &Handstart, sizeof Handstart);
46: (*func)(file, (char *) &Numgos, sizeof Numgos);
47: (*func)(file, (char *) Numseen, sizeof Numseen);
48: (*func)(file, (char *) &Play, sizeof Play);
49: (*func)(file, (char *) &Window, sizeof Window);
50: (*func)(file, (char *) Deck, sizeof Deck);
51: (*func)(file, (char *) &Discard, sizeof Discard);
52: (*func)(file, (char *) Player, sizeof Player);
53: if (func == read) {
54: read(file, (char *) &temp, sizeof temp);
55: Topcard = &Deck[temp];
56: #ifdef DEBUG
57: if (Debug) {
58: char buf[80];
59: over:
60: printf("Debug file:");
61: gets(buf);
62: if ((outf = fopen(buf, "w")) == NULL) {
63: perror(buf);
64: goto over;
65: }
66: if (strcmp(buf, "/dev/null") != 0)
67: setbuf(outf, (char *)NULL);
68: }
69: #endif
70: }
71: else {
72: temp = Topcard - Deck;
73: write(file, (char *) &temp, sizeof temp);
74: }
75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.