APPS: Replace 'OPT_ERR = -1, OPT_EOF = 0, OPT_HELP' by OPT_COMMON macro
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sat, 1 May 2021 13:29:00 +0000 (15:29 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Wed, 5 May 2021 18:48:20 +0000 (20:48 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15111)

53 files changed:
apps/asn1pars.c
apps/ca.c
apps/ciphers.c
apps/cmp.c
apps/cms.c
apps/crl.c
apps/crl2p7.c
apps/dgst.c
apps/dhparam.c
apps/dsa.c
apps/dsaparam.c
apps/ec.c
apps/ecparam.c
apps/enc.c
apps/engine.c
apps/fipsinstall.c
apps/gendsa.c
apps/genpkey.c
apps/genrsa.c
apps/include/opt.h
apps/info.c
apps/kdf.c
apps/list.c
apps/mac.c
apps/nseq.c
apps/ocsp.c
apps/passwd.c
apps/pkcs12.c
apps/pkcs7.c
apps/pkcs8.c
apps/pkey.c
apps/pkeyparam.c
apps/pkeyutl.c
apps/prime.c
apps/rand.c
apps/rehash.c
apps/req.c
apps/rsa.c
apps/rsautl.c
apps/s_client.c
apps/s_server.c
apps/s_time.c
apps/sess_id.c
apps/smime.c
apps/speed.c
apps/spkac.c
apps/srp.c
apps/storeutl.c
apps/ts.c
apps/verify.c
apps/version.c
apps/x509.c
doc/internal/man3/OPTIONS.pod

index 798e8d16686a2bacec711dc4dc7ec8de7bcac3b8..95a21a04f4f4162f2f31d15265070110f59d6a6d 100644 (file)
@@ -19,7 +19,7 @@
 #include <openssl/asn1t.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_IN, OPT_OUT, OPT_INDENT, OPT_NOOUT,
     OPT_OID, OPT_OFFSET, OPT_LENGTH, OPT_DUMP, OPT_DLIMIT,
     OPT_STRPARSE, OPT_GENSTR, OPT_GENCONF, OPT_STRICTPEM,
index 4f125b22a93944c4b73d7e8a6890e852a608b0a2..9dd46e4f5cae769c028dd9682aedbd0fde2d1f10 100755 (executable)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -143,7 +143,7 @@ static int preserve = 0;
 static int msie_hack = 0;
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ENGINE, OPT_VERBOSE, OPT_CONFIG, OPT_NAME, OPT_SUBJ, OPT_UTF8,
     OPT_CREATE_SERIAL, OPT_MULTIVALUE_RDN, OPT_STARTDATE, OPT_ENDDATE,
     OPT_DAYS, OPT_MD, OPT_POLICY, OPT_KEYFILE, OPT_KEYFORM, OPT_PASSIN,
index dd70f0c63222e5ff15e0f39cec42c8e2473b55c2..6e4fedd9a769498359ad450188ba0846c88a1f3f 100644 (file)
@@ -17,7 +17,7 @@
 #include "s_apps.h"
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_STDNAME,
     OPT_CONVERT,
     OPT_SSL3,
index 14c3a73866e012615029e63febe79923610c4ec5..fdd0043311811dec0d5e545056f18dc696d8919c 100644 (file)
@@ -188,7 +188,7 @@ static int opt_accept_raverified = 0;
 static X509_VERIFY_PARAM *vpm = NULL;
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_CONFIG, OPT_SECTION, OPT_VERBOSITY,
 
     OPT_CMD, OPT_INFOTYPE, OPT_GENINFO,
index 88b70fc67f9e2113a475de5af9d02a6852ac8e1c..e512f1d3e87be9b2ac03d700d28bcb31fd50f3a4 100644 (file)
@@ -61,7 +61,7 @@ struct cms_key_param_st {
 };
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_ENCRYPT,
     OPT_DECRYPT, OPT_SIGN, OPT_CADES, OPT_SIGN_RECEIPT, OPT_RESIGN,
     OPT_VERIFY, OPT_VERIFY_RETCODE, OPT_VERIFY_RECEIPT,
index 8a0dc3605d3d101c0f8955dd478e1478c725eedd..8f1babde6f169437316bdb41c5e195d5998c6eb3 100644 (file)
@@ -19,7 +19,7 @@
 #include <openssl/pem.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_IN, OPT_OUTFORM, OPT_OUT, OPT_KEYFORM, OPT_KEY,
     OPT_ISSUER, OPT_LASTUPDATE, OPT_NEXTUPDATE, OPT_FINGERPRINT,
     OPT_CRLNUMBER, OPT_BADSIG, OPT_GENDELTA, OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
index 42c18555bb6f1e356920ac4a4062ba68f529655d..fe59e654270d07bef481a7083a5c4f54e778794b 100644 (file)
@@ -22,7 +22,7 @@
 static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_NOCRL, OPT_CERTFILE,
     OPT_PROV_ENUM
 } OPTION_CHOICE;
index 13a4e0773be7ff48eea934f3c6a5a2fd1194532d..fcc7fc86796123d0dbe9f1bc423ed5c9bb62636f 100644 (file)
@@ -36,7 +36,8 @@ struct doall_dgst_digests {
 };
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_LIST,
+    OPT_COMMON,
+    OPT_LIST,
     OPT_C, OPT_R, OPT_OUT, OPT_SIGN, OPT_PASSIN, OPT_VERIFY,
     OPT_PRVERIFY, OPT_SIGNATURE, OPT_KEYFORM, OPT_ENGINE, OPT_ENGINE_IMPL,
     OPT_HEX, OPT_BINARY, OPT_DEBUG, OPT_FIPS_FINGERPRINT,
index b43935eb7fa149400686c2f7d3bbc847ad6fca7d..5bb4b7f04ababee71e55b33d9e55dfee80025463 100644 (file)
@@ -34,7 +34,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh);
 static int gendh_cb(EVP_PKEY_CTX *ctx);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT,
     OPT_ENGINE, OPT_CHECK, OPT_TEXT, OPT_NOOUT,
     OPT_DSAPARAM, OPT_2, OPT_3, OPT_5,
index 9a7bf04adb993621478b51e86392de5ca9b0c406..c00673a8ac203379fb6728781220802514294760 100644 (file)
@@ -33,7 +33,7 @@
 #endif
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_ENGINE,
     /* Do not change the order here; see case statements below */
     OPT_PVK_NONE, OPT_PVK_WEAK, OPT_PVK_STRONG,
index a38dceb2555d388a15bdc1c03ba2b1a86858fe41..c78d28ecb1bfd59b9e9b4e92ebc5fb343e6b91f5 100644 (file)
@@ -27,7 +27,7 @@ static int verbose = 0;
 static int gendsa_cb(EVP_PKEY_CTX *ctx);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT,
     OPT_NOOUT, OPT_GENKEY, OPT_ENGINE, OPT_VERBOSE,
     OPT_R_ENUM, OPT_PROV_ENUM
index f8f77dd492a031e43ce8470c5b0354187b759a71..379c6b613249d9dbbefc60c917bd931c7c811bec 100644 (file)
--- a/apps/ec.c
+++ b/apps/ec.c
@@ -22,7 +22,7 @@
 #include "ec_common.h"
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT,
     OPT_NOOUT, OPT_TEXT, OPT_PARAM_OUT, OPT_PUBIN, OPT_PUBOUT,
     OPT_PASSIN, OPT_PASSOUT, OPT_PARAM_ENC, OPT_CONV_FORM, OPT_CIPHER,
index c99b8cc90935e81859dcc1ee13a78163e83c95ac..e9e36d1d8beff2d342a9532adbb8a8ae2c980b3c 100644 (file)
@@ -22,7 +22,7 @@
 #include "ec_common.h"
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT,
     OPT_CHECK, OPT_LIST_CURVES, OPT_NO_SEED, OPT_NOOUT, OPT_NAME,
     OPT_CONV_FORM, OPT_PARAM_ENC, OPT_GENKEY, OPT_ENGINE, OPT_CHECK_NAMED,
index 217526f450532ea2266993235672bd5ae11259ba..4339ba4114aea5480cf51e53f9068bcbf135d245 100644 (file)
@@ -39,7 +39,7 @@ struct doall_enc_ciphers {
 };
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_LIST,
     OPT_E, OPT_IN, OPT_OUT, OPT_PASS, OPT_ENGINE, OPT_D, OPT_P, OPT_V,
     OPT_NOPAD, OPT_SALT, OPT_NOSALT, OPT_DEBUG, OPT_UPPER_P, OPT_UPPER_A,
index b494a7944761714a9662ad7dea621f93e2ccc5aa..b132bb76085e8a398769c3561e281154dd84b78a 100644 (file)
@@ -23,7 +23,7 @@
 #include <openssl/store.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_C, OPT_T, OPT_TT, OPT_PRE, OPT_POST,
     OPT_V = 100, OPT_VV, OPT_VVV, OPT_VVVV
 } OPTION_CHOICE;
index 651df6250f200e3eecc2a2e9938d526d7850bfa4..6a104e60aa917830feacf8c50b792aa28f4d1b33 100644 (file)
@@ -33,7 +33,7 @@ static int self_test_log = 1;
 static int quiet = 0;
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_IN, OPT_OUT, OPT_MODULE,
     OPT_PROV_NAME, OPT_SECTION_NAME, OPT_MAC_NAME, OPT_MACOPT, OPT_VERIFY,
     OPT_NO_LOG, OPT_CORRUPT_DESC, OPT_CORRUPT_TYPE, OPT_QUIET, OPT_CONFIG,
index 38d7b4a3eb4e0923f069a2b048d879e2f2cc53ca..6d1c91d230f10ec93bac7ceb3f369a4239511cb8 100644 (file)
@@ -23,7 +23,7 @@
 #include <openssl/pem.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_OUT, OPT_PASSOUT, OPT_ENGINE, OPT_CIPHER, OPT_VERBOSE,
     OPT_R_ENUM, OPT_PROV_ENUM
 } OPTION_CHOICE;
index 746cd5902f21d40ea9e3446dc6b3bb9cffdff469..f10390e1ba4fb875d6101c6f7299a308fd24ae56 100644 (file)
@@ -20,7 +20,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
 static int genpkey_cb(EVP_PKEY_CTX *ctx);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ENGINE, OPT_OUTFORM, OPT_OUT, OPT_PASS, OPT_PARAMFILE,
     OPT_ALGORITHM, OPT_PKEYOPT, OPT_GENPARAM, OPT_TEXT, OPT_CIPHER,
     OPT_CONFIG,
index e5118d49025a97553bbac0c5d750d6f23c5e111d..0e84687b323bc58d465c2b488afcae50cb755b3b 100644 (file)
@@ -32,7 +32,7 @@ static int verbose = 0;
 static int genrsa_cb(EVP_PKEY_CTX *ctx);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
 #ifndef OPENSSL_NO_DEPRECATED_3_0
     OPT_3,
 #endif
index a80b6ee43aee046b69311706bed5983edf9bc032..c6ec09f88236afd547eec6d3619081ed37db0c0d 100644 (file)
@@ -14,6 +14,8 @@
 #include <openssl/types.h>
 #include <stdarg.h>
 
+#define OPT_COMMON OPT_ERR = -1, OPT_EOF = 0, OPT_HELP
+
 /*
  * Common verification options.
  */
index 5099853494bb3cc155322dcc6a4c4e017e2672ee..e432be46d5e7293fabd7ccbdae6825841cbd38c4 100644 (file)
@@ -12,7 +12,7 @@
 #include "progs.h"
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_CONFIGDIR, OPT_ENGINESDIR, OPT_MODULESDIR, OPT_DSOEXT, OPT_DIRNAMESEP,
     OPT_LISTSEP, OPT_SEEDS, OPT_CPUSETTINGS
 } OPTION_CHOICE;
index c036a1bf47ba9add800e5397f466e66581bc8a23..b3865d9e879ec622b780e67c9dac698735e7cf97 100644 (file)
@@ -18,7 +18,7 @@
 #include <openssl/params.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_KDFOPT, OPT_BIN, OPT_KEYLEN, OPT_OUT,
     OPT_PROV_ENUM
 } OPTION_CHOICE;
index af6ae3f1a024b91e354f256f7c0026d621982ae2..a8646addb11bcc83f3627d88ed6d302d83d77187 100644 (file)
@@ -1374,7 +1374,8 @@ static void list_disabled(void)
 
 /* Unified enum for help and list commands. */
 typedef enum HELPLIST_CHOICE {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ONE, OPT_VERBOSE,
+    OPT_COMMON,
+    OPT_ONE, OPT_VERBOSE,
     OPT_COMMANDS, OPT_DIGEST_COMMANDS, OPT_MAC_ALGORITHMS, OPT_OPTIONS,
     OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
     OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_DISABLED,
index 8f8dcde3183540bdfb57d0d71c61abeba36deb78..c722be31021f528e03f5400223e3377120eaa57d 100644 (file)
@@ -20,7 +20,7 @@
 #define BUFSIZE 1024*8
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_MACOPT, OPT_BIN, OPT_IN, OPT_OUT,
     OPT_PROV_ENUM
 } OPTION_CHOICE;
index 706ca58f651eacdc18c6d8195bfef8d95c82b9ed..8848e895ae4dad943f4e177b9a77e9424a5c3d7c 100644 (file)
@@ -15,7 +15,7 @@
 #include <openssl/err.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_TOSEQ, OPT_IN, OPT_OUT,
     OPT_PROV_ENUM
 } OPTION_CHOICE;
index 35a328bc69fdefd2db6505d5ad1e348718218698..d59cd1eb5978b9ac76935701060b62426aa885f8 100644 (file)
@@ -85,7 +85,7 @@ static int index_changed(CA_DB *);
 #endif
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_OUTFILE, OPT_TIMEOUT, OPT_URL, OPT_HOST, OPT_PORT,
     OPT_IGNORE_ERR, OPT_NOVERIFY, OPT_NONCE, OPT_NO_NONCE,
     OPT_RESP_NO_CERTS, OPT_RESP_KEY_ID, OPT_NO_CERTS,
index 1203b7443e9cac64bf908d6b2223770959ba99b5..65cbd9e4939629fe5ce3b62c9fbead05f6db1580 100644 (file)
@@ -50,7 +50,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
                      int reverse, size_t pw_maxlen, passwd_modes mode);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_IN,
     OPT_NOVERIFY, OPT_QUIET, OPT_TABLE, OPT_REVERSE, OPT_APR1,
     OPT_1, OPT_5, OPT_6, OPT_AIXMD5, OPT_SALT, OPT_STDIN,
index c2508163f0cd7d7193e439844747f83b9d7a704a..90550b1f44c2e18da48da34f5714bb912651a971 100644 (file)
@@ -55,7 +55,7 @@ int cert_load(BIO *in, STACK_OF(X509) *sk);
 static int set_pbe(int *ppbe, const char *str);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_CIPHER, OPT_NOKEYS, OPT_KEYEX, OPT_KEYSIG, OPT_NOCERTS, OPT_CLCERTS,
     OPT_CACERTS, OPT_NOOUT, OPT_INFO, OPT_CHAIN, OPT_TWOPASS, OPT_NOMACVER,
 #ifndef OPENSSL_NO_DES
index fea9eadf658b927a55535590a3c73c7bde5f4476..ba11e8151ae931f57f569db5f625d89222556e0a 100644 (file)
@@ -21,7 +21,7 @@
 #include <openssl/pem.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_NOOUT,
     OPT_TEXT, OPT_PRINT, OPT_PRINT_CERTS, OPT_ENGINE,
     OPT_PROV_ENUM
index 1c4dd1220b219167298efae838ff66751c2721dd..d7cb2d6672104cdffb90699d1964c874ab48cb83 100644 (file)
@@ -18,7 +18,7 @@
 #include <openssl/pkcs12.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT,
     OPT_TOPK8, OPT_NOITER, OPT_NOCRYPT,
 #ifndef OPENSSL_NO_SCRYPT
index 0587aacc3077718cda2d49a21973f7fb15d7f1b0..d7e32b6e58492717e60f5c74461d44e63c055507 100644 (file)
@@ -18,7 +18,7 @@
 #include <openssl/core_names.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_PASSIN, OPT_PASSOUT, OPT_ENGINE,
     OPT_IN, OPT_OUT, OPT_PUBIN, OPT_PUBOUT, OPT_TEXT_PUB,
     OPT_TEXT, OPT_NOOUT, OPT_CIPHER, OPT_TRADITIONAL, OPT_CHECK, OPT_PUB_CHECK,
index 8b4ac1d222645237f81bbc9b827030176d9404b6..45647341ce874edd4a17795d1f4c4b36b8e6f3de 100644 (file)
@@ -17,7 +17,7 @@
 #include <openssl/evp.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_IN, OPT_OUT, OPT_TEXT, OPT_NOOUT,
     OPT_ENGINE, OPT_CHECK,
     OPT_PROV_ENUM
index a9571b5f637793a283fd8f0c02376fdf3cf879ab..3a26ec5ca7a8fa38dc8e8e4a055d7efc6b1ea983 100644 (file)
@@ -40,7 +40,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
                         unsigned char **out, size_t *poutlen);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ENGINE, OPT_ENGINE_IMPL, OPT_IN, OPT_OUT,
     OPT_PUBIN, OPT_CERTIN, OPT_ASN1PARSE, OPT_HEXDUMP, OPT_SIGN,
     OPT_VERIFY, OPT_VERIFYRECOVER, OPT_REV, OPT_ENCRYPT, OPT_DECRYPT,
index 1879d14111a2c51ba9be8c69e84b27fdd160b752..20b26cddad8698ea2cec83da67c2581678e89efb 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/bn.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_HEX, OPT_GENERATE, OPT_BITS, OPT_SAFE, OPT_CHECKS,
     OPT_PROV_ENUM
 } OPTION_CHOICE;
index 24f8c64d435ab3af402f371e037491e56bd21936..cbf495d5bc5378278991a6993b61841b42f37a43 100644 (file)
@@ -19,7 +19,7 @@
 #include <openssl/rand.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_OUT, OPT_ENGINE, OPT_BASE64, OPT_HEX,
     OPT_R_ENUM, OPT_PROV_ENUM
 } OPTION_CHOICE;
index 36e8e0fda2179d1894fc32197a7072d63535a512..65ccacc0a845072bed434eb4d3f703c1e6ea2e5b 100644 (file)
@@ -466,7 +466,7 @@ static int do_dir(const char *dirname, enum Hash h)
 }
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_COMPAT, OPT_OLD, OPT_N, OPT_VERBOSE,
     OPT_PROV_ENUM
 } OPTION_CHOICE;
index 5408dc7505fbcda7e2134b5360513e287a475ebc..6817a8bd545eae0da13aa83114dab83de3a1c33e 100644 (file)
@@ -79,7 +79,7 @@ static CONF *addext_conf = NULL;
 static int batch = 0;
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_KEYGEN_ENGINE, OPT_KEY,
     OPT_PUBKEY, OPT_NEW, OPT_CONFIG, OPT_KEYFORM, OPT_IN, OPT_OUT,
     OPT_KEYOUT, OPT_PASSIN, OPT_PASSOUT, OPT_NEWKEY,
index 47316757d56ad2b4002a537ad34a3eab23f0f006..0ff6cf32664c7f492a7c4d60dd81d80b6f26fe49 100644 (file)
@@ -37,7 +37,7 @@
 #endif
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT,
     OPT_PUBIN, OPT_PUBOUT, OPT_PASSOUT, OPT_PASSIN,
     OPT_RSAPUBKEY_IN, OPT_RSAPUBKEY_OUT,
index 57a3f8b4fc9aaf5fab6bc6f5dd3edac9832fe389..a8911ff20608eef9f0d9f56ad1c2713199ec5374 100644 (file)
@@ -26,7 +26,7 @@
 #define KEY_CERT        3
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ENGINE, OPT_IN, OPT_OUT, OPT_ASN1PARSE, OPT_HEXDUMP,
     OPT_RSA_RAW, OPT_OAEP, OPT_PKCS, OPT_X931,
     OPT_SIGN, OPT_VERIFY, OPT_REV, OPT_ENCRYPT, OPT_DECRYPT,
index dfc38b66593a49dcf73116456a37623b156f57f2..3c62739698efc6b00f5600296f7657e183f72fdd 100644 (file)
@@ -429,7 +429,7 @@ static int tlsa_import_rrset(SSL *con, STACK_OF(OPENSSL_STRING) *rrset)
 }
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_4, OPT_6, OPT_HOST, OPT_PORT, OPT_CONNECT, OPT_BIND, OPT_UNIX,
     OPT_XMPPHOST, OPT_VERIFY, OPT_NAMEOPT,
     OPT_CERT, OPT_CRL, OPT_CRL_DOWNLOAD, OPT_SESS_OUT, OPT_SESS_IN,
index 9ffd499a0a0b5e8b045e4eb2ec7ce23d2a711c88..6adee7ec6de6c6e9feb444d4b71a44210a2f36ce 100644 (file)
@@ -672,7 +672,8 @@ static int not_resumable_sess_cb(SSL *s, int is_forward_secure)
 }
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ENGINE,
+    OPT_COMMON,
+    OPT_ENGINE,
     OPT_4, OPT_6, OPT_ACCEPT, OPT_PORT, OPT_UNIX, OPT_UNLINK, OPT_NACCEPT,
     OPT_VERIFY, OPT_NAMEOPT, OPT_UPPER_V_VERIFY, OPT_CONTEXT, OPT_CERT, OPT_CRL,
     OPT_CRL_DOWNLOAD, OPT_SERVERINFO, OPT_CERTFORM, OPT_KEY, OPT_KEYFORM,
index bda61176e3711564b9f3d76e2271f6af57f83860..8c43db952e399b868213851b101c1456608e8b42 100644 (file)
@@ -43,7 +43,7 @@ static const char fmt_http_get_cmd[] = "GET %s HTTP/1.0\r\n\r\n";
 static const size_t fmt_http_get_cmd_size = sizeof(fmt_http_get_cmd) - 2;
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_CONNECT, OPT_CIPHER, OPT_CIPHERSUITES, OPT_CERT, OPT_NAMEOPT, OPT_KEY,
     OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
     OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE,
index de25cea156666bb3d1bcb3de08735ab2c121895f..a1e5415cc4ef4b383e63b67348d000f7b15c3ba6 100644 (file)
@@ -19,7 +19,7 @@
 #include <openssl/ssl.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT,
     OPT_TEXT, OPT_CERT, OPT_NOOUT, OPT_CONTEXT
 } OPTION_CHOICE;
index ed12b9219393bfef839bc8b6456d1e66f1e641ec..011dc99c4b7db346640c22195c2fe839224a0276 100644 (file)
@@ -33,7 +33,7 @@ static int smime_cb(int ok, X509_STORE_CTX *ctx);
 #define SMIME_RESIGN    (6 | SMIME_IP | SMIME_OP | SMIME_SIGNERS)
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ENCRYPT, OPT_DECRYPT, OPT_SIGN, OPT_RESIGN, OPT_VERIFY,
     OPT_PK7OUT, OPT_TEXT, OPT_NOINTERN, OPT_NOVERIFY, OPT_NOCHAIN,
     OPT_NOCERTS, OPT_NOATTR, OPT_NODETACH, OPT_NOSMIMECAP,
index 5363b0d7f83158daeb08b24c76157ec25ad465e4..0892b60369b2b0a85c4bede3b0e746acfcad004d 100644 (file)
@@ -207,7 +207,7 @@ static int opt_found(const char *name, unsigned int *result,
     opt_found(value, result, pairs, OSSL_NELEM(pairs))
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ELAPSED, OPT_EVP, OPT_HMAC, OPT_DECRYPT, OPT_ENGINE, OPT_MULTI,
     OPT_MR, OPT_MB, OPT_MISALIGN, OPT_ASYNCJOBS, OPT_R_ENUM, OPT_PROV_ENUM,
     OPT_PRIMES, OPT_SECONDS, OPT_BYTES, OPT_AEAD, OPT_CMAC
index cfbbc41e18892ae0b1ed41252d4fcec15710f651..9c12504b90ff74cf851d6177128b20ba4518dfdb 100644 (file)
@@ -21,7 +21,7 @@
 #include <openssl/pem.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_NOOUT, OPT_PUBKEY, OPT_VERIFY, OPT_IN, OPT_OUT,
     OPT_ENGINE, OPT_KEY, OPT_CHALLENGE, OPT_PASSIN, OPT_SPKAC,
     OPT_SPKSECT, OPT_KEYFORM,
index af62e7e200272dbcfbc23b43c064906169f95627..aad08fb229c1393e98d7178f1f158026d4c776c5 100644 (file)
@@ -190,7 +190,7 @@ static char *srp_create_user(char *user, char **srp_verifier,
 }
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_VERBOSE, OPT_CONFIG, OPT_NAME, OPT_SRPVFILE, OPT_ADD,
     OPT_DELETE, OPT_MODIFY, OPT_LIST, OPT_GN, OPT_USERINFO,
     OPT_PASSIN, OPT_PASSOUT, OPT_ENGINE, OPT_R_ENUM, OPT_PROV_ENUM
index 7fec56c9ea92b928e24ddb6207b0f1826398b41f..3e7ab32b7a7663670238a7f4097934fca577bb94 100644 (file)
@@ -22,7 +22,8 @@ static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
                    const char *prog, OSSL_LIB_CTX *libctx);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ENGINE, OPT_OUT, OPT_PASSIN,
+    OPT_COMMON,
+    OPT_ENGINE, OPT_OUT, OPT_PASSIN,
     OPT_NOOUT, OPT_TEXT, OPT_RECURSIVE,
     OPT_SEARCHFOR_CERTS, OPT_SEARCHFOR_KEYS, OPT_SEARCHFOR_CRLS,
     OPT_CRITERION_SUBJECT, OPT_CRITERION_ISSUER, OPT_CRITERION_SERIAL,
index ad6a3d382bb0345dd2a313cda203b15fde2584ec..db5ecb32c2cfc467d3fef8b8bd0cdf3f1e3e8a1b 100644 (file)
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -77,7 +77,7 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
 static int verify_cb(int ok, X509_STORE_CTX *ctx);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ENGINE, OPT_CONFIG, OPT_SECTION, OPT_QUERY, OPT_DATA,
     OPT_DIGEST, OPT_TSPOLICY, OPT_NO_NONCE, OPT_CERT,
     OPT_IN, OPT_TOKEN_IN, OPT_OUT, OPT_TOKEN_OUT, OPT_TEXT,
index 718174a83dbc5c96035536c2d9823ed353ed9f00..d66f137258882828ea1379ff7a806cd651c6d713 100644 (file)
@@ -26,7 +26,7 @@ static int check(X509_STORE *ctx, const char *file,
 static int v_verbose = 0, vflags = 0;
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_ENGINE, OPT_CAPATH, OPT_CAFILE, OPT_CASTORE,
     OPT_NOCAPATH, OPT_NOCAFILE, OPT_NOCASTORE,
     OPT_UNTRUSTED, OPT_TRUSTED, OPT_CRLFILE, OPT_CRL_DOWNLOAD, OPT_SHOW_CHAIN,
index cb00f55d899e622e5584c75a7bab75d459facdd0..b4cc2e04a108e9d4b86154546d097bf362c9fdf4 100644 (file)
@@ -17,7 +17,7 @@
 #include <openssl/bn.h>
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_B, OPT_D, OPT_E, OPT_M, OPT_F, OPT_O, OPT_P, OPT_V, OPT_A, OPT_R, OPT_C
 } OPTION_CHOICE;
 
index 8dffdb47c1f69ba805be3f662f702b560596ee85..a9c5d41096b252e93ce7d3397033902c43042ce3 100644 (file)
@@ -39,7 +39,7 @@ static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt);
 static int print_x509v3_exts(BIO *bio, X509 *x, const char *ext_names);
 
 typedef enum OPTION_choice {
-    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+    OPT_COMMON,
     OPT_INFORM, OPT_OUTFORM, OPT_KEYFORM, OPT_REQ, OPT_CAFORM,
     OPT_CAKEYFORM, OPT_VFYOPT, OPT_SIGOPT, OPT_DAYS, OPT_PASSIN, OPT_EXTFILE,
     OPT_EXTENSIONS, OPT_IN, OPT_OUT, OPT_KEY, OPT_SIGNKEY, OPT_CA, OPT_CAKEY,
index cbe0ccd883a4caf59b32d649f67f80b8e6b0193e..29151b376182066882d0f02a78a010020bcd661d 100644 (file)
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-OPTIONS, OPT_PAIR,
+OPTIONS, OPT_PAIR, OPT_COMMON, OPT_ERR, OPT_EOF, OPT_HELP,
 opt_init, opt_progname, opt_appname, opt_getprog, opt_help,
 opt_begin, opt_next, opt_flag, opt_arg, opt_unknown, opt_cipher, opt_md,
 opt_int, opt_int_arg, opt_long, opt_ulong, opt_intmax, opt_uintmax,
@@ -16,6 +16,10 @@ opt_num_rest, opt_rest
 
  typedef struct { ... }  OPTIONS;
  typedef struct { ... } OPT_PAIR;
+ #define OPT_COMMON
+ #define OPT_ERR
+ #define OPT_EOF
+ #define OPT_HELP
 
  char *opt_init(int argc, char **argv, const OPTIONS *o);
  char *opt_progname(const char *argv0);
@@ -67,14 +71,15 @@ Each program should define, near the main() routine, an enumeration
 that is the set of options the program accepts. For example:
 
     typedef enum OPTION_choice {
-        OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
+        OPT_COMMON,
         OPT_YES, OPT_NAME, OPT_COUNT, OPT_OFILE,
         ...
     } OPTION_CHOICE;
 
-The first two lines must appear exactly as shown. In addition to
-defining symbolic names for the constants that opt_next() returns,
-it also helps guarantee that every command has a C<-help> option.
+The first two lines must appear exactly as shown.
+OPT_COMMON is a macro that expands to C<OPT_ERR = -1, OPT_EOF = 0, OPT_HELP>.
+In addition to defining symbolic names for the constants that opt_next()
+returns, it also helps guarantee that every command has a C<-help> option.
 The third line is a sample
 set of flags, and the closing C<typedef> name is used for error-checking
 as discussed below.
@@ -209,7 +214,7 @@ The opt_begin() function, which is called automatically by opt_init(),
 can be used to reset the option parsing loop.
 
 The opt_next() function is called, once opt_init() has been called,
-in a loop to fetch each option in turn. It returns -1, or OPT_EOF when the
+in a loop to fetch each option in turn. It returns -1, or B<OPT_EOF> when the
 end of arguments has been reached. This is typically done like this:
 
     prog = opt_init(argc, argv, my_options);