util/nvmutil: Show specific error for bad cmd argc

For example, if the brick command is used without specifying
a part number. Instead of saying "Invalid argument", show a
much more useful error message to help the user adapt.

Signed-off-by: Leah Rowe <leah@libreboot.org>
master
Leah Rowe 2025-01-24 18:14:25 +00:00
parent 073420d305
commit ec3148dc3b
1 changed files with 4 additions and 1 deletions

View File

@ -130,8 +130,11 @@ main(int argc, char *argv[])
for (int i = 0; (i < 6) && (cmd == NULL); i++) {
if (strcmp(COMMAND, op[i].str) != 0)
continue;
if (argc >= op[i].args)
if (argc >= op[i].args) {
cmd = op[i].cmd;
break;
}
err(errno = EINVAL, "Too few args on command '%s'", op[i].str);
}
if (cmd == cmd_setmac) {