* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)stdio.c 5.3 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
* Small standard I/O/seek/close functions.
* These maintain the `known seek offset' for seek optimisation.
register FILE *fp
= cookie
;
ret
= read(fp
->_file
, buf
, n
);
/* if the read succeeded, update the current offset */
fp
->_flags
&= ~__SOFF
; /* paranoia */
register FILE *fp
= cookie
;
(void) lseek(fp
->_file
, (off_t
)0, SEEK_END
);
fp
->_flags
&= ~__SOFF
; /* in case FAPPEND mode is set */
return (write(fp
->_file
, buf
, n
));
__sseek(cookie
, offset
, whence
)
register FILE *fp
= cookie
;
ret
= lseek(fp
->_file
, (off_t
)offset
, whence
);
return (close(((FILE *)cookie
)->_file
));