util/nvmutil: allow ./nvm gbe MAC
previously, if the user ran: ./nvm GBE [MAC address] it would error, treating the MAC as a command now if only 3 arguments are provided, and the 3rd argument ins't a valid command, it's treated as a MAC address and validated accordingly. this should make nvmutil easier to use, because I imagine a lot of users forget to use setmac there's no reason we should be so pedantic. we should allow it to be used flexibly like this Signed-off-by: Leah Rowe <leah@libreboot.org>master
parent
471ce4fbdc
commit
a70ab825b9
|
@ -149,7 +149,10 @@ main(int argc, char *argv[])
|
|||
cmd = cmd_setmac;
|
||||
}
|
||||
|
||||
if (cmd == cmd_setmac) {
|
||||
if ((cmd == NULL) && (argc > 2)) { /* nvm gbe [MAC] */
|
||||
strMac = COMMAND;
|
||||
cmd = cmd_setmac;
|
||||
} else if (cmd == cmd_setmac) { /* nvm gbe setmac [MAC] */
|
||||
strMac = strRMac; /* random MAC */
|
||||
if (argc > 3) /* user-supplied MAC (can be random) */
|
||||
strMac = MAC_ADDRESS;
|
||||
|
|
Loading…
Reference in New Issue