use no_argument, required_argument, optional_argument in longopts

This commit is contained in:
Kay Sievers 2008-10-02 16:49:05 +02:00
parent 842dacb76f
commit 033e9f8cde
16 changed files with 94 additions and 94 deletions

View 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' },
{}
};

View 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;

View 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;

View 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;

View File

@ -31,17 +31,17 @@
#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' },
{}
};

View 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' },
{}
};

View 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' },
{}
};

View 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;

View 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' },
{}
};

View 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' },
{}
};

View 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' },
{}
};

View 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;

View 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' },
{}
};

View 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 {

View 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;

View 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;