Import sources from 2011-03-30 iso image

This commit is contained in:
Taru Karttunen 2011-03-30 15:46:40 +03:00
commit e5888a1ffd
7810 changed files with 2489717 additions and 0 deletions

16
sys/src/libstdio/ftell.c Executable file
View file

@ -0,0 +1,16 @@
/*
* pANS stdio -- ftell
*/
#include "iolib.h"
long ftell(FILE *f){
long seekp=seek(f->fd, 0L, 1);
if(seekp<0) return -1; /* enter error state? */
switch(f->state){
default:
return seekp;
case RD:
return seekp-(f->wp-f->rp);
case WR:
return (f->flags&LINEBUF?f->lp:f->wp)-f->buf+seekp;
}
}