Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/ape/lib/ap/stdio/fseeko.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/*
2
 * pANS stdio -- fseeko
3
 */
4
#include "iolib.h"
5
int fseeko(FILE *f, off_t offs, int type){
6
	switch(f->state){
7
	case ERR:
8
	case CLOSED:
9
		return -1;
10
	case WR:
11
		fflush(f);
12
		break;
13
	case RD:
14
		if(type==1 && f->buf!=f->unbuf)
15
			offs-=f->wp-f->rp;
16
		break;
17
	}
18
	if(f->flags&STRING || lseek(f->fd, offs, type)==-1)
19
		return -1;
20
	if(f->state==RD) f->rp=f->wp=f->buf;
21
	if(f->state!=OPEN)
22
		f->state=RDWR;
23
	return 0;
24
}