1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-17 02:03:44 +03:00

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 fd;
int rc = 0; int rc = 0;
static const struct option options[] = { static const struct option options[] = {
{ "export", 0, NULL, 'x' }, { "export", no_argument, NULL, 'x' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };

View File

@ -503,9 +503,9 @@ int main(int argc, char *argv[])
{ {
struct udev *udev; struct udev *udev;
static const struct option options[] = { static const struct option options[] = {
{ "export", 0, NULL, 'x' }, { "export", no_argument, NULL, 'x' },
{ "debug", 0, NULL, 'd' }, { "debug", no_argument, NULL, 'd' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };
const char *node = NULL; const char *node = NULL;

View File

@ -321,10 +321,10 @@ static void everybody(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
static const struct option options[] = { static const struct option options[] = {
{ "add", 0, NULL, 'a' }, { "add", no_argument, NULL, 'a' },
{ "remove", 0, NULL, 'r' }, { "remove", no_argument, NULL, 'r' },
{ "debug", 0, NULL, 'd' }, { "debug", no_argument, NULL, 'd' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };
int argi; int argi;

View File

@ -66,9 +66,9 @@ int main(int argc, char *argv[])
{ {
struct udev *udev; struct udev *udev;
static const struct option options[] = { static const struct option options[] = {
{ "export", 0, NULL, 'x' }, { "export", no_argument, NULL, 'x' },
{ "debug", 0, NULL, 'd' }, { "debug", no_argument, NULL, 'd' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };
char **devices; char **devices;

View File

@ -31,17 +31,17 @@
#include "scsi_id.h" #include "scsi_id.h"
static const struct option options[] = { static const struct option options[] = {
{ "device", 1, NULL, 'd' }, { "device", required_argument, NULL, 'd' },
{ "config", 1, NULL, 'f' }, { "config", required_argument, NULL, 'f' },
{ "page", 1, NULL, 'p' }, { "page", required_argument, NULL, 'p' },
{ "blacklisted", 0, NULL, 'b' }, { "blacklisted", no_argument, NULL, 'b' },
{ "whitelisted", 0, NULL, 'g' }, { "whitelisted", no_argument, NULL, 'g' },
{ "replace-whitespace", 0, NULL, 'u' }, { "replace-whitespace", no_argument, NULL, 'u' },
{ "sg-version", 1, NULL, 's' }, { "sg-version", required_argument, NULL, 's' },
{ "verbose", 0, NULL, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", 0, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
{ "export", 0, NULL, 'x' }, { "export", no_argument, NULL, 'x' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };

View File

@ -359,10 +359,10 @@ int main(int argc, char **argv)
char devpath[MAX_PATH_LEN]; char devpath[MAX_PATH_LEN];
static int export; static int export;
static const struct option options[] = { static const struct option options[] = {
{ "usb-info", 0, NULL, 'u' }, { "usb-info", no_argument, NULL, 'u' },
{ "num-info", 0, NULL, 'n' }, { "num-info", no_argument, NULL, 'n' },
{ "export", 0, NULL, 'x' }, { "export", no_argument, NULL, 'x' },
{ "help", 0, NULL, 'h' }, { "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[]) int main(int argc, char *argv[])
{ {
static const struct option options[] = { static const struct option options[] = {
{ "label", 0, NULL, 'l' }, { "label", no_argument, NULL, 'l' },
{ "label-raw", 0, NULL, 'L' }, { "label-raw", no_argument, NULL, 'L' },
{ "uuid", 0, NULL, 'u' }, { "uuid", no_argument, NULL, 'u' },
{ "type", 0, NULL, 't' }, { "type", no_argument, NULL, 't' },
{ "export", 0, NULL, 'x' }, { "export", no_argument, NULL, 'x' },
{ "skip-raid", 0, NULL, 's' }, { "skip-raid", no_argument, NULL, 's' },
{ "probe-all", 0, NULL, 'a' }, { "probe-all", no_argument, NULL, 'a' },
{ "offset", 2, NULL, 'o' }, { "offset", optional_argument, NULL, 'o' },
{ "debug", 0, NULL, 'd' }, { "debug", no_argument, NULL, 'd' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };

View File

@ -273,12 +273,12 @@ int main(int argc, char *argv[], char *envp[])
{ {
struct udev *udev = NULL; struct udev *udev = NULL;
static const struct option options[] = { static const struct option options[] = {
{ "syspath", 1, NULL, 'p' }, { "syspath", required_argument, NULL, 'p' },
{ "subsystem", 1, NULL, 's' }, { "subsystem", required_argument, NULL, 's' },
{ "socket", 1, NULL, 'S' }, { "socket", required_argument, NULL, 'S' },
{ "debug", 0, NULL, 'd' }, { "debug", no_argument, NULL, 'd' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
{} {}
}; };
struct udev_enumerate *udev_enumerate; 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 */ /* compat values with '_' will be removed in a future release */
static const struct option options[] = { static const struct option options[] = {
{ "log-priority", 1, NULL, 'l' }, { "log-priority", required_argument, NULL, 'l' },
{ "log_priority", 1, NULL, 'l' + 256 }, { "log_priority", required_argument, NULL, 'l' + 256 },
{ "stop-exec-queue", 0, NULL, 's' }, { "stop-exec-queue", no_argument, NULL, 's' },
{ "stop_exec_queue", 0, NULL, 's' + 256 }, { "stop_exec_queue", no_argument, NULL, 's' + 256 },
{ "start-exec-queue", 0, NULL, 'S' }, { "start-exec-queue", no_argument, NULL, 'S' },
{ "start_exec_queue", 0, NULL, 'S' + 256}, { "start_exec_queue", no_argument, NULL, 'S' + 256},
{ "reload-rules", 0, NULL, 'R' }, { "reload-rules", no_argument, NULL, 'R' },
{ "reload_rules", 0, NULL, 'R' + 256}, { "reload_rules", no_argument, NULL, 'R' + 256},
{ "env", 1, NULL, 'e' }, { "env", required_argument, NULL, 'e' },
{ "max-childs", 1, NULL, 'm' }, { "max-childs", required_argument, NULL, 'm' },
{ "max_childs", 1, NULL, 'm' + 256}, { "max_childs", required_argument, NULL, 'm' + 256},
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };

View File

@ -217,17 +217,17 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
int rc = 0; int rc = 0;
static const struct option options[] = { static const struct option options[] = {
{ "name", 1, NULL, 'n' }, { "name", required_argument, NULL, 'n' },
{ "path", 1, NULL, 'p' }, { "path", required_argument, NULL, 'p' },
{ "query", 1, NULL, 'q' }, { "query", required_argument, NULL, 'q' },
{ "attribute-walk", 0, NULL, 'a' }, { "attribute-walk", no_argument, NULL, 'a' },
{ "export-db", 0, NULL, 'e' }, { "export-db", no_argument, NULL, 'e' },
{ "root", 0, NULL, 'r' }, { "root", no_argument, NULL, 'r' },
{ "device-id-of-file", 1, NULL, 'd' }, { "device-id-of-file", required_argument, NULL, 'd' },
{ "export", 0, NULL, 'x' }, { "export", no_argument, NULL, 'x' },
{ "export-prefix", 1, NULL, 'P' }, { "export-prefix", required_argument, NULL, 'P' },
{ "version", 0, NULL, 1 }, /* -V outputs braindead format */ { "version", no_argument, NULL, 1 }, /* -V outputs braindead format */
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };

View File

@ -77,10 +77,10 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
int rc = 0; int rc = 0;
static const struct option options[] = { static const struct option options[] = {
{ "environment", 0, NULL, 'e' }, { "environment", no_argument, NULL, 'e' },
{ "kernel", 0, NULL, 'k' }, { "kernel", no_argument, NULL, 'k' },
{ "udev", 0, NULL, 'u' }, { "udev", no_argument, NULL, 'u' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };

View File

@ -36,8 +36,8 @@
int udevadm_settle(struct udev *udev, int argc, char *argv[]) int udevadm_settle(struct udev *udev, int argc, char *argv[])
{ {
static const struct option options[] = { static const struct option options[] = {
{ "timeout", 1, NULL, 't' }, { "timeout", required_argument, NULL, 't' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };
int timeout = DEFAULT_TIMEOUT; int timeout = DEFAULT_TIMEOUT;

View File

@ -83,10 +83,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[])
int rc = 0; int rc = 0;
static const struct option options[] = { static const struct option options[] = {
{ "action", 1, NULL, 'a' }, { "action", required_argument, NULL, 'a' },
{ "subsystem", 1, NULL, 's' }, { "subsystem", required_argument, NULL, 's' },
{ "force", 0, NULL, 'f' }, { "force", no_argument, NULL, 'f' },
{ "help", 0, NULL, 'h' }, { "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[]) int udevadm_trigger(struct udev *udev, int argc, char *argv[])
{ {
static const struct option options[] = { static const struct option options[] = {
{ "verbose", 0, NULL, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "dry-run", 0, NULL, 'n' }, { "dry-run", no_argument, NULL, 'n' },
{ "type", 1, NULL, 't' }, { "type", required_argument, NULL, 't' },
{ "retry-failed", 0, NULL, 'F' }, { "retry-failed", no_argument, NULL, 'F' },
{ "action", 1, NULL, 'c' }, { "action", required_argument, NULL, 'c' },
{ "subsystem-match", 1, NULL, 's' }, { "subsystem-match", required_argument, NULL, 's' },
{ "subsystem-nomatch", 1, NULL, 'S' }, { "subsystem-nomatch", required_argument, NULL, 'S' },
{ "attr-match", 1, NULL, 'a' }, { "attr-match", required_argument, NULL, 'a' },
{ "attr-nomatch", 1, NULL, 'A' }, { "attr-nomatch", required_argument, NULL, 'A' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{} {}
}; };
enum { enum {

View File

@ -124,9 +124,9 @@ int main(int argc, char *argv[])
{ {
struct udev *udev; struct udev *udev;
static const struct option options[] = { static const struct option options[] = {
{ "debug", 0, NULL, 'd' }, { "debug", no_argument, NULL, 'd' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
{} {}
}; };
const char *command; const char *command;

View File

@ -784,11 +784,11 @@ int main(int argc, char *argv[])
const char *value; const char *value;
int daemonize = 0; int daemonize = 0;
static const struct option options[] = { static const struct option options[] = {
{ "daemon", 0, NULL, 'd' }, { "daemon", no_argument, NULL, 'd' },
{ "debug-trace", 0, NULL, 't' }, { "debug-trace", no_argument, NULL, 't' },
{ "debug", 0, NULL, 'D' }, { "debug", no_argument, NULL, 'D' },
{ "help", 0, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", 0, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
{} {}
}; };
int rc = 1; int rc = 1;