From 5129f427750164d91485e246e88bc28013ac7567 Mon Sep 17 00:00:00 2001 From: inoguchi <> Date: Wed, 24 Mar 2021 12:07:39 +0000 Subject: 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@ --- src/usr.bin/openssl/apps.c | 6 +++++- src/usr.bin/openssl/apps.h | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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 @@ -/* $OpenBSD: apps.c,v 1.58 2021/03/17 18:08:32 jsing Exp $ */ +/* $OpenBSD: apps.c,v 1.59 2021/03/24 12:07:39 inoguchi Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -2304,6 +2304,10 @@ options_parse(int argc, char **argv, const struct option *opts, char **unnamed, *opt->opt.ulvalue |= opt->ulvalue; break; + case OPTION_ORDER: + *opt->opt.order = ++(*opt->order); + break; + default: fprintf(stderr, "option %s - unknown type %i\n", 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 @@ -/* $OpenBSD: apps.h,v 1.24 2020/09/09 12:47:46 inoguchi Exp $ */ +/* $OpenBSD: apps.h,v 1.25 2021/03/24 12:07:39 inoguchi Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -304,6 +304,7 @@ struct option { OPTION_VALUE_AND, OPTION_VALUE_OR, OPTION_UL_VALUE_OR, + OPTION_ORDER, } type; union { char **arg; @@ -315,9 +316,11 @@ struct option { int *value; unsigned long *ulvalue; time_t *tvalue; + int *order; } opt; const int value; const unsigned long ulvalue; + int *order; }; void options_usage(const struct option *opts); -- cgit v1.2.3-55-g6feb