* Code cleanup:
  - remove trailing white space, trailing empty lines, C++ comments, etc.
  - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
  - major rework of command structure
    (work done mostly by Michal Cendrowski and Joakim Kristiansen)
diff --git a/common/hush.c b/common/hush.c
index 1993398..dbb952d 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -94,7 +94,8 @@
 #include <common.h>        /* readline */
 #include <hush.h>
 #include <command.h>        /* find_cmd */
-#include <cmd_bootm.h>      /* do_bootd */
+/*cmd_boot.c*/
+extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);      /* do_bootd */
 #endif
 #ifdef CFG_HUSH_PARSER
 #ifndef __U_BOOT__
@@ -1048,12 +1049,12 @@
 		i->p = the_command;
 	}
 	else {
-	        if (console_buffer[0] != '\n') {
-	                if (strlen(the_command) + strlen(console_buffer)
+		if (console_buffer[0] != '\n') {
+			if (strlen(the_command) + strlen(console_buffer)
 			    < CFG_CBSIZE) {
-			        n = strlen(the_command);
-			        the_command[n-1] = ' ';
-			        strcpy(&the_command[n],console_buffer);
+				n = strlen(the_command);
+				the_command[n-1] = ' ';
+				strcpy(&the_command[n],console_buffer);
 			}
 			else {
 				the_command[0] = '\n';
@@ -1257,8 +1258,8 @@
 			if (p != child->argv[i]) free(p);
 		}
 		child->argv+=i;  /* XXX this hack isn't so horrible, since we are about
-		                        to exit, and therefore don't need to keep data
-		                        structures consistent for free() use. */
+					to exit, and therefore don't need to keep data
+					structures consistent for free() use. */
 		/* If a variable is assigned in a forest, and nobody listens,
 		 * was it ever really set?
 		 */
@@ -1648,14 +1649,18 @@
 					child->argv[i]);
 				return -1;
 			}
-		   	/* Look up command in command table */
+			/* Look up command in command table */
+
+
 			if ((cmdtp = find_cmd(child->argv[i])) == NULL) {
 				printf ("Unknown command '%s' - try 'help'\n", child->argv[i]);
 				return -1;	/* give up after bad command */
 			} else {
 				int rcode;
 #if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
-		                /* avoid "bootd" recursion */
+	    extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+
+				/* avoid "bootd" recursion */
 				if (cmdtp->cmd == do_bootd) {
 					if (flag & CMD_FLAG_BOOTD) {
 						printf ("'bootd' recursion detected\n");
@@ -1665,7 +1670,7 @@
 					flag |= CMD_FLAG_BOOTD;
 				}
 #endif	/* CFG_CMD_BOOTD */
-		                /* found - check max args */
+				/* found - check max args */
 				if ((child->argc - i) > cmdtp->maxargs) {
 					printf ("Usage:\n%s\n", cmdtp->usage);
 					return -1;
@@ -1676,15 +1681,20 @@
 				rcode = x->function(child);
 #else
 				/* OK - call function to do the command */
+
 				rcode = (cmdtp->cmd)
-					(cmdtp, flag,child->argc-i,&child->argv[i]);
+(cmdtp, flag,child->argc-i,&child->argv[i]);
 				if ( !cmdtp->repeatable )
 					flag_repeat = 0;
+
+
 #endif
 				child->argv-=i;  /* XXX restore hack so free() can work right */
 #ifndef __U_BOOT__
+
 				restore_redirects(squirrel);
 #endif
+
 				return rcode;
 			}
 		}
@@ -1965,11 +1975,11 @@
 #ifndef __U_BOOT__
 			globfree(&child->glob_result);
 #else
-	                for (a = child->argc;a >= 0;a--) {
-	                        free(child->argv[a]);
-	                }
+			for (a = child->argc;a >= 0;a--) {
+				free(child->argv[a]);
+			}
 					free(child->argv);
-	                child->argc = 0;
+			child->argc = 0;
 #endif
 			child->argv=NULL;
 		} else if (child->group) {
@@ -2103,17 +2113,17 @@
 {
 	int gr;
 
- 	/* short-circuit for null word */
+	/* short-circuit for null word */
 	/* we can code this better when the debug_printf's are gone */
- 	if (dest->length == 0) {
- 		if (dest->nonnull) {
- 			/* bash man page calls this an "explicit" null */
- 			gr = globhack(dest->data, flags, pglob);
- 			debug_printf("globhack returned %d\n",gr);
- 		} else {
+	if (dest->length == 0) {
+		if (dest->nonnull) {
+			/* bash man page calls this an "explicit" null */
+			gr = globhack(dest->data, flags, pglob);
+			debug_printf("globhack returned %d\n",gr);
+		} else {
 			return 0;
 		}
- 	} else if (glob_needed(dest->data)) {
+	} else if (glob_needed(dest->data)) {
 		gr = glob(dest->data, flags, NULL, pglob);
 		debug_printf("glob returned %d\n",gr);
 		if (gr == GLOB_NOMATCH) {
@@ -2462,7 +2472,7 @@
 		}
 #ifndef __U_BOOT__
 		glob_target = &child->glob_result;
- 		if (child->argv) flags |= GLOB_APPEND;
+		if (child->argv) flags |= GLOB_APPEND;
 #else
 		for (cnt = 1, s = dest->data; s && *s; s++) {
 			if (*s == '\\') s++;
@@ -2522,9 +2532,9 @@
 	struct child_prog *prog=ctx->child;
 
 	if (prog && prog->group == NULL
-	         && prog->argv == NULL
+		 && prog->argv == NULL
 #ifndef __U_BOOT__
-	         && prog->redirects == NULL) {
+		 && prog->redirects == NULL) {
 #else
 										) {
 #endif
@@ -3339,7 +3349,7 @@
 	debug_printf("\ninteractive=%d\n", interactive);
 	if (interactive) {
 		/* Looks like they want an interactive shell */
-#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET 
+#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
 		printf( "\n\n" BB_BANNER " hush - the humble shell v0.01 (testing)\n");
 		printf( "Enter 'help' for a list of built-in commands.\n\n");
 #endif