aboutsummaryrefslogtreecommitdiffstats
path: root/appl/otp/otpprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'appl/otp/otpprint.c')
-rw-r--r--appl/otp/otpprint.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/appl/otp/otpprint.c b/appl/otp/otpprint.c
index 662afeb467f0..1c9c339301a0 100644
--- a/appl/otp/otpprint.c
+++ b/appl/otp/otpprint.c
@@ -44,13 +44,14 @@ static int version_flag;
static int help_flag;
struct getargs args[] = {
- { "extended", 'e', arg_flag, &extendedp, "print keys in extended format" },
- { "count", 'n', arg_integer, &count, "number of keys to print" },
- { "hexadecimal", 'h', arg_flag, &hexp, "output in hexadecimal" },
+ { "extended", 'e', arg_flag, &extendedp, "print keys in extended format",
+ NULL },
+ { "count", 'n', arg_integer, &count, "number of keys to print", NULL },
+ { "hexadecimal", 'h', arg_flag, &hexp, "output in hexadecimal", NULL },
{ "hash", 'f', arg_string, &alg_string,
"hash algorithm (md4, md5, or sha)", "algorithm"},
- { "version", 0, arg_flag, &version_flag },
- { "help", 0, arg_flag, &help_flag }
+ { "version", 0, arg_flag, &version_flag, NULL, NULL },
+ { "help", 0, arg_flag, &help_flag, NULL, NULL }
};
int num_args = sizeof(args) / sizeof(args[0]);
@@ -65,7 +66,7 @@ usage(int code)
static int
print (int argc,
char **argv,
- int count,
+ int incount,
OtpAlgorithm *alg,
void (*print_fn)(OtpKey, char *, size_t))
{
@@ -86,7 +87,7 @@ print (int argc,
char s[64];
alg->next (key);
- if (i >= n - count) {
+ if (i >= n - incount) {
(*print_fn)(key, s, sizeof(s));
printf ("%d: %s\n", i + 1, s);
}
@@ -97,12 +98,12 @@ print (int argc,
int
main (int argc, char **argv)
{
- int optind = 0;
+ int optidx = 0;
void (*fn)(OtpKey, char *, size_t);
OtpAlgorithm *alg = otp_find_alg (OTP_ALG_DEFAULT);
setprogname (argv[0]);
- if(getarg(args, num_args, argc, argv, &optind))
+ if(getarg(args, num_args, argc, argv, &optidx))
usage(1);
if(help_flag)
usage(0);
@@ -116,8 +117,8 @@ main (int argc, char **argv)
if (alg == NULL)
errx(1, "Unknown algorithm: %s", alg_string);
}
- argc -= optind;
- argv += optind;
+ argc -= optidx;
+ argv += optidx;
if (hexp) {
if (extendedp)