diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-08-02 23:48:02 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-08-02 23:48:02 +0000 |
commit | c862e87b3ec8647ab6c1bb08443088ea81c74225 (patch) | |
tree | 8e5828b091fea3257c7ffc20a5c95f1d62b93267 /readline/tilde.c | |
parent | c95b01a9b04837dbfc8986afbbccc4c7d2b4ebf8 (diff) | |
download | gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.zip gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.tar.gz gdb-c862e87b3ec8647ab6c1bb08443088ea81c74225.tar.bz2 |
import gdb-1999-08-02 snapshot
Diffstat (limited to 'readline/tilde.c')
-rw-r--r-- | readline/tilde.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/readline/tilde.c b/readline/tilde.c index 3741f97..d1853bd 100644 --- a/readline/tilde.c +++ b/readline/tilde.c @@ -47,10 +47,6 @@ #include "tilde.h" -#ifdef SHELL -#include "shell.h" -#endif - #if !defined (HAVE_GETPW_DECLS) extern struct passwd *getpwuid (), *getpwnam (); #endif /* !HAVE_GETPW_DECLS */ @@ -77,6 +73,12 @@ static char *xmalloc (), *xrealloc (); extern char *xmalloc (), *xrealloc (); #endif /* TEST || STATIC_MALLOC */ +/* If being compiled as part of bash, these will be satisfied from + variables.o. If being compiled as part of readline, they will + be satisfied from shell.o. */ +extern char *get_home_dir (); +extern char *get_env_value (); + /* The default value of tilde_additional_prefixes. This is set to whitespace preceding a tilde so that simple programs which do not perform any word separation get desired behaviour. */ @@ -171,15 +173,6 @@ tilde_find_suffix (string) return (i); } -#if !defined (SHELL) -static char * -get_string_value (varname) - char *varname; -{ - return ((char *)getenv (varname)); -} -#endif - /* Return a new string which is the result of tilde expanding STRING. */ char * tilde_expand (string) @@ -284,27 +277,6 @@ glue_prefix_and_suffix (prefix, suffix, suffind) return ret; } -static char * -get_home_dir () -{ - char *home_dir; - -#ifdef SHELL - home_dir = (char *)NULL; - if (current_user.home_dir == 0) - get_current_user_info (); - home_dir = current_user.home_dir; -#else - struct passwd *entry; - - home_dir = (char *)NULL; - entry = getpwuid (getuid ()); - if (entry) - home_dir = entry->pw_dir; -#endif - return (home_dir); -} - /* Do the work of tilde expansion on FILENAME. FILENAME starts with a tilde. If there is no expansion, call tilde_expansion_failure_hook. This always returns a newly-allocated string, never static storage. */ @@ -328,7 +300,7 @@ tilde_expand_word (filename) if (filename[1] == '\0' || filename[1] == '/') { /* Prefix $HOME to the rest of the string. */ - expansion = get_string_value ("HOME"); + expansion = get_env_value ("HOME"); /* If there is no HOME variable, look up the directory in the password database. */ |