diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-11-08 22:14:07 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-11-08 22:17:10 +0100 |
commit | 76c93d23c073ef8b885503b7d28a31ffe2add6d8 (patch) | |
tree | 1dd2d22a197bc40c5330e516969a7cb1ae9bc96f /doc/examples/print-ciphersuites.c | |
parent | 559a144f6bbcbb611453f82e655dd7438c14d1a7 (diff) | |
download | gnutls-76c93d23c073ef8b885503b7d28a31ffe2add6d8.tar.gz |
reindented code
Diffstat (limited to 'doc/examples/print-ciphersuites.c')
-rw-r--r-- | doc/examples/print-ciphersuites.c | 88 |
1 files changed, 46 insertions, 42 deletions
diff --git a/doc/examples/print-ciphersuites.c b/doc/examples/print-ciphersuites.c index a1f8ab3d1a..c0b83216dd 100644 --- a/doc/examples/print-ciphersuites.c +++ b/doc/examples/print-ciphersuites.c @@ -6,50 +6,54 @@ #include <string.h> #include <gnutls/gnutls.h> -static void -print_cipher_suite_list (const char* priorities) +static void print_cipher_suite_list(const char *priorities) { - size_t i; - int ret; - unsigned int idx; - const char *name; - const char *err; - unsigned char id[2]; - gnutls_protocol_t version; - gnutls_priority_t pcache; - - if (priorities != NULL) - { - printf ("Cipher suites for %s\n", priorities); - - ret = gnutls_priority_init(&pcache, priorities, &err); - if (ret < 0) - { - fprintf (stderr, "Syntax error at: %s\n", err); - exit(1); - } - - for (i=0;;i++) - { - ret = gnutls_priority_get_cipher_suite_index(pcache, i, &idx); - if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) break; - if (ret == GNUTLS_E_UNKNOWN_CIPHER_SUITE) continue; - - name = gnutls_cipher_suite_info(idx, id, NULL, NULL, NULL, &version); - - if (name != NULL) - printf ("%-50s\t0x%02x, 0x%02x\t%s\n", - name, (unsigned char) id[0], (unsigned char) id[1], - gnutls_protocol_get_name (version)); - } - - return; - } + size_t i; + int ret; + unsigned int idx; + const char *name; + const char *err; + unsigned char id[2]; + gnutls_protocol_t version; + gnutls_priority_t pcache; + + if (priorities != NULL) { + printf("Cipher suites for %s\n", priorities); + + ret = gnutls_priority_init(&pcache, priorities, &err); + if (ret < 0) { + fprintf(stderr, "Syntax error at: %s\n", err); + exit(1); + } + + for (i = 0;; i++) { + ret = + gnutls_priority_get_cipher_suite_index(pcache, + i, + &idx); + if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) + break; + if (ret == GNUTLS_E_UNKNOWN_CIPHER_SUITE) + continue; + + name = + gnutls_cipher_suite_info(idx, id, NULL, NULL, + NULL, &version); + + if (name != NULL) + printf("%-50s\t0x%02x, 0x%02x\t%s\n", + name, (unsigned char) id[0], + (unsigned char) id[1], + gnutls_protocol_get_name(version)); + } + + return; + } } -int main(int argc, char** argv) +int main(int argc, char **argv) { - if (argc > 1) - print_cipher_suite_list (argv[1]); - return 0; + if (argc > 1) + print_cipher_suite_list(argv[1]); + return 0; } |