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/mmc.c b/cmd/mmc.c
index 96befb2..2d5430a 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -946,7 +946,7 @@
}
if (argc == 2 || argc == 3)
- return mmc_partconf_print(mmc, argc == 3 ? argv[2] : NULL);
+ return mmc_partconf_print(mmc, cmd_arg2(argc, argv));
ack = dectoul(argv[2], NULL);
part_num = dectoul(argv[3], NULL);