diff options
| author | Leah Rowe <leah@libreboot.org> | 2025-01-29 04:07:54 +0000 | 
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2025-01-29 04:07:54 +0000 | 
| commit | a65a0c2f963491798d82d5012bcf09e40538a34c (patch) | |
| tree | 8f580b51b9dd8c766cbf2175437454ee1c601e1f | |
| parent | 96356ce94f66ee55a35d40e2098ebb9bfba173c7 (diff) | |
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>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 5 | 
1 files changed, 4 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 0576167f..b8319a0d 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -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;  | 
