summaryrefslogtreecommitdiff
path: root/src/udev/udevadm-test.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-17 21:48:14 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-18 23:58:23 -0500
commit7643ac9a8add1f07ffc237c054feb443b5612717 (patch)
tree7fb3f5ae619376e81754f3748a4efe23dde01d05 /src/udev/udevadm-test.c
parented142bdb68fdcd5ce591152ce0ec9d29898fbac4 (diff)
udevadm,scsi_id: add short options to help strings and to the man page
Also clean things up a bit here and there.
Diffstat (limited to 'src/udev/udevadm-test.c')
-rw-r--r--src/udev/udevadm-test.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index df1409bff6..cd75fad674 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -43,7 +43,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[])
struct udev_list_entry *entry;
sigset_t mask, sigmask_orig;
int err;
- int rc = 0;
+ int rc = 0, c;
static const struct option options[] = {
{ "action", required_argument, NULL, 'a' },
@@ -54,14 +54,8 @@ static int adm_test(struct udev *udev, int argc, char *argv[])
log_debug("version %s\n", VERSION);
- for (;;) {
- int option;
-
- option = getopt_long(argc, argv, "a:s:N:fh", options, NULL);
- if (option == -1)
- break;
-
- switch (option) {
+ while((c = getopt_long(argc, argv, "a:N:h", options, NULL)) >= 0)
+ switch (c) {
case 'a':
action = optarg;
break;
@@ -80,15 +74,18 @@ static int adm_test(struct udev *udev, int argc, char *argv[])
break;
case 'h':
printf("Usage: udevadm test OPTIONS <syspath>\n"
- " --action=<string> set action string\n"
- " --help\n\n");
+ " -a,--action=ACTION set action string\n"
+ " -N,--resolve-names=early|late|never when to resolve names\n"
+ " -h,--help print this help string\n"
+ "\n");
exit(EXIT_SUCCESS);
- default:
+ case '?':
exit(EXIT_FAILURE);
+ default:
+ assert_not_reached("Unknown option");
}
- }
- syspath = argv[optind];
+ syspath = argv[optind];
if (syspath == NULL) {
fprintf(stderr, "syspath parameter missing\n");
rc = 2;