summaryrefslogtreecommitdiff
path: root/udevadm.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-11-09 00:49:50 +0100
committerKay Sievers <kay.sievers@vrfy.org>2007-11-09 00:49:50 +0100
commit3ca494515ccc7ba3cdfa946325bcf0273b899510 (patch)
treeab5427c6bf86e155670b8f29e8798c17f7c594b1 /udevadm.c
parent225cb03bd851adc6d269b13bdf2b1bfded2b96b9 (diff)
udevadm: accept command as option, like --help, --version
Diffstat (limited to 'udevadm.c')
-rw-r--r--udevadm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/udevadm.c b/udevadm.c
index 24e4d991be..e2b7779a91 100644
--- a/udevadm.c
+++ b/udevadm.c
@@ -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) {