#endif /* HAVE_STDLIB_H */
#include <sys/types.h>
+#ifdef HAVE_PWD_H
#include <pwd.h>
+#endif /* HAVE_PWD_H */
#include "tilde.h"
# include "xmalloc.h"
#endif /* TEST || STATIC_MALLOC */
-#if !defined (HAVE_GETPW_DECLS)
+#if defined (HAVE_GETPWNAM) && !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid PARAMS((uid_t));
extern struct passwd *getpwnam PARAMS((const char *));
-#endif /* !HAVE_GETPW_DECLS */
+#endif /* defined (HAVE_GETPWNAM) && !HAVE_GETPW_DECLS */
#if !defined (savestring)
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
/* No preexpansion hook, or the preexpansion hook failed. Look in the
password database. */
dirname = (char *)NULL;
+#ifdef HAVE_GETPWNAM
user_entry = getpwnam (username);
if (user_entry == 0)
{
}
endpwent ();
+#endif
return (dirname);
}