diff options
author | Rich Salz <rsalz@akamai.com> | 2015-05-15 13:50:38 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-06-02 12:40:24 -0400 |
commit | 9c3bcfa027cb32421ed20ab77553860b922b82fc (patch) | |
tree | 5bc2b7a055c4abbc75431212948d0693d922f3ab /apps/crl.c | |
parent | 366e2a60b2fcc727b061f1459343245476ad6c3b (diff) |
Standardize handling of #ifdef'd options.
Here are the "rules" for handling flags that depend on #ifdef:
- Do not ifdef the enum. Only ifdef the OPTIONS table. All ifdef'd
entries appear at the end; by convention "engine" is last. This
ensures that at run-time, the flag will never be recognized/allowed.
The next two bullets entries are for silencing compiler warnings:
- In the while/switch parsing statement, use #ifdef for the body to
disable it; leave the "case OPT_xxx:" and "break" statements outside
the ifdef/ifndef. See ciphers.c for example.
- If there are multiple options controlled by a single guard, OPT_FOO,
OPT_BAR, etc., put a an #ifdef around the set, and then do "#else"
and a series of case labels and a break. See OPENSSL_NO_AES in cms.c
for example.
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'apps/crl.c')
-rw-r--r-- | apps/crl.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/crl.c b/apps/crl.c index 17391e24c0..c897335fb7 100644 --- a/apps/crl.c +++ b/apps/crl.c @@ -95,11 +95,11 @@ OPTIONS crl_options[] = { {"verify", OPT_VERIFY, '-'}, {"text", OPT_TEXT, '-', "Print out a text format version"}, {"hash", OPT_HASH, '-', "Print hash value"}, + {"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"}, + {"", OPT_MD, '-', "Any supported digest"}, #ifndef OPENSSL_NO_MD5 {"hash_old", OPT_HASH_OLD, '-', "Print old-style (MD5) hash value"}, #endif - {"nameopt", OPT_NAMEOPT, 's', "Various certificate name options"}, - {"", OPT_MD, '-', "Any supported digest"}, {NULL} }; @@ -117,11 +117,11 @@ int crl_main(int argc, char **argv) char *infile = NULL, *outfile = NULL, *crldiff = NULL, *keyfile = NULL; char *CAfile = NULL, *CApath = NULL, *prog; OPTION_CHOICE o; - int hash = 0, issuer = 0, lastupdate = 0, nextupdate = 0, noout = - 0, text = 0; + int hash = 0, issuer = 0, lastupdate = 0, nextupdate = 0, noout = 0; int informat = FORMAT_PEM, outformat = FORMAT_PEM, keyformat = FORMAT_PEM; - int ret = 1, num = 0, badsig = 0, fingerprint = 0, crlnumber = - 0, i, do_ver = 0; + int ret = 1, num = 0, badsig = 0, fingerprint = 0, crlnumber = 0; + int text = 0, do_ver = 0; + int i; #ifndef OPENSSL_NO_MD5 int hash_old = 0; #endif @@ -170,11 +170,11 @@ int crl_main(int argc, char **argv) CAfile = opt_arg(); do_ver = 1; break; -#ifndef OPENSSL_NO_MD5 case OPT_HASH_OLD: +#ifndef OPENSSL_NO_MD5 hash_old = ++num; - break; #endif + break; case OPT_VERIFY: do_ver = 1; break; |