chiark / gitweb /
use no_argument, required_argument, optional_argument in longopts
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 2 Oct 2008 14:49:05 +0000 (16:49 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 2 Oct 2008 14:49:05 +0000 (16:49 +0200)
16 files changed:
extras/ata_id/ata_id.c
extras/cdrom_id/cdrom_id.c
extras/collect/collect.c
extras/fstab_import/fstab_import.c
extras/scsi_id/scsi_id.c
extras/usb_id/usb_id.c
extras/volume_id/vol_id.c
udev/lib/test-libudev.c
udev/udevadm-control.c
udev/udevadm-info.c
udev/udevadm-monitor.c
udev/udevadm-settle.c
udev/udevadm-test.c
udev/udevadm-trigger.c
udev/udevadm.c
udev/udevd.c

index 927dbfabd7c83c2b564050b62778c136a735a28f..a4f73b8dfd8d6719ade449147a6fa58f7669fb88 100644 (file)
@@ -88,8 +88,8 @@ int main(int argc, char *argv[])
        int fd;
        int rc = 0;
        static const struct option options[] = {
-               { "export", 0, NULL, 'x' },
-               { "help", 0, NULL, 'h' },
+               { "export", no_argument, NULL, 'x' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
 
index 627ae0dee4f7a4897a93abbb3beb41912e4b42f2..381aa70bedb1a94f64520dc55fc78738c8021994 100644 (file)
@@ -503,9 +503,9 @@ int main(int argc, char *argv[])
 {
        struct udev *udev;
        static const struct option options[] = {
-               { "export", 0, NULL, 'x' },
-               { "debug", 0, NULL, 'd' },
-               { "help", 0, NULL, 'h' },
+               { "export", no_argument, NULL, 'x' },
+               { "debug", no_argument, NULL, 'd' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
        const char *node = NULL;
index 14184a5e058977361d9927afce60005e8517d806..7ebe865b62c7e5864c60cc4df5b2700e0a10d375 100644 (file)
@@ -321,10 +321,10 @@ static void everybody(void)
 int main(int argc, char **argv)
 {
        static const struct option options[] = {
-               { "add", 0, NULL, 'a' },
-               { "remove", 0, NULL, 'r' },
-               { "debug", 0, NULL, 'd' },
-               { "help", 0, NULL, 'h' },
+               { "add", no_argument, NULL, 'a' },
+               { "remove", no_argument, NULL, 'r' },
+               { "debug", no_argument, NULL, 'd' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
        int argi;
index 71ab5d34ee8868e9add0b324a5e41320640c0d5e..e793604faa2e2e9019c340d2df157c4df8b384b5 100644 (file)
@@ -66,9 +66,9 @@ int main(int argc, char *argv[])
 {
        struct udev *udev;
        static const struct option options[] = {
-               { "export", 0, NULL, 'x' },
-               { "debug", 0, NULL, 'd' },
-               { "help", 0, NULL, 'h' },
+               { "export", no_argument, NULL, 'x' },
+               { "debug", no_argument, NULL, 'd' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
        char **devices;
index 10ec98c8bf5c7f319cf888f76bffe4ee0776dd51..6334af386b0910c9ee1a09c7ded395cfb513b85e 100644 (file)
 #include "scsi_id.h"
 
 static const struct option options[] = {
-       { "device", 1, NULL, 'd' },
-       { "config", 1, NULL, 'f' },
-       { "page", 1, NULL, 'p' },
-       { "blacklisted", 0, NULL, 'b' },
-       { "whitelisted", 0, NULL, 'g' },
-       { "replace-whitespace", 0, NULL, 'u' },
-       { "sg-version", 1, NULL, 's' },
-       { "verbose", 0, NULL, 'v' },
-       { "version", 0, NULL, 'V' },
-       { "export", 0, NULL, 'x' },
-       { "help", 0, NULL, 'h' },
+       { "device", required_argument, NULL, 'd' },
+       { "config", required_argument, NULL, 'f' },
+       { "page", required_argument, NULL, 'p' },
+       { "blacklisted", no_argument, NULL, 'b' },
+       { "whitelisted", no_argument, NULL, 'g' },
+       { "replace-whitespace", no_argument, NULL, 'u' },
+       { "sg-version", required_argument, NULL, 's' },
+       { "verbose", no_argument, NULL, 'v' },
+       { "version", no_argument, NULL, 'V' },
+       { "export", no_argument, NULL, 'x' },
+       { "help", no_argument, NULL, 'h' },
        {}
 };
 
index 215455212042ce568c8dff0334033554a39fb508..f39496b07c7a47bf962e22da42173c585a2e4bcb 100644 (file)
@@ -359,10 +359,10 @@ int main(int argc, char **argv)
        char devpath[MAX_PATH_LEN];
        static int export;
        static const struct option options[] = {
-               { "usb-info", 0, NULL, 'u' },
-               { "num-info", 0, NULL, 'n' },
-               { "export", 0, NULL, 'x' },
-               { "help", 0, NULL, 'h' },
+               { "usb-info", no_argument, NULL, 'u' },
+               { "num-info", no_argument, NULL, 'n' },
+               { "export", no_argument, NULL, 'x' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
 
index b47d6a4ecb1792819d2ba961542291c542cda3d2..0137b84fbeac91e8a51878b057c8e4bafe82bb42 100644 (file)
@@ -111,16 +111,16 @@ static int all_probers(volume_id_probe_fn_t probe_fn,
 int main(int argc, char *argv[])
 {
        static const struct option options[] = {
-               { "label", 0, NULL, 'l' },
-               { "label-raw", 0, NULL, 'L' },
-               { "uuid", 0, NULL, 'u' },
-               { "type", 0, NULL, 't' },
-               { "export", 0, NULL, 'x' },
-               { "skip-raid", 0, NULL, 's' },
-               { "probe-all", 0, NULL, 'a' },
-               { "offset", 2, NULL, 'o' },
-               { "debug", 0, NULL, 'd' },
-               { "help", 0, NULL, 'h' },
+               { "label", no_argument, NULL, 'l' },
+               { "label-raw", no_argument, NULL, 'L' },
+               { "uuid", no_argument, NULL, 'u' },
+               { "type", no_argument, NULL, 't' },
+               { "export", no_argument, NULL, 'x' },
+               { "skip-raid", no_argument, NULL, 's' },
+               { "probe-all", no_argument, NULL, 'a' },
+               { "offset", optional_argument, NULL, 'o' },
+               { "debug", no_argument, NULL, 'd' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
 
index 5d19d5dd75b0110779a072085028d97ea183d914..47fbf3b42ab0630cee6f9d4c107d01307df28c76 100644 (file)
@@ -273,12 +273,12 @@ int main(int argc, char *argv[], char *envp[])
 {
        struct udev *udev = NULL;
        static const struct option options[] = {
-               { "syspath", 1, NULL, 'p' },
-               { "subsystem", 1, NULL, 's' },
-               { "socket", 1, NULL, 'S' },
-               { "debug", 0, NULL, 'd' },
-               { "help", 0, NULL, 'h' },
-               { "version", 0, NULL, 'V' },
+               { "syspath", required_argument, NULL, 'p' },
+               { "subsystem", required_argument, NULL, 's' },
+               { "socket", required_argument, NULL, 'S' },
+               { "debug", no_argument, NULL, 'd' },
+               { "help", no_argument, NULL, 'h' },
+               { "version", no_argument, NULL, 'V' },
                {}
        };
        struct udev_enumerate *udev_enumerate;
index baffd0d2044ce55d71e7c90b9820d29301828e7f..50020b57d9a28640e5933d28fe00f58020b2c1f7 100644 (file)
@@ -46,18 +46,18 @@ int udevadm_control(struct udev *udev, int argc, char *argv[])
 
        /* compat values with '_' will be removed in a future release */
        static const struct option options[] = {
-               { "log-priority", 1, NULL, 'l' },
-               { "log_priority", 1, NULL, 'l' + 256 },
-               { "stop-exec-queue", 0, NULL, 's' },
-               { "stop_exec_queue", 0, NULL, 's' + 256 },
-               { "start-exec-queue", 0, NULL, 'S' },
-               { "start_exec_queue", 0, NULL, 'S' + 256},
-               { "reload-rules", 0, NULL, 'R' },
-               { "reload_rules", 0, NULL, 'R' + 256},
-               { "env", 1, NULL, 'e' },
-               { "max-childs", 1, NULL, 'm' },
-               { "max_childs", 1, NULL, 'm' + 256},
-               { "help", 0, NULL, 'h' },
+               { "log-priority", required_argument, NULL, 'l' },
+               { "log_priority", required_argument, NULL, 'l' + 256 },
+               { "stop-exec-queue", no_argument, NULL, 's' },
+               { "stop_exec_queue", no_argument, NULL, 's' + 256 },
+               { "start-exec-queue", no_argument, NULL, 'S' },
+               { "start_exec_queue", no_argument, NULL, 'S' + 256},
+               { "reload-rules", no_argument, NULL, 'R' },
+               { "reload_rules", no_argument, NULL, 'R' + 256},
+               { "env", required_argument, NULL, 'e' },
+               { "max-childs", required_argument, NULL, 'm' },
+               { "max_childs", required_argument, NULL, 'm' + 256},
+               { "help", no_argument, NULL, 'h' },
                {}
        };
 
index 4da9881dbe6593e104a061b8035294188caf360b..ec098abd187a102d3f0874dd23e96484b2fb9fb4 100644 (file)
@@ -217,17 +217,17 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
        int rc = 0;
 
        static const struct option options[] = {
-               { "name", 1, NULL, 'n' },
-               { "path", 1, NULL, 'p' },
-               { "query", 1, NULL, 'q' },
-               { "attribute-walk", 0, NULL, 'a' },
-               { "export-db", 0, NULL, 'e' },
-               { "root", 0, NULL, 'r' },
-               { "device-id-of-file", 1, NULL, 'd' },
-               { "export", 0, NULL, 'x' },
-               { "export-prefix", 1, NULL, 'P' },
-               { "version", 0, NULL, 1 }, /* -V outputs braindead format */
-               { "help", 0, NULL, 'h' },
+               { "name", required_argument, NULL, 'n' },
+               { "path", required_argument, NULL, 'p' },
+               { "query", required_argument, NULL, 'q' },
+               { "attribute-walk", no_argument, NULL, 'a' },
+               { "export-db", no_argument, NULL, 'e' },
+               { "root", no_argument, NULL, 'r' },
+               { "device-id-of-file", required_argument, NULL, 'd' },
+               { "export", no_argument, NULL, 'x' },
+               { "export-prefix", required_argument, NULL, 'P' },
+               { "version", no_argument, NULL, 1 }, /* -V outputs braindead format */
+               { "help", no_argument, NULL, 'h' },
                {}
        };
 
index d5992ceb6c5cc7fc522a7672b5bde5078958456b..14a6edc84465fc7c32b295a4c33342fc0b21f76c 100644 (file)
@@ -77,10 +77,10 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
        int rc = 0;
 
        static const struct option options[] = {
-               { "environment", 0, NULL, 'e' },
-               { "kernel", 0, NULL, 'k' },
-               { "udev", 0, NULL, 'u' },
-               { "help", 0, NULL, 'h' },
+               { "environment", no_argument, NULL, 'e' },
+               { "kernel", no_argument, NULL, 'k' },
+               { "udev", no_argument, NULL, 'u' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
 
index d066ef90ce8d6dd5c9aca049e83aac4f15483349..5e5a080bc887bebe8be28d986b6f5bccfa4a3063 100644 (file)
@@ -36,8 +36,8 @@
 int udevadm_settle(struct udev *udev, int argc, char *argv[])
 {
        static const struct option options[] = {
-               { "timeout", 1, NULL, 't' },
-               { "help", 0, NULL, 'h' },
+               { "timeout", required_argument, NULL, 't' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
        int timeout = DEFAULT_TIMEOUT;
index ba0852871a9fa6520822ef1143cb71ee482b0789..f4b0125d3cdbf28d2e39fb6975aca820dd6460b4 100644 (file)
@@ -83,10 +83,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[])
        int rc = 0;
 
        static const struct option options[] = {
-               { "action", 1, NULL, 'a' },
-               { "subsystem", 1, NULL, 's' },
-               { "force", 0, NULL, 'f' },
-               { "help", 0, NULL, 'h' },
+               { "action", required_argument, NULL, 'a' },
+               { "subsystem", required_argument, NULL, 's' },
+               { "force", no_argument, NULL, 'f' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
 
index 8d25f923995bfa66733c4bddc41cc2e05c935cf1..eb46a2983c046a427134d14036eb66d689e72885 100644 (file)
@@ -79,16 +79,16 @@ static int scan_failed(struct udev_enumerate *udev_enumerate)
 int udevadm_trigger(struct udev *udev, int argc, char *argv[])
 {
        static const struct option options[] = {
-               { "verbose", 0, NULL, 'v' },
-               { "dry-run", 0, NULL, 'n' },
-               { "type", 1, NULL, 't' },
-               { "retry-failed", 0, NULL, 'F' },
-               { "action", 1, NULL, 'c' },
-               { "subsystem-match", 1, NULL, 's' },
-               { "subsystem-nomatch", 1, NULL, 'S' },
-               { "attr-match", 1, NULL, 'a' },
-               { "attr-nomatch", 1, NULL, 'A' },
-               { "help", 0, NULL, 'h' },
+               { "verbose", no_argument, NULL, 'v' },
+               { "dry-run", no_argument, NULL, 'n' },
+               { "type", required_argument, NULL, 't' },
+               { "retry-failed", no_argument, NULL, 'F' },
+               { "action", required_argument, NULL, 'c' },
+               { "subsystem-match", required_argument, NULL, 's' },
+               { "subsystem-nomatch", required_argument, NULL, 'S' },
+               { "attr-match", required_argument, NULL, 'a' },
+               { "attr-nomatch", required_argument, NULL, 'A' },
+               { "help", no_argument, NULL, 'h' },
                {}
        };
        enum {
index b18114273c8e839dec6e0ca5a6d82400e270a604..3f2c78212ea139d522fc3a859a57db18497387a2 100644 (file)
@@ -124,9 +124,9 @@ int main(int argc, char *argv[])
 {
        struct udev *udev;
        static const struct option options[] = {
-               { "debug", 0, NULL, 'd' },
-               { "help", 0, NULL, 'h' },
-               { "version", 0, NULL, 'V' },
+               { "debug", no_argument, NULL, 'd' },
+               { "help", no_argument, NULL, 'h' },
+               { "version", no_argument, NULL, 'V' },
                {}
        };
        const char *command;
index 9783fe4e7c545db6bc37e450c06050ea57747870..a821ee7d8ee77c4db76d602077c5905656a56e73 100644 (file)
@@ -784,11 +784,11 @@ int main(int argc, char *argv[])
        const char *value;
        int daemonize = 0;
        static const struct option options[] = {
-               { "daemon", 0, NULL, 'd' },
-               { "debug-trace", 0, NULL, 't' },
-               { "debug", 0, NULL, 'D' },
-               { "help", 0, NULL, 'h' },
-               { "version", 0, NULL, 'V' },
+               { "daemon", no_argument, NULL, 'd' },
+               { "debug-trace", no_argument, NULL, 't' },
+               { "debug", no_argument, NULL, 'D' },
+               { "help", no_argument, NULL, 'h' },
+               { "version", no_argument, NULL, 'V' },
                {}
        };
        int rc = 1;