command: Introduce functions to obtain command arguments
Add some functions which provide an argument to a command, or NULL if
the argument does not exist.
Use the same numbering as argv[] since it seems less confusing than the
previous idea.
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
diff --git a/cmd/booti.c b/cmd/booti.c
index dc73c83..2db8f4a 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -95,8 +95,8 @@
* Handle the BOOTM_STATE_FINDOTHER state ourselves as we do not
* have a header that provide this informaiton.
*/
- if (bootm_find_images(image_load_addr, argc > 1 ? argv[1] : NULL,
- argc > 2 ? argv[2] : NULL, relocated_addr,
+ if (bootm_find_images(image_load_addr, cmd_arg1(argc, argv),
+ cmd_arg2(argc, argv), relocated_addr,
image_size))
return 1;