Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/openssl/apps/lib/columns.c
34870 views
1
/*
2
* Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
3
*
4
* Licensed under the Apache License 2.0 (the "License"). You may not use
5
* this file except in compliance with the License. You can obtain a copy
6
* in the file LICENSE in the source distribution or at
7
* https://www.openssl.org/source/license.html
8
*/
9
10
#include <string.h>
11
#include "apps.h"
12
#include "function.h"
13
14
void calculate_columns(FUNCTION *functions, DISPLAY_COLUMNS *dc)
15
{
16
FUNCTION *f;
17
int len, maxlen = 0;
18
19
for (f = functions; f->name != NULL; ++f)
20
if (f->type == FT_general || f->type == FT_md || f->type == FT_cipher)
21
if ((len = strlen(f->name)) > maxlen)
22
maxlen = len;
23
24
dc->width = maxlen + 2;
25
dc->columns = (80 - 1) / dc->width;
26
}
27
28
29