#include <afsconfig.h>
#include <afs/param.h>
+#ifdef AFS_HPUX_ENV
+/* We need the old directory type headers (included below), so don't include
+ * the normal dirent.h, or it will conflict. */
+# undef HAVE_DIRENT_H
+# include <sys/inode.h>
+# define LONGFILENAMES 1
+# include <sys/sysmacros.h>
+# include <sys/ino.h>
+# include <sys/signal.h>
+# define DIRSIZ_MACRO
+# ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
+# include </usr/old/usr/include/ndir.h>
+# else
+# include <ndir.h>
+# endif
+#endif
+
#include <roken.h>
#include <ctype.h>
#endif
#else /* AFS_VFSINCL_ENV */
#include <sys/inode.h>
-#ifdef AFS_HPUX_ENV
-#define LONGFILENAMES 1
-#include <sys/sysmacros.h>
-#include <sys/ino.h>
-#include <sys/signal.h>
-#define DIRSIZ_MACRO
-#ifdef HAVE_USR_OLD_USR_INCLUDE_NDIR_H
-#include </usr/old/usr/include/ndir.h>
-#else
-#include <ndir.h>
-#endif
-#else
+#ifndef AFS_HPUX_ENV
#include <sys/dir.h>
#endif
#include <sys/fs.h>
#if !defined(AFS_HPUX101_ENV)
long lseek();
#endif
-char *malloc();
#if defined(AFS_SUN_ENV)
extern int iscorrupt;
#endif