/* Coypright (c) 1980 Regents of the University of California */
static char sccsid
[] = "@(#)asio.c 4.2 %G%";
* Block I/O routines for logical I/O concurrently in
* more than one place in the same file.
int biofd
; /* file descriptor for block I/O file */
off_t boffset
; /* physical position in logical file */
BFILE
*biobufs
; /* the block I/O buffers */
#define error(severity, message) \
{yyerror(message); if (severity) delexit();}
* This is our version of fwrite...
* Hacked out fast version of fwrite that
* doesn't iterate over each and every character;
* We poke directly into the buffer area, and move things
register int cnt
= n
* m
;
asm("movc3 r8,(r11),(r7)");
put
= cnt
- cnt
% BUFSIZ
;
if (write(f
->_file
, p
, put
) != put
)
error(1, "Output write error in fwrite");
* This has been stolen from the usual place...
* It is put here so that the loader doesn't complain
* about multiple definitions in the archived object module.
* archived in: /lib/libc.a
* object module from: /usr/src/libc/stdio/rdwr.c
fread(ptr
, size
, count
, iop
)
for (; ndone
<count
; ndone
++) {
if ((c
= getc(iop
)) >= 0)
bp
->b_nleft
= BUFSIZ
- off
% BUFSIZ
;
register struct biobuf
*bp
;
asm("movc3 r8,(r11),(r7)");
if (bp
->b_ptr
!= bp
->b_buf
)
put
= cnt
- cnt
% BUFSIZ
;
if (boffset
!= bp
->b_off
)
lseek(biofd
, bp
->b_off
, 0);
if (write(biofd
, p
, put
) != put
) {
error(1, "Output write error");
register struct biobuf
*bp
;
for (bp
= biobufs
; bp
; bp
= bp
->b_link
)
register struct biobuf
*bp
;
register int cnt
= bp
->b_ptr
- bp
->b_buf
;
if (boffset
!= bp
->b_off
)
lseek(biofd
, bp
->b_off
, 0);
if (write(biofd
, bp
->b_buf
, cnt
) != cnt
) {
error(1, "Output write error");
register struct biobuf
*bp
;