summaryrefslogtreecommitdiff
path: root/udevmonitor.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-08-21 02:38:20 +0200
committerKay Sievers <kay.sievers@suse.de>2006-08-21 02:38:20 +0200
commite3396a2d383cf19092911a4643e092f6a825b2aa (patch)
tree8b002d91b5af5b243d1bb623c22309a2e3c96cf4 /udevmonitor.c
parentc4edd0adb55ebf625a0f190071b930b469c58dd8 (diff)
cleanup commandline argument handling
Print and log failure, but don't fail for tools which are usually not used iteractively. Add '--help' to all tools.
Diffstat (limited to 'udevmonitor.c')
-rw-r--r--udevmonitor.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/udevmonitor.c b/udevmonitor.c
index 4c59a495db..6f2844ff15 100644
--- a/udevmonitor.c
+++ b/udevmonitor.c
@@ -118,22 +118,21 @@ int main(int argc, char *argv[])
for (i = 1 ; i < argc; i++) {
char *arg = argv[i];
- if (strcmp(arg, "--env") == 0 || strcmp(arg, "-e") == 0) {
+ if (strcmp(arg, "--env") == 0 || strcmp(arg, "-e") == 0)
env = 1;
- }
else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0){
- printf("Usage: udevmonitor [--env]\n"
+ printf("Usage: udevmonitor [--help] [--env]\n"
" --env print the whole event environment\n"
" --help print this help text\n\n");
exit(0);
} else {
- fprintf(stderr, "unknown option\n\n");
+ fprintf(stderr, "unrecognized option '%s'\n", arg);
exit(1);
}
}
if (getuid() != 0) {
- fprintf(stderr, "need to be root, exit\n\n");
+ fprintf(stderr, "root privileges required\n");
exit(2);
}