]> git.sur5r.net Git - u-boot/blobdiff - common/cmd_nvedit.c
Merge branch 'master' of /home/wd/git/u-boot/custodians
[u-boot] / common / cmd_nvedit.c
index ac9e5cfc3205797de41d3d0bba9e26bc3982e827..9f8d5319596d2a171f55035683c1eca61af21d11 100644 (file)
@@ -202,6 +202,37 @@ int _do_setenv (int flag, int argc, char *argv[])
                        break;
        }
 
+       /* Check for console redirection */
+       if (strcmp(name,"stdin") == 0) {
+               console = stdin;
+       } else if (strcmp(name,"stdout") == 0) {
+               console = stdout;
+       } else if (strcmp(name,"stderr") == 0) {
+               console = stderr;
+       }
+
+       if (console != -1) {
+               if (argc < 3) {         /* Cannot delete it! */
+                       printf("Can't delete \"%s\"\n", name);
+                       return 1;
+               }
+
+#ifdef CONFIG_CONSOLE_MUX
+               i = iomux_doenv(console, argv[2]);
+               if (i)
+                       return i;
+#else
+               /* Try assigning specified device */
+               if (console_assign (console, argv[2]) < 0)
+                       return 1;
+
+#ifdef CONFIG_SERIAL_MULTI
+               if (serial_assign (argv[2]) < 0)
+                       return 1;
+#endif
+#endif /* CONFIG_CONSOLE_MUX */
+       }
+
        /*
         * Delete any existing definition
         */
@@ -229,37 +260,6 @@ int _do_setenv (int flag, int argc, char *argv[])
                }
 #endif
 
-               /* Check for console redirection */
-               if (strcmp(name,"stdin") == 0) {
-                       console = stdin;
-               } else if (strcmp(name,"stdout") == 0) {
-                       console = stdout;
-               } else if (strcmp(name,"stderr") == 0) {
-                       console = stderr;
-               }
-
-               if (console != -1) {
-                       if (argc < 3) {         /* Cannot delete it! */
-                               printf("Can't delete \"%s\"\n", name);
-                               return 1;
-                       }
-
-#ifdef CONFIG_CONSOLE_MUX
-                       i = iomux_doenv(console, argv[2]);
-                       if (i)
-                               return i;
-#else
-                       /* Try assigning specified device */
-                       if (console_assign (console, argv[2]) < 0)
-                               return 1;
-
-#ifdef CONFIG_SERIAL_MULTI
-                       if (serial_assign (argv[2]) < 0)
-                               return 1;
-#endif
-#endif /* CONFIG_CONSOLE_MUX */
-               }
-
                /*
                 * Switch to new baudrate if new baudrate is supported
                 */
@@ -569,7 +569,7 @@ int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 U_BOOT_CMD(
        saveenv, 1, 0,  do_saveenv,
        "save environment variables to persistent storage",
-       NULL
+       ""
 );
 
 #endif
@@ -602,7 +602,7 @@ U_BOOT_CMD(
        "print environment variables",
        "\n    - print values of all environment variables\n"
        "printenv name ...\n"
-       "    - print value of environment variable 'name'\n"
+       "    - print value of environment variable 'name'"
 );
 
 U_BOOT_CMD(
@@ -611,7 +611,7 @@ U_BOOT_CMD(
        "name value ...\n"
        "    - set environment variable 'name' to 'value ...'\n"
        "setenv name\n"
-       "    - delete environment variable 'name'\n"
+       "    - delete environment variable 'name'"
 );
 
 #if defined(CONFIG_CMD_ASKENV)
@@ -627,7 +627,7 @@ U_BOOT_CMD(
        "    - get environment variable 'name' from stdin (max 'size' chars)\n"
        "askenv name [message] size\n"
        "    - display 'message' string and get environment variable 'name'"
-       "from stdin (max 'size' chars)\n"
+       "from stdin (max 'size' chars)"
 );
 #endif
 
@@ -637,6 +637,6 @@ U_BOOT_CMD(
        run,    CONFIG_SYS_MAXARGS,     1,      do_run,
        "run commands in an environment variable",
        "var [...]\n"
-       "    - run the commands in the environment variable(s) 'var'\n"
+       "    - run the commands in the environment variable(s) 'var'"
 );
 #endif