shell: fix compile failures in some configs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
8ed57db65b
commit
27be0e8cfe
@ -1939,9 +1939,15 @@ typedef struct line_input_t {
|
|||||||
# if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH
|
# if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH
|
||||||
/* function to fetch additional application-specific names to match */
|
/* function to fetch additional application-specific names to match */
|
||||||
get_exe_name_t *get_exe_name;
|
get_exe_name_t *get_exe_name;
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if (ENABLE_FEATURE_USERNAME_COMPLETION || ENABLE_FEATURE_EDITING_FANCY_PROMPT) \
|
||||||
|
&& (ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH)
|
||||||
/* function to fetch value of shell variable */
|
/* function to fetch value of shell variable */
|
||||||
sh_get_var_t *sh_get_var;
|
sh_get_var_t *sh_get_var;
|
||||||
# endif
|
# define EDITING_HAS_sh_get_var 1
|
||||||
|
# else
|
||||||
|
# define EDITING_HAS_sh_get_var 0
|
||||||
# endif
|
# endif
|
||||||
# if MAX_HISTORY
|
# if MAX_HISTORY
|
||||||
int cnt_history;
|
int cnt_history;
|
||||||
|
@ -249,14 +249,6 @@ static void get_user_strings(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *get_username_str(void)
|
|
||||||
{
|
|
||||||
if (!got_user_strings)
|
|
||||||
get_user_strings();
|
|
||||||
return user_buf ? user_buf : "";
|
|
||||||
/* btw, bash uses "I have no name!" string if uid has no entry */
|
|
||||||
}
|
|
||||||
|
|
||||||
static NOINLINE const char *get_homedir_or_NULL(void)
|
static NOINLINE const char *get_homedir_or_NULL(void)
|
||||||
{
|
{
|
||||||
const char *home;
|
const char *home;
|
||||||
@ -275,6 +267,16 @@ static NOINLINE const char *get_homedir_or_NULL(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_EDITING_FANCY_PROMPT
|
||||||
|
static const char *get_username_str(void)
|
||||||
|
{
|
||||||
|
if (!got_user_strings)
|
||||||
|
get_user_strings();
|
||||||
|
return user_buf ? user_buf : "";
|
||||||
|
/* btw, bash uses "I have no name!" string if uid has no entry */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLE_UNICODE_SUPPORT
|
#if ENABLE_UNICODE_SUPPORT
|
||||||
static size_t load_string(const char *src)
|
static size_t load_string(const char *src)
|
||||||
{
|
{
|
||||||
@ -2035,7 +2037,7 @@ static void parse_and_put_prompt(const char *prmt_ptr)
|
|||||||
case 'W': /* basename of cur dir */
|
case 'W': /* basename of cur dir */
|
||||||
if (!cwd_buf) {
|
if (!cwd_buf) {
|
||||||
const char *home;
|
const char *home;
|
||||||
#if ENABLE_SHELL_ASH
|
# if EDITING_HAS_sh_get_var
|
||||||
cwd_buf = state->sh_get_var
|
cwd_buf = state->sh_get_var
|
||||||
? xstrdup(state->sh_get_var("PWD"))
|
? xstrdup(state->sh_get_var("PWD"))
|
||||||
: xrealloc_getcwd_or_warn(NULL);
|
: xrealloc_getcwd_or_warn(NULL);
|
||||||
|
@ -9736,7 +9736,7 @@ evalpipe(union node *n, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* setinteractive needs this forward reference */
|
/* setinteractive needs this forward reference */
|
||||||
#if ENABLE_FEATURE_EDITING
|
#if ENABLE_FEATURE_TAB_COMPLETION
|
||||||
static const char *get_builtin_name(int i) FAST_FUNC;
|
static const char *get_builtin_name(int i) FAST_FUNC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -9773,8 +9773,12 @@ setinteractive(int on)
|
|||||||
#if ENABLE_FEATURE_EDITING
|
#if ENABLE_FEATURE_EDITING
|
||||||
if (!line_input_state) {
|
if (!line_input_state) {
|
||||||
line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP);
|
line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP);
|
||||||
|
# if ENABLE_FEATURE_TAB_COMPLETION
|
||||||
line_input_state->get_exe_name = get_builtin_name;
|
line_input_state->get_exe_name = get_builtin_name;
|
||||||
|
# endif
|
||||||
|
# if EDITING_HAS_sh_get_var
|
||||||
line_input_state->sh_get_var = lookupvar;
|
line_input_state->sh_get_var = lookupvar;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -10283,7 +10287,7 @@ find_builtin(const char *name)
|
|||||||
return bp;
|
return bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_FEATURE_EDITING
|
#if ENABLE_FEATURE_TAB_COMPLETION
|
||||||
static const char * FAST_FUNC
|
static const char * FAST_FUNC
|
||||||
get_builtin_name(int i)
|
get_builtin_name(int i)
|
||||||
{
|
{
|
||||||
|
@ -8188,7 +8188,7 @@ static const struct built_in_command *find_builtin(const char *name)
|
|||||||
return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]);
|
return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_HUSH_JOB && ENABLE_FEATURE_EDITING
|
#if ENABLE_HUSH_JOB && ENABLE_FEATURE_TAB_COMPLETION
|
||||||
static const char * FAST_FUNC get_builtin_name(int i)
|
static const char * FAST_FUNC get_builtin_name(int i)
|
||||||
{
|
{
|
||||||
if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) {
|
if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) {
|
||||||
@ -10668,9 +10668,13 @@ int hush_main(int argc, char **argv)
|
|||||||
|
|
||||||
# if ENABLE_FEATURE_EDITING
|
# if ENABLE_FEATURE_EDITING
|
||||||
G.line_input_state = new_line_input_t(FOR_SHELL);
|
G.line_input_state = new_line_input_t(FOR_SHELL);
|
||||||
|
# if ENABLE_FEATURE_TAB_COMPLETION
|
||||||
G.line_input_state->get_exe_name = get_builtin_name;
|
G.line_input_state->get_exe_name = get_builtin_name;
|
||||||
|
# endif
|
||||||
|
# if EDITING_HAS_sh_get_var
|
||||||
G.line_input_state->sh_get_var = get_local_var_value;
|
G.line_input_state->sh_get_var = get_local_var_value;
|
||||||
# endif
|
# endif
|
||||||
|
# endif
|
||||||
# if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0
|
# if ENABLE_HUSH_SAVEHISTORY && MAX_HISTORY > 0
|
||||||
{
|
{
|
||||||
const char *hp = get_local_var_value("HISTFILE");
|
const char *hp = get_local_var_value("HISTFILE");
|
||||||
|
Loading…
Reference in New Issue
Block a user