2011-11-11 14:55:13 +01:00
|
|
|
--- lib/readline/complete.c
|
2011-11-21 14:32:56 +01:00
|
|
|
+++ lib/readline/complete.c 2011-11-21 12:51:35.695646715 +0000
|
2011-11-11 14:55:13 +01:00
|
|
|
@@ -83,6 +83,7 @@ typedef int QSFUNC ();
|
|
|
|
defined. */
|
|
|
|
#if defined (HAVE_GETPWENT) && (!defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE))
|
|
|
|
extern struct passwd *getpwent PARAMS((void));
|
|
|
|
+extern void endpwent ();
|
|
|
|
#endif /* HAVE_GETPWENT && (!HAVE_GETPW_DECLS || _POSIX_SOURCE) */
|
|
|
|
|
|
|
|
/* If non-zero, then this is the address of a function to call when
|
2011-11-21 14:32:56 +01:00
|
|
|
@@ -2068,6 +2069,9 @@ rl_username_completion_function (text, s
|
|
|
|
if (first_char == '~')
|
|
|
|
rl_filename_completion_desired = 1;
|
|
|
|
|
2011-11-11 14:55:13 +01:00
|
|
|
+#if defined (HAVE_GETPWENT)
|
2011-11-21 16:34:56 +01:00
|
|
|
+ /* endpwent (); */
|
2011-11-11 14:55:13 +01:00
|
|
|
+#endif
|
2011-11-21 14:32:56 +01:00
|
|
|
return (value);
|
2011-11-11 14:55:13 +01:00
|
|
|
}
|
2011-11-21 14:32:56 +01:00
|
|
|
#endif /* !__WIN32__ && !__OPENNT */
|
2011-11-11 14:55:13 +01:00
|
|
|
--- lib/readline/shell.c
|
2011-11-21 14:32:56 +01:00
|
|
|
+++ lib/readline/shell.c 2011-11-21 13:08:46.343647023 +0000
|
|
|
|
@@ -61,9 +61,18 @@
|
2011-11-11 14:55:13 +01:00
|
|
|
#include "rlshell.h"
|
|
|
|
#include "xmalloc.h"
|
|
|
|
|
|
|
|
-#if defined (HAVE_GETPWUID) && !defined (HAVE_GETPW_DECLS)
|
|
|
|
+#if !defined (HAVE_GETPW_DECLS)
|
|
|
|
+# if defined (HAVE_GETPWUID)
|
|
|
|
extern struct passwd *getpwuid PARAMS((uid_t));
|
|
|
|
-#endif /* HAVE_GETPWUID && !HAVE_GETPW_DECLS */
|
|
|
|
+# endif
|
|
|
|
+# if defined (HAVE_GETPWENT)
|
|
|
|
+extern void endpwent ();
|
|
|
|
+# endif
|
|
|
|
+#endif /* !HAVE_GETPW_DECLS */
|
2011-11-21 14:32:56 +01:00
|
|
|
+
|
|
|
|
+#if !defined (savestring)
|
|
|
|
+# define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
|
|
|
|
+#endif /* !savestring */
|
2011-11-11 14:55:13 +01:00
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
# define NULL 0
|
2011-11-21 14:32:56 +01:00
|
|
|
@@ -159,15 +168,20 @@ sh_get_env_value (varname)
|
|
|
|
char *
|
|
|
|
sh_get_home_dir ()
|
|
|
|
{
|
|
|
|
- char *home_dir;
|
|
|
|
+ static char *home_dir;
|
|
|
|
struct passwd *entry;
|
|
|
|
|
|
|
|
- home_dir = (char *)NULL;
|
|
|
|
+ if (home_dir)
|
|
|
|
+ goto out;
|
|
|
|
#if defined (HAVE_GETPWUID)
|
|
|
|
entry = getpwuid (getuid ());
|
2011-11-11 14:55:13 +01:00
|
|
|
if (entry)
|
2011-11-21 14:32:56 +01:00
|
|
|
- home_dir = entry->pw_dir;
|
|
|
|
+ home_dir = savestring(entry->pw_dir);
|
2011-11-11 14:55:13 +01:00
|
|
|
#endif
|
|
|
|
+#if defined (HAVE_GETPWENT)
|
|
|
|
+ endpwent ();
|
|
|
|
+#endif
|
2011-11-21 14:32:56 +01:00
|
|
|
+out:
|
2011-11-11 14:55:13 +01:00
|
|
|
return (home_dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
--- lib/readline/tilde.c
|
2011-11-21 14:32:56 +01:00
|
|
|
+++ lib/readline/tilde.c 2011-11-11 13:09:49.000000000 +0000
|
2011-11-11 14:55:13 +01:00
|
|
|
@@ -61,6 +61,7 @@ extern struct passwd *getpwuid PARAMS((u
|
|
|
|
# endif
|
|
|
|
# if defined (HAVE_GETPWNAM)
|
|
|
|
extern struct passwd *getpwnam PARAMS((const char *));
|
|
|
|
+extern void endpwent ();
|
|
|
|
# endif
|
|
|
|
#endif /* !HAVE_GETPW_DECLS */
|
|
|
|
|