* reloc.c (enum complain_overflow): Correct comments.
[deliverable/binutils-gdb.git] / readline / tilde.c
index 154f7f8108d075569576990c9ee5c23be93b2950..60fc7fc6cdd1b9b7147a1694751f150bfdae97c8 100644 (file)
@@ -43,7 +43,9 @@
 #endif /* HAVE_STDLIB_H */
 
 #include <sys/types.h>
+#ifdef HAVE_PWD_H
 #include <pwd.h>
+#endif /* HAVE_PWD_H */
 
 #include "tilde.h"
 
@@ -53,10 +55,10 @@ static void *xmalloc (), *xrealloc ();
 #  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))
@@ -347,6 +349,7 @@ tilde_expand_word (filename)
   /* 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)
     {
@@ -374,6 +377,7 @@ tilde_expand_word (filename)
     }
 
   endpwent ();
+#endif
   return (dirname);
 }
 
This page took 0.025015 seconds and 4 git commands to generate.