⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sue.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic char	*sccsid = " @(#)sue.c	1.2	(ULTRIX)	1/16/86";#endif lint/************************************************************************ *									* *			Copyright (c) 1986 by				* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//**************************************************************************			Modification History**	David Metsky		10-Jan-86** 001	Replaced old version with BSD 4.3 version as part of upgrade.**	Based on:	sue.c		5.1		6/7/85**************************************************************************//* * sequential unformatted external read/write routines */#include "fio.h"extern int reclen;LOCAL long recloc;LOCAL char rsue[] = "read sue";LOCAL char wsue[] = "write sue";s_rsue(a) cilist *a;{	int n;	reading = YES;	if(n=c_sue(a,READ)) return(n);	if(curunit->uwrt && ! nowreading(curunit)) err(errflag, errno, rsue)	recpos = 0;	if(fread(&reclen,sizeof(int),1,cf) == 1) return(OK);	if(feof(cf))	{	curunit->uend = YES;		err(endflag, EOF, rsue)	}	clearerr(cf);	err(errflag, errno, rsue)}s_wsue(a) cilist *a;{	int n;	reading = NO;	if(n=c_sue(a,WRITE)) return(n);	if(!curunit->uwrt && ! nowwriting(curunit)) err(errflag, errno, wsue)	reclen = 0;	recloc=ftell(cf);	fseek(cf,(long)sizeof(int),1);	curunit->uend = NO;	return(OK);}LOCALc_sue(a,flag) cilist *a;{	int n;	external = sequential = YES;	formatted = NO;	lfname = NULL;	elist = NO;	errflag = a->cierr;	endflag = a->ciend;	lunit = a->ciunit;	if(not_legal(lunit)) err(errflag,F_ERUNIT,rsue+5)	curunit = &units[lunit];	if(!curunit->ufd && (n=fk_open(flag,SEQ,UNF,(ftnint)lunit)))		err(errflag,n,rsue+5)	cf = curunit->ufd;	elist = YES;	lfname = curunit->ufnm;	if(curunit->ufmt) err(errflag,F_ERNOUIO,rsue+5)	if(curunit->url) err(errflag,F_ERNOSIO,rsue+5)	if(!curunit->useek) err(errflag,F_ERSEEK,rsue+5)	return(OK);}e_wsue(){	long loc;	fwrite(&reclen,sizeof(int),1,cf);	loc=ftell(cf);	fseek(cf,recloc,0);	fwrite(&reclen,sizeof(int),1,cf);	fseek(cf,loc,0);	return(OK);}e_rsue(){	fseek(cf,(long)(reclen-recpos+sizeof(int)),1);	return(OK);}

⌨️ 快捷键说明

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