|
|
1.1 root 1:
2: /*
3: doset( ioptr,offset,whence ) does an lssek on the file described
4: by ioptr with offset and whence. for output files, the buffer
5: must be flushed before doing the lseek. for input files, any
6: "unread" characters in the buffer must be lseeked back.
7: */
8:
9: #include "spitblks.h"
10: #include "spitio.h"
11:
12: doset( ioptr,offset,whence )
13:
14: struct ioblk *ioptr;
15: int offset;
16: int whence;
17:
18: {
19: struct bfblk *bfptr;
20:
21: if ( ioptr -> flg & IO_OUP ) {
22: flush( ioptr );
23: } else {
24: ioptr -> flg &= ~IO_EOF;
25: bfptr = ioptr -> buf;
26: if ( (bfptr -> rem != 0) && (whence == 1) )
27: lseek( ioptr -> fdn,-(bfptr -> rem),1 );
28: bfptr -> rem = 0;
29: bfptr -> off = 0;
30: }
31: return lseek( ioptr -> fdn,offset,whence );
32: }
33:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.