summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDaniel Fiala <daniel@openssl.org>2022-10-09 08:43:29 +0200
committerPauli <pauli@openssl.org>2022-10-21 18:04:05 +1100
commitec1d5970be596daed15a3fa723cfa2ac726b0dba (patch)
treef25463813b997d796c8a0a40842c0c87f79c795e /apps
parentdc45bfb4b452ba5a876ebf48791217b69d092ff9 (diff)
openssl list: add an empty row at the end of each printed list of commands and algorithms
Fixes openssl#19140 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19372)
Diffstat (limited to 'apps')
-rw-r--r--apps/list.c76
1 files changed, 47 insertions, 29 deletions
diff --git a/apps/list.c b/apps/list.c
index 5e7169025e..ec5583937c 100644
--- a/apps/list.c
+++ b/apps/list.c
@@ -1521,6 +1521,7 @@ int list_main(int argc, char **argv)
char *prog;
HELPLIST_CHOICE o;
int one = 0, done = 0;
+ int print_newline = 0;
struct {
unsigned int commands:1;
unsigned int all_algorithms:1;
@@ -1662,77 +1663,94 @@ opthelp:
if (!opt_check_rest_arg(NULL))
goto opthelp;
+#define MAYBE_ADD_NL(cmd) \
+ do { \
+ if (print_newline++) { \
+ BIO_printf(bio_out, "\n"); \
+ } \
+ cmd; \
+ } while(0)
+
if (todo.commands)
- list_type(FT_general, one);
+ MAYBE_ADD_NL(list_type(FT_general, one));
if (todo.all_algorithms) {
+ MAYBE_ADD_NL({});
+
BIO_printf(bio_out, "Digests:\n");
list_digests(" ");
- BIO_printf(bio_out, "Symmetric Ciphers:\n");
+ BIO_printf(bio_out, "\nSymmetric Ciphers:\n");
list_ciphers(" ");
+ BIO_printf(bio_out, "\n");
list_kdfs();
+ BIO_printf(bio_out, "\n");
list_macs();
- BIO_printf(bio_out, "Provided Asymmetric Encryption:\n");
+ BIO_printf(bio_out, "\nProvided Asymmetric Encryption:\n");
list_asymciphers();
- BIO_printf(bio_out, "Provided Key Exchange:\n");
+ BIO_printf(bio_out, "\nProvided Key Exchange:\n");
list_keyexchanges();
- BIO_printf(bio_out, "Provided Signatures:\n");
+ BIO_printf(bio_out, "\nProvided Signatures:\n");
list_signatures();
- BIO_printf(bio_out, "Provided Key encapsulation:\n");
+ BIO_printf(bio_out, "\nProvided Key encapsulation:\n");
list_kems();
- BIO_printf(bio_out, "Provided Key managers:\n");
+ BIO_printf(bio_out, "\nProvided Key managers:\n");
list_keymanagers();
+ BIO_printf(bio_out, "\n");
list_encoders();
+ BIO_printf(bio_out, "\n");
list_decoders();
+ BIO_printf(bio_out, "\n");
list_store_loaders();
}
if (todo.random_instances)
- list_random_instances();
+ MAYBE_ADD_NL(list_random_instances());
if (todo.random_generators)
- list_random_generators();
+ MAYBE_ADD_NL(list_random_generators());
if (todo.digest_commands)
- list_type(FT_md, one);
+ MAYBE_ADD_NL(list_type(FT_md, one));
if (todo.digest_algorithms)
- list_digests("");
+ MAYBE_ADD_NL(list_digests(""));
if (todo.kdf_algorithms)
- list_kdfs();
+ MAYBE_ADD_NL(list_kdfs());
if (todo.mac_algorithms)
- list_macs();
+ MAYBE_ADD_NL(list_macs());
if (todo.cipher_commands)
- list_type(FT_cipher, one);
+ MAYBE_ADD_NL(list_type(FT_cipher, one));
if (todo.cipher_algorithms)
- list_ciphers("");
+ MAYBE_ADD_NL(list_ciphers(""));
if (todo.encoder_algorithms)
- list_encoders();
+ MAYBE_ADD_NL(list_encoders());
if (todo.decoder_algorithms)
- list_decoders();
+ MAYBE_ADD_NL(list_decoders());
if (todo.keymanager_algorithms)
- list_keymanagers();
+ MAYBE_ADD_NL(list_keymanagers());
if (todo.signature_algorithms)
- list_signatures();
+ MAYBE_ADD_NL(list_signatures());
if (todo.asym_cipher_algorithms)
- list_asymciphers();
+ MAYBE_ADD_NL(list_asymciphers());
if (todo.keyexchange_algorithms)
- list_keyexchanges();
+ MAYBE_ADD_NL(list_keyexchanges());
if (todo.kem_algorithms)
- list_kems();
+ MAYBE_ADD_NL(list_kems());
if (todo.pk_algorithms)
- list_pkey();
+ MAYBE_ADD_NL(list_pkey());
if (todo.pk_method)
- list_pkey_meth();
+ MAYBE_ADD_NL(list_pkey_meth());
if (todo.store_loaders)
- list_store_loaders();
+ MAYBE_ADD_NL(list_store_loaders());
if (todo.provider_info)
- list_provider_info();
+ MAYBE_ADD_NL(list_provider_info());
#ifndef OPENSSL_NO_DEPRECATED_3_0
if (todo.engines)
- list_engines();
+ MAYBE_ADD_NL(list_engines());
#endif
if (todo.disabled)
- list_disabled();
+ MAYBE_ADD_NL(list_disabled());
if (todo.objects)
- list_objects();
+ MAYBE_ADD_NL(list_objects());
+
+#undef MAYBE_ADD_NL
if (!done)
goto opthelp;