#include "udev.h"
-static int verbose;
+static int debug;
#ifdef USE_LOG
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);
const char *name;
int (*cmd)(int argc, char *argv[], char *envp[]);
const char *help;
- int verbose;
+ int debug;
};
static const struct command cmds[];
{
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");
.name = "test",
.cmd = udevtest,
.help = "simulation run",
- .verbose = 1,
+ .debug = 1,
},
{
.name = "version",
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;
}