2
0

columns.c 785 B

123456789101112131415161718192021222324252627
  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. #include <string.h>
  10. #include "apps.h"
  11. #include "function.h"
  12. void calculate_columns(FUNCTION *functions, DISPLAY_COLUMNS *dc)
  13. {
  14. FUNCTION *f;
  15. int len, maxlen = 0;
  16. for (f = functions; f->name != NULL; ++f)
  17. if (f->type == FT_general || f->type == FT_md || f->type == FT_cipher)
  18. if ((len = strlen(f->name)) > maxlen)
  19. maxlen = len;
  20. dc->width = maxlen + 2;
  21. dc->columns = (80 - 1) / dc->width;
  22. }