diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-11-09 00:49:50 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-11-09 00:49:50 +0100 |
commit | 3ca494515ccc7ba3cdfa946325bcf0273b899510 (patch) | |
tree | ab5427c6bf86e155670b8f29e8798c17f7c594b1 /udevadm.c | |
parent | 225cb03bd851adc6d269b13bdf2b1bfded2b96b9 (diff) |
udevadm: accept command as option, like --help, --version
Diffstat (limited to 'udevadm.c')
-rw-r--r-- | udevadm.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -65,7 +65,7 @@ static int help(int argc, char *argv[], char *envp[]) { const struct command *cmd; - printf("Usage: udev COMMAND [OPTIONS]\n"); + printf("Usage: udevadm COMMAND [OPTIONS]\n"); for (cmd = cmds; cmd->name != NULL; cmd++) printf(" %-12s %s\n", cmd->name, cmd->help); printf("\n"); @@ -145,9 +145,13 @@ int main(int argc, char *argv[], char *envp[]) argc--; } - if (command == NULL || command[0] == '\0') + if (command == NULL) goto err_unknown; + /* allow command to be specified as an option */ + if (strncmp(command, "--", 2) == 0) + command += 2; + /* find and execute command */ for (cmd = cmds; cmd->name != NULL; cmd++) { if (strcmp(cmd->name, command) == 0) { |