diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2016-08-30 14:35:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2016-08-30 14:35:00 +0000 |
commit | 06a2db4962987663cb8b269b828429f88ad7f97d (patch) | |
tree | 60d20e5b20906f6fabc09177afe76f644d1763cb | |
parent | 9bdfcf2568e1fed0ab586f2f396c75071625d21f (diff) |
Add OPTION_ARG_TIME for parsing a (64 bit if needed) time_t
prodding & ok jsing
-rw-r--r-- | usr.bin/openssl/apps.c | 12 | ||||
-rw-r--r-- | usr.bin/openssl/apps.h | 3 | ||||
-rw-r--r-- | usr.bin/openssl/s_time.c | 4 |
3 files changed, 15 insertions, 4 deletions
diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c index 2902fb7e992..7c8df2b3224 100644 --- a/usr.bin/openssl/apps.c +++ b/usr.bin/openssl/apps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.c,v 1.38 2016/08/26 15:04:15 deraadt Exp $ */ +/* $OpenBSD: apps.c,v 1.39 2016/08/30 14:34:59 deraadt Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -2272,6 +2272,16 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed, *opt->opt.lvalue = (long)val; break; + case OPTION_ARG_TIME: + val = strtonum(argv[i], 0, LLONG_MAX, &errstr); + if (errstr != NULL) { + fprintf(stderr, "%s %s argument for -%s\n", + errstr, opt->argname, opt->name); + return (1); + } + *opt->opt.tvalue = val; + break; + case OPTION_DISCARD: break; diff --git a/usr.bin/openssl/apps.h b/usr.bin/openssl/apps.h index 217931a4b16..4276e533f7f 100644 --- a/usr.bin/openssl/apps.h +++ b/usr.bin/openssl/apps.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.h,v 1.18 2016/08/30 11:30:14 deraadt Exp $ */ +/* $OpenBSD: apps.h,v 1.19 2016/08/30 14:34:59 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -294,6 +294,7 @@ struct option { OPTION_ARG_FUNC, OPTION_ARG_INT, OPTION_ARG_LONG, + OPTION_ARG_TIME, OPTION_DISCARD, OPTION_FUNC, OPTION_FLAG, diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c index 6df03af41ce..a88df1bfe29 100644 --- a/usr.bin/openssl/s_time.c +++ b/usr.bin/openssl/s_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_time.c,v 1.15 2016/08/30 11:30:14 deraadt Exp $ */ +/* $OpenBSD: s_time.c,v 1.16 2016/08/30 14:34:59 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -194,7 +194,7 @@ struct option s_time_options[] = { .name = "time", .argname = "seconds", .desc = "Duration to perform timing tests for (default 30)", - .type = OPTION_ARG_INT, + .type = OPTION_ARG_TIME, .opt.tvalue = &s_time_config.maxtime, }, { |