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