diff options
author | inoguchi <> | 2021-03-24 12:07:39 +0000 |
---|---|---|
committer | inoguchi <> | 2021-03-24 12:07:39 +0000 |
commit | 5129f427750164d91485e246e88bc28013ac7567 (patch) | |
tree | a6475327c85ffbf84cc90fb595ed626303422704 | |
parent | 22638d4b1be941de65b47260040fef489ae2afe9 (diff) | |
download | openbsd-5129f427750164d91485e246e88bc28013ac7567.tar.gz openbsd-5129f427750164d91485e246e88bc28013ac7567.tar.bz2 openbsd-5129f427750164d91485e246e88bc28013ac7567.zip |
Add option type OPTION_ORDER
To handle incremental order value, added new option type OPTION_ORDER.
openssl(1) x509 requires this option handling, since,
- -CA and -signkey require to set both filename and incremental 'num'.
- -dates requires to set two variables in a row, startdate and enddate.
and this couldn't be solved by OPTION_FLAG_ORD.
ok tb@ and "I'd move forward with your current plan." from jsing@
-rw-r--r-- | src/usr.bin/openssl/apps.c | 6 | ||||
-rw-r--r-- | src/usr.bin/openssl/apps.h | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index 24a28c7ca5..396a693c6f 100644 --- a/src/usr.bin/openssl/apps.c +++ b/src/usr.bin/openssl/apps.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.c,v 1.58 2021/03/17 18:08:32 jsing Exp $ */ | 1 | /* $OpenBSD: apps.c,v 1.59 2021/03/24 12:07:39 inoguchi Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -2304,6 +2304,10 @@ options_parse(int argc, char **argv, const struct option *opts, char **unnamed, | |||
2304 | *opt->opt.ulvalue |= opt->ulvalue; | 2304 | *opt->opt.ulvalue |= opt->ulvalue; |
2305 | break; | 2305 | break; |
2306 | 2306 | ||
2307 | case OPTION_ORDER: | ||
2308 | *opt->opt.order = ++(*opt->order); | ||
2309 | break; | ||
2310 | |||
2307 | default: | 2311 | default: |
2308 | fprintf(stderr, "option %s - unknown type %i\n", | 2312 | fprintf(stderr, "option %s - unknown type %i\n", |
2309 | opt->name, opt->type); | 2313 | opt->name, opt->type); |
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h index 10612a9c97..d5f3706ee7 100644 --- a/src/usr.bin/openssl/apps.h +++ b/src/usr.bin/openssl/apps.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.h,v 1.24 2020/09/09 12:47:46 inoguchi Exp $ */ | 1 | /* $OpenBSD: apps.h,v 1.25 2021/03/24 12:07:39 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -304,6 +304,7 @@ struct option { | |||
304 | OPTION_VALUE_AND, | 304 | OPTION_VALUE_AND, |
305 | OPTION_VALUE_OR, | 305 | OPTION_VALUE_OR, |
306 | OPTION_UL_VALUE_OR, | 306 | OPTION_UL_VALUE_OR, |
307 | OPTION_ORDER, | ||
307 | } type; | 308 | } type; |
308 | union { | 309 | union { |
309 | char **arg; | 310 | char **arg; |
@@ -315,9 +316,11 @@ struct option { | |||
315 | int *value; | 316 | int *value; |
316 | unsigned long *ulvalue; | 317 | unsigned long *ulvalue; |
317 | time_t *tvalue; | 318 | time_t *tvalue; |
319 | int *order; | ||
318 | } opt; | 320 | } opt; |
319 | const int value; | 321 | const int value; |
320 | const unsigned long ulvalue; | 322 | const unsigned long ulvalue; |
323 | int *order; | ||
321 | }; | 324 | }; |
322 | 325 | ||
323 | void options_usage(const struct option *opts); | 326 | void options_usage(const struct option *opts); |