aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/readdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/readdir.c')
-rw-r--r--sysdeps/unix/readdir.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c
index a17a26435d..4cb66ba2e4 100644
--- a/sysdeps/unix/readdir.c
+++ b/sysdeps/unix/readdir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,99,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,12 +27,18 @@
#include <dirstream.h>
+#ifndef __READDIR
+# define __READDIR __readdir
+# define __GETDENTS __getdents
+# define DIRENT_TYPE struct dirent
+# define __READDIR_ALIAS
+#endif
/* Read a directory entry from DIRP. */
-struct dirent *
-__readdir (DIR *dirp)
+DIRENT_TYPE *
+__READDIR (DIR *dirp)
{
- struct dirent *dp;
+ DIRENT_TYPE *dp;
__libc_lock_lock (dirp->lock);
@@ -54,7 +60,7 @@ __readdir (DIR *dirp)
maxread = dirp->allocation;
#endif
- bytes = __getdents (dirp->fd, dirp->data, maxread);
+ bytes = __GETDENTS (dirp->fd, dirp->data, maxread);
if (bytes <= 0)
{
dp = NULL;
@@ -66,12 +72,12 @@ __readdir (DIR *dirp)
dirp->offset = 0;
}
- dp = (struct dirent *) &dirp->data[dirp->offset];
+ dp = (DIRENT_TYPE *) &dirp->data[dirp->offset];
#ifdef _DIRENT_HAVE_D_RECLEN
reclen = dp->d_reclen;
#else
- /* The only version of `struct dirent' that lacks `d_reclen'
+ /* The only version of `struct dirent*' that lacks `d_reclen'
is fixed-size. */
assert (sizeof dp->d_name > 1);
reclen = sizeof *dp;
@@ -97,4 +103,7 @@ __readdir (DIR *dirp)
return dp;
}
+
+#ifdef __READDIR_ALIAS
weak_alias (__readdir, readdir)
+#endif