summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorKinichiro Inoguchi <inoguchi@cvs.openbsd.org>2021-03-24 12:07:40 +0000
committerKinichiro Inoguchi <inoguchi@cvs.openbsd.org>2021-03-24 12:07:40 +0000
commit25328a14d7b68aad3385be7e44ae2c09d9cc65aa (patch)
tree4497a98b64d65630c609bb8850414d45768cdf94 /usr.bin
parenta36d21099e1ca0ce5d5c7c670e6c7eb3bcde7983 (diff)
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@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/openssl/apps.c6
-rw-r--r--usr.bin/openssl/apps.h5
2 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c
index 24a28c7ca52..396a693c6fb 100644
--- a/usr.bin/openssl/apps.c
+++ b/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 <jsing@openbsd.org>
*
@@ -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/usr.bin/openssl/apps.h b/usr.bin/openssl/apps.h
index 10612a9c979..d5f3706ee75 100644
--- a/usr.bin/openssl/apps.h
+++ b/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);