Be noisy when both -H and -T are given
This commit is contained in:
parent
24fbaa6e82
commit
e1eb8b8d95
11
cli.c
11
cli.c
@ -45,12 +45,12 @@ main(int argc, char *argv[])
|
|||||||
uint64_t counter;
|
uint64_t counter;
|
||||||
unsigned int step;
|
unsigned int step;
|
||||||
int32_t r;
|
int32_t r;
|
||||||
int ch, digits, do_hotp;
|
int ch, digits, do_hotp, do_totp;
|
||||||
enum otp_hmac hmac;
|
enum otp_hmac hmac;
|
||||||
|
|
||||||
counter = (uint64_t)time(NULL);
|
counter = (uint64_t)time(NULL);
|
||||||
digits = 6;
|
digits = 6;
|
||||||
do_hotp = 0;
|
do_hotp = do_totp = 0;
|
||||||
hmac = OTP_HMAC_SHA1;
|
hmac = OTP_HMAC_SHA1;
|
||||||
step = 30;
|
step = 30;
|
||||||
while ((ch = getopt(argc, argv, "d:H:h:s:T:")) != -1) {
|
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);
|
counter = mystrtonum(optarg, 0, LLONG_MAX, &errstr);
|
||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
errx(1, "counter is %s: %s", errstr, optarg);
|
errx(1, "counter is %s: %s", errstr, optarg);
|
||||||
do_hotp = 0;
|
do_totp = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
@ -94,6 +94,11 @@ main(int argc, char *argv[])
|
|||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
|
if (do_hotp && do_totp) {
|
||||||
|
warnx("-H and -T are mutually exclusive");
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user