do_list.c 941 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*!
  2. \file lib/manage/do_list.c
  3. \brief Manage Library - List elements
  4. (C) 2001-2012 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 <grass/gis.h>
  10. #include <grass/glocale.h>
  11. #include "manage_local_proto.h"
  12. /*!
  13. \brief List elements
  14. \param n element index in the array (negative value for all elements)
  15. \param mapset name of mapset ("" for search path)
  16. */
  17. void M_do_list(int n, const char *mapset)
  18. {
  19. int i;
  20. if (n >= nlist) {
  21. G_fatal_error(_("%s: invalid index %d"), "M_do_list()", n);
  22. }
  23. if (n < 0) {
  24. for (i = 0; i < nlist; i++) {
  25. G_list_element(list[i].element[0], list[i].desc[0],
  26. mapset, (int (*)())0);
  27. }
  28. }
  29. else {
  30. G_list_element(list[n].element[0], list[n].desc[0],
  31. mapset, (int (*)())0);
  32. }
  33. }