aboutsummaryrefslogtreecommitdiff
path: root/readline/shell.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-08-02 23:48:02 +0000
committerJason Molenda <jmolenda@apple.com>1999-08-02 23:48:02 +0000
commitc862e87b3ec8647ab6c1bb08443088ea81c74225 (patch)
tree8e5828b091fea3257c7ffc20a5c95f1d62b93267 /readline/shell.c
parentc95b01a9b04837dbfc8986afbbccc4c7d2b4ebf8 (diff)
downloadgdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.zip
gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.tar.gz
gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.tar.bz2
import gdb-1999-08-02 snapshot
Diffstat (limited to 'readline/shell.c')
-rw-r--r--readline/shell.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/readline/shell.c b/readline/shell.c
index 8bc2fe9..091ec08 100644
--- a/readline/shell.c
+++ b/readline/shell.c
@@ -26,10 +26,9 @@
# include <config.h>
#endif
+#include <sys/types.h>
+
#if defined (HAVE_UNISTD_H)
-# ifdef _MINIX
-# include <sys/types.h>
-# endif
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -45,24 +44,16 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
-extern char *xmalloc (), *xrealloc ();
+#include <pwd.h>
-#if !defined (SHELL)
+#if !defined (HAVE_GETPW_DECLS)
+extern struct passwd *getpwuid ();
+#endif /* !HAVE_GETPW_DECLS */
-#ifdef savestring
-#undef savestring
-#endif
+extern char *xmalloc ();
-/* Backwards compatibility, now that savestring has been removed from
- all `public' readline header files. */
-#if 0
-char *
-savestring (s)
- char *s;
-{
- return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
-}
-#endif
+/* All of these functions are resolved from bash if we are linking readline
+ as part of bash. */
/* Does shell-like quoting using single quotes. */
char *
@@ -128,13 +119,15 @@ get_env_value (varname)
return ((char *)getenv (varname));
}
-#else /* SHELL */
-extern char *get_string_value ();
-
char *
-get_env_value (varname)
- char *varname;
+get_home_dir ()
{
- return get_string_value (varname);
-}
-#endif /* SHELL */
+ char *home_dir;
+ struct passwd *entry;
+
+ home_dir = (char *)NULL;
+ entry = getpwuid (getuid ());
+ if (entry)
+ home_dir = entry->pw_dir;
+ return (home_dir);
+}