aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-11-18 14:05:20 -0700
committerTom Rini <trini@konsulko.com>2023-12-13 11:51:24 -0500
commit8632b36b96d38a85f2e71603a6f90ec9e4e5e37e (patch)
tree90955cdb3d121e37567fe4226f9862566220af57 /fs
parent1047b5340c1203f825c0a68b33997b787be0123e (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 4cb4310c9c..f33b85f92b 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -749,7 +749,7 @@ int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
if (argc > 7)
return CMD_RET_USAGE;
- if (fs_set_blk_dev(argv[1], (argc >= 3) ? argv[2] : NULL, fstype)) {
+ if (fs_set_blk_dev(argv[1], cmd_arg2(argc, argv), fstype)) {
log_err("Can't set block device\n");
return 1;
}
@@ -818,7 +818,7 @@ int do_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
if (argc > 4)
return CMD_RET_USAGE;
- if (fs_set_blk_dev(argv[1], (argc >= 3) ? argv[2] : NULL, fstype))
+ if (fs_set_blk_dev(argv[1], cmd_arg2(argc, argv), fstype))
return 1;
if (fs_ls(argc >= 4 ? argv[3] : "/"))