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
parent
073420d305
commit
ec3148dc3b
|
@ -130,8 +130,11 @@ main(int argc, char *argv[])
|
||||||
for (int i = 0; (i < 6) && (cmd == NULL); i++) {
|
for (int i = 0; (i < 6) && (cmd == NULL); i++) {
|
||||||
if (strcmp(COMMAND, op[i].str) != 0)
|
if (strcmp(COMMAND, op[i].str) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (argc >= op[i].args)
|
if (argc >= op[i].args) {
|
||||||
cmd = op[i].cmd;
|
cmd = op[i].cmd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
err(errno = EINVAL, "Too few args on command '%s'", op[i].str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd == cmd_setmac) {
|
if (cmd == cmd_setmac) {
|
||||||
|
|
Loading…
Reference in New Issue