aboutsummaryrefslogtreecommitdiffstats
path: root/usr/klibc/stdio/ftell.c
blob: cb1202da0bc1fcf67507b3daf3f6e5b225b960ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include "stdioint.h"

off_t ftell(FILE *file)
{
	struct _IO_file_pvt *f = stdio_pvt(file);
	off_t pos = lseek(f->pub._IO_fileno, 0, SEEK_CUR);

	if (pos >= 0)
		pos += (int)f->obytes - (int)f->ibytes;

	return pos;
}