From 167217bec15c9c7aa70ba2a3dc9c689b3cd91872 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 14 May 2001 14:19:32 +0000 Subject: import new version of dietlibc --- mdk-stage1/dietlibc/lib/telldir.c | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) (limited to 'mdk-stage1/dietlibc/lib/telldir.c') diff --git a/mdk-stage1/dietlibc/lib/telldir.c b/mdk-stage1/dietlibc/lib/telldir.c index eca175381..58be5d034 100644 --- a/mdk-stage1/dietlibc/lib/telldir.c +++ b/mdk-stage1/dietlibc/lib/telldir.c @@ -1,38 +1,7 @@ +#include "dietdirent.h" #include -#include +#include -#include "dirstream.h" - -#undef telldir -off_t -telldir(DIR * dir) -{ - off_t offset; - - if (!dir) { - errno = EBADF; - return -1; - } - - switch (dir->dd_getdents) - { - case no_getdents: - /* We are running the old kernel. This is the starting offset - of the next readdir(). */ - offset = lseek(dir->dd_fd, 0, SEEK_CUR); - break; - - case unknown: - /* readdir () is not called yet. but seekdir () may be called. */ - case have_getdents: - /* The next entry. */ - offset = dir->dd_nextoff; - break; - - default: - errno = EBADF; - offset = -1; - } - - return offset; +off_t telldir(DIR *d) { + return lseek(d->fd,0,SEEK_CUR)-d->num+d->cur; } -- cgit v1.2.1