diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-03-28 12:24:44 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-03-28 12:24:44 +0000 |
commit | ec2c6557025f55098ce2daa2e6f6c7aa2630c00e (patch) | |
tree | 95827141883f01245b505ad51b2266e49da6c435 | |
parent | 39456a18a104b228de240b265bd943251219849d (diff) | |
download | busybox-w32-ec2c6557025f55098ce2daa2e6f6c7aa2630c00e.tar.gz busybox-w32-ec2c6557025f55098ce2daa2e6f6c7aa2630c00e.tar.bz2 busybox-w32-ec2c6557025f55098ce2daa2e6f6c7aa2630c00e.zip |
convert some of the ENABLE_FEATURE_EDITING from CPP if to C if
-rw-r--r-- | shell/hush.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/shell/hush.c b/shell/hush.c index 51df2d6dc..275d618c8 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1035,35 +1035,30 @@ static int static_peek(struct in_str *i) | |||
1035 | 1035 | ||
1036 | #if ENABLE_HUSH_INTERACTIVE | 1036 | #if ENABLE_HUSH_INTERACTIVE |
1037 | 1037 | ||
1038 | #if ENABLE_FEATURE_EDITING | ||
1039 | static void cmdedit_set_initial_prompt(void) | 1038 | static void cmdedit_set_initial_prompt(void) |
1040 | { | 1039 | { |
1041 | #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT | 1040 | if (ENABLE_FEATURE_EDITING_FANCY_PROMPT) { |
1042 | G.PS1 = NULL; | 1041 | G.PS1 = getenv("PS1"); |
1043 | #else | 1042 | if (G.PS1 == NULL) |
1044 | G.PS1 = getenv("PS1"); | 1043 | G.PS1 = "\\w \\$ "; |
1045 | if (G.PS1 == NULL) | 1044 | } else |
1046 | G.PS1 = "\\w \\$ "; | 1045 | G.PS1 = NULL; |
1047 | #endif | ||
1048 | } | 1046 | } |
1049 | #endif /* EDITING */ | ||
1050 | 1047 | ||
1051 | static const char* setup_prompt_string(int promptmode) | 1048 | static const char* setup_prompt_string(int promptmode) |
1052 | { | 1049 | { |
1053 | const char *prompt_str; | 1050 | const char *prompt_str; |
1054 | debug_printf("setup_prompt_string %d ", promptmode); | 1051 | debug_printf("setup_prompt_string %d ", promptmode); |
1055 | #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT | 1052 | if (!ENABLE_FEATURE_EDITING_FANCY_PROMPT) { |
1056 | /* Set up the prompt */ | 1053 | /* Set up the prompt */ |
1057 | if (promptmode == 0) { /* PS1 */ | 1054 | if (promptmode == 0) { /* PS1 */ |
1058 | free((char*)G.PS1); | 1055 | free((char*)G.PS1); |
1059 | G.PS1 = xasprintf("%s %c ", G.cwd, (geteuid() != 0) ? '$' : '#'); | 1056 | G.PS1 = xasprintf("%s %c ", G.cwd, (geteuid() != 0) ? '$' : '#'); |
1060 | prompt_str = G.PS1; | 1057 | prompt_str = G.PS1; |
1061 | } else { | 1058 | } else |
1062 | prompt_str = G.PS2; | 1059 | prompt_str = G.PS2; |
1063 | } | 1060 | } else |
1064 | #else | 1061 | prompt_str = (promptmode == 0) ? G.PS1 : G.PS2; |
1065 | prompt_str = (promptmode == 0) ? G.PS1 : G.PS2; | ||
1066 | #endif | ||
1067 | debug_printf("result '%s'\n", prompt_str); | 1062 | debug_printf("result '%s'\n", prompt_str); |
1068 | return prompt_str; | 1063 | return prompt_str; |
1069 | } | 1064 | } |
@@ -4224,9 +4219,8 @@ int hush_main(int argc, char **argv) | |||
4224 | /* Initialize some more globals to non-zero values */ | 4219 | /* Initialize some more globals to non-zero values */ |
4225 | set_cwd(); | 4220 | set_cwd(); |
4226 | #if ENABLE_HUSH_INTERACTIVE | 4221 | #if ENABLE_HUSH_INTERACTIVE |
4227 | #if ENABLE_FEATURE_EDITING | 4222 | if (ENABLE_FEATURE_EDITING) |
4228 | cmdedit_set_initial_prompt(); | 4223 | cmdedit_set_initial_prompt(); |
4229 | #endif | ||
4230 | G.PS2 = "> "; | 4224 | G.PS2 = "> "; |
4231 | #endif | 4225 | #endif |
4232 | 4226 | ||