*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
#include <dirent.h>
#include <errno.h>
-int dirfd (DIR *dir)
+int (dirfd) (DIR *dir)
{
-#if defined (__sun__)
- return dir->dd_fd;
-#elif defined (__APPLE__)
- return dir->__dd_fd;
+#ifdef dirfd
+ return dirfd (dir);
#else
(void) dir;
# ifdef ENOTSUP