summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/telldir.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
commit167217bec15c9c7aa70ba2a3dc9c689b3cd91872 (patch)
tree7c0c62debf8f9f145643102fb52b81afce743594 /mdk-stage1/dietlibc/lib/telldir.c
parent9097327dc1c667fc51b8e05cc7c0626fac96665d (diff)
downloaddrakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.gz
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.bz2
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.xz
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.zip
import new version of dietlibc
Diffstat (limited to 'mdk-stage1/dietlibc/lib/telldir.c')
-rw-r--r--mdk-stage1/dietlibc/lib/telldir.c39
1 files changed, 4 insertions, 35 deletions
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 <unistd.h>
-#include <errno.h>
+#include <dirent.h>
-#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;
}