svn commit: [25851] trunk/busybox/shell

vapier at busybox.net vapier at busybox.net
Sat Mar 28 12:24:45 UTC 2009


Author: vapier
Date: 2009-03-28 12:24:44 +0000 (Sat, 28 Mar 2009)
New Revision: 25851

Log:
convert some of the ENABLE_FEATURE_EDITING from CPP if to C if

Modified:
   trunk/busybox/shell/hush.c


Changeset:
Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c	2009-03-28 12:21:57 UTC (rev 25850)
+++ trunk/busybox/shell/hush.c	2009-03-28 12:24:44 UTC (rev 25851)
@@ -1035,35 +1035,30 @@
 
 #if ENABLE_HUSH_INTERACTIVE
 
-#if ENABLE_FEATURE_EDITING
 static void cmdedit_set_initial_prompt(void)
 {
-#if !ENABLE_FEATURE_EDITING_FANCY_PROMPT
-	G.PS1 = NULL;
-#else
-	G.PS1 = getenv("PS1");
-	if (G.PS1 == NULL)
-		G.PS1 = "\\w \\$ ";
-#endif
+	if (ENABLE_FEATURE_EDITING_FANCY_PROMPT) {
+		G.PS1 = getenv("PS1");
+		if (G.PS1 == NULL)
+			G.PS1 = "\\w \\$ ";
+	} else
+		G.PS1 = NULL;
 }
-#endif /* EDITING */
 
 static const char* setup_prompt_string(int promptmode)
 {
 	const char *prompt_str;
 	debug_printf("setup_prompt_string %d ", promptmode);
-#if !ENABLE_FEATURE_EDITING_FANCY_PROMPT
-	/* Set up the prompt */
-	if (promptmode == 0) { /* PS1 */
-		free((char*)G.PS1);
-		G.PS1 = xasprintf("%s %c ", G.cwd, (geteuid() != 0) ? '$' : '#');
-		prompt_str = G.PS1;
-	} else {
-		prompt_str = G.PS2;
-	}
-#else
-	prompt_str = (promptmode == 0) ? G.PS1 : G.PS2;
-#endif
+	if (!ENABLE_FEATURE_EDITING_FANCY_PROMPT) {
+		/* Set up the prompt */
+		if (promptmode == 0) { /* PS1 */
+			free((char*)G.PS1);
+			G.PS1 = xasprintf("%s %c ", G.cwd, (geteuid() != 0) ? '$' : '#');
+			prompt_str = G.PS1;
+		} else
+			prompt_str = G.PS2;
+	} else
+		prompt_str = (promptmode == 0) ? G.PS1 : G.PS2;
 	debug_printf("result '%s'\n", prompt_str);
 	return prompt_str;
 }
@@ -4224,9 +4219,8 @@
 	/* Initialize some more globals to non-zero values */
 	set_cwd();
 #if ENABLE_HUSH_INTERACTIVE
-#if ENABLE_FEATURE_EDITING
-	cmdedit_set_initial_prompt();
-#endif
+	if (ENABLE_FEATURE_EDITING)
+		cmdedit_set_initial_prompt();
 	G.PS2 = "> ";
 #endif
 



More information about the busybox-cvs mailing list