diff options
author | June McEnroe <june@causal.agency> | 2020-02-05 22:49:56 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-02-05 22:49:56 -0500 |
commit | 27eaddb6b9524b43448f4e5c88ac74bbe8fdb3a5 (patch) | |
tree | 9e60c949182e6e892cbc3a34b4d5f572d233e517 /chat.c | |
parent | Add /window name variant (diff) | |
download | catgirl-27eaddb6b9524b43448f4e5c88ac74bbe8fdb3a5.tar.gz catgirl-27eaddb6b9524b43448f4e5c88ac74bbe8fdb3a5.zip |
Use getopt_config to load options
I'm really getting a lot of use out of this config.c huh.
Diffstat (limited to '')
-rw-r--r-- | chat.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/chat.c b/chat.c index 1ad2833..c67d8a9 100644 --- a/chat.c +++ b/chat.c @@ -63,8 +63,26 @@ int main(int argc, char *argv[]) { const char *user = NULL; const char *real = NULL; + const char *Opts = "!a:c:eh:j:k:n:p:r:u:vw:"; + const struct option LongOpts[] = { + { "insecure", no_argument, NULL, '!' }, + { "sasl-plain", required_argument, NULL, 'a' }, + { "cert", required_argument, NULL, 'c' }, + { "sasl-external", no_argument, NULL, 'e' }, + { "host", required_argument, NULL, 'h' }, + { "join", required_argument, NULL, 'j' }, + { "priv", required_argument, NULL, 'k' }, + { "nick", required_argument, NULL, 'n' }, + { "port", required_argument, NULL, 'p' }, + { "real", required_argument, NULL, 'r' }, + { "user", required_argument, NULL, 'u' }, + { "debug", no_argument, NULL, 'v' }, + { "pass", required_argument, NULL, 'w' }, + {0}, + }; + int opt; - while (0 < (opt = getopt(argc, argv, "!a:c:eh:j:k:n:p:r:u:vw:"))) { + while (0 < (opt = getopt_config(argc, argv, Opts, LongOpts, NULL))) { switch (opt) { break; case '!': insecure = true; break; case 'a': sasl = true; self.plain = optarg; |