X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udevadm.c;h=6e7d7734d279ba498dc8b750ce61f5a7cfb8f195;hp=24e4d991be1a342ab0c671b11a59512ecef8e0e7;hb=7c389ce8a098fa02c93890205d715ecef6024c3e;hpb=225cb03bd851adc6d269b13bdf2b1bfded2b96b9 diff --git a/udevadm.c b/udevadm.c index 24e4d991b..6e7d7734d 100644 --- a/udevadm.c +++ b/udevadm.c @@ -26,7 +26,7 @@ #include "udev.h" -static int verbose; +static int debug; #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -37,9 +37,8 @@ void log_message(int priority, const char *format, ...) return; va_start(args, format); - if (verbose) { + if (debug) { vprintf(format, args); - printf("\n"); } else vsyslog(priority, format, args); va_end(args); @@ -50,7 +49,7 @@ struct command { const char *name; int (*cmd)(int argc, char *argv[], char *envp[]); const char *help; - int verbose; + int debug; }; static const struct command cmds[]; @@ -65,7 +64,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"); @@ -102,7 +101,7 @@ static const struct command cmds[] = { .name = "test", .cmd = udevtest, .help = "simulation run", - .verbose = 1, + .debug = 1, }, { .name = "version", @@ -145,13 +144,17 @@ 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) { - verbose = cmd->verbose; + debug = cmd->debug; rc = cmd->cmd(argc, argv, envp); goto out; }