Be noisy when both -H and -T are given

This commit is contained in:
Lucas 2020-06-14 18:23:14 +00:00
parent 24fbaa6e82
commit e1eb8b8d95
1 changed files with 8 additions and 3 deletions

11
cli.c
View File

@ -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();