diff --git a/cli.c b/cli.c index a606642..5d060f4 100644 --- a/cli.c +++ b/cli.c @@ -45,12 +45,12 @@ main(int argc, char *argv[]) uint64_t counter; unsigned int step; int32_t r; - int ch, digits, do_hotp; + int ch, digits, do_hotp, do_totp; enum otp_hmac hmac; counter = (uint64_t)time(NULL); digits = 6; - do_hotp = 0; + do_hotp = do_totp = 0; hmac = OTP_HMAC_SHA1; step = 30; while ((ch = getopt(argc, argv, "d:H:h:s:T:")) != -1) { @@ -85,7 +85,7 @@ main(int argc, char *argv[]) counter = mystrtonum(optarg, 0, LLONG_MAX, &errstr); if (errstr != NULL) errx(1, "counter is %s: %s", errstr, optarg); - do_hotp = 0; + do_totp = 1; break; default: usage(); @@ -94,6 +94,11 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (do_hotp && do_totp) { + warnx("-H and -T are mutually exclusive"); + usage(); + } + if (argc != 1) usage();