diff options
author | June McEnroe <june@causal.agency> | 2020-12-16 16:07:41 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-12-16 16:07:41 -0500 |
commit | 71f9a7a93571ed5b367bc6b2782a3545d8ca1614 (patch) | |
tree | 315aa5fbb2b286d0b46a99f85545ac9a1fdc01e9 /notemap.c | |
parent | Reformat STANDARDS section (diff) | |
download | notemap-71f9a7a93571ed5b367bc6b2782a3545d8ca1614.tar.gz notemap-71f9a7a93571ed5b367bc6b2782a3545d8ca1614.zip |
Take username as a required positional argument
Diffstat (limited to 'notemap.c')
-rw-r--r-- | notemap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/notemap.c b/notemap.c index e2b41dc..a1d280c 100644 --- a/notemap.c +++ b/notemap.c @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { int rppFlags = 0; int opt; - while (0 < (opt = getopt(argc, argv, "M:afh:m:p:u:vw"))) { + while (0 < (opt = getopt(argc, argv, "M:afh:m:p:vw"))) { switch (opt) { break; case 'M': mailbox = optarg; break; case 'a': add = true; @@ -181,10 +181,11 @@ int main(int argc, char *argv[]) { break; default: return EX_USAGE; } } - if (!user) errx(EX_USAGE, "username required"); + if (optind < argc) user = argv[optind++]; argv += optind; argc -= optind; + if (!user) errx(EX_USAGE, "username required"); if (!host) { host = strchr(user, '@'); if (!host) errx(EX_USAGE, "no domain in username"); |