varpush.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 63 行

C
63
字号
/* ------------------------------------------------------------------ *//* | Copyright Unpublished, MIPS Computer Systems, Inc.  All Rights | *//* | Reserved.  This software contains proprietary and confidential | *//* | information of MIPS and its suppliers.  Use, disclosure or     | *//* | reproduction is prohibited without the prior express written   | *//* | consent of MIPS.                                               | *//* ------------------------------------------------------------------ *//* $Header: varpush.c,v 1.2 86/07/24 15:24:08 dce Exp $ */# include	"mille.h"/* * @(#)varpush.c	1.1 (Berkeley) 4/1/82 */int	read(), write();/* *	push variables around via the routine func() on the file * channel file.  func() is either read or write. */varpush(file, func)reg int	file;reg int	(*func)(); {	int	temp;	(*func)(file, (char *) &Debug, sizeof Debug);	(*func)(file, (char *) &Finished, sizeof Finished);	(*func)(file, (char *) &Order, sizeof Order);	(*func)(file, (char *) &End, sizeof End);	(*func)(file, (char *) &On_exit, sizeof On_exit);	(*func)(file, (char *) &Handstart, sizeof Handstart);	(*func)(file, (char *) &Numgos, sizeof Numgos);	(*func)(file, (char *)  Numseen, sizeof Numseen);	(*func)(file, (char *) &Play, sizeof Play);	(*func)(file, (char *) &Window, sizeof Window);	(*func)(file, (char *)  Deck, sizeof Deck);	(*func)(file, (char *) &Discard, sizeof Discard);	(*func)(file, (char *)  Player, sizeof Player);	if (func == read) {		read(file, (char *) &temp, sizeof temp);		Topcard = &Deck[temp];		if (Debug) {			char	buf[80];over:			printf("Debug file:");			gets(buf);			if ((outf = fopen(buf, "w")) == NULL) {				perror(buf);				goto over;			}			if (strcmp(buf, "/dev/null") != 0)				setbuf(outf, NULL);		}	}	else {		temp = Topcard - Deck;		write(file, (char *) &temp, sizeof temp);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?