diff options
author | ache <ache@FreeBSD.org> | 1999-05-28 01:59:23 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-05-28 01:59:23 +0000 |
commit | 2fbece35f71145c1c63d12046e54a9c059114d69 (patch) | |
tree | b727625e73f35f475e06719785a6f7a2d5126754 /contrib/libreadline/shell.c | |
parent | 27ef633cd3f7fd5fb6cb033edd2c1747a6e59acb (diff) | |
download | FreeBSD-src-2fbece35f71145c1c63d12046e54a9c059114d69.zip FreeBSD-src-2fbece35f71145c1c63d12046e54a9c059114d69.tar.gz |
readline v4.0
Diffstat (limited to 'contrib/libreadline/shell.c')
-rw-r--r-- | contrib/libreadline/shell.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/contrib/libreadline/shell.c b/contrib/libreadline/shell.c index 553f3c1..091ec08 100644 --- a/contrib/libreadline/shell.c +++ b/contrib/libreadline/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,22 +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. */ -char * -savestring (s) - char *s; -{ - return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s))); -} +/* 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 * @@ -126,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); +} |