get_len.c 696 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*!
  2. \file lib/manage/get_len.c
  3. \brief Manage Library - Get max length of element's description
  4. (C) 2001-2011 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Original author CERL
  8. */
  9. #include <string.h>
  10. #include "manage_local_proto.h"
  11. /*!
  12. \brief Get max length of element's description
  13. \param n element id
  14. \return buffer length
  15. */
  16. int M__get_description_len(int n)
  17. {
  18. int len;
  19. int l;
  20. int i;
  21. len = 1;
  22. for (i = 0; i < list[n].nelem; i++) {
  23. l = strlen(list[n].desc[i]);
  24. if (l > len)
  25. len = l;
  26. }
  27. return len;
  28. }