GRASS GIS 8 Programmer's Manual 8.3.2(2024)-exported
Loading...
Searching...
No Matches
do_list.c
Go to the documentation of this file.
1/*!
2 \file lib/manage/do_list.c
3
4 \brief Manage Library - List elements
5
6 (C) 2001-2012 by the GRASS Development Team
7
8 This program is free software under the GNU General Public License
9 (>=v2). Read the file COPYING that comes with GRASS for details.
10
11 \author Original author CERL
12 */
13
14#include <grass/gis.h>
15#include <grass/glocale.h>
16
17#include "manage_local_proto.h"
18
19/*!
20 \brief List elements
21
22 \param n element index in the array (negative value for all elements)
23 \param mapset name of mapset ("" for search path)
24 */
25void M_do_list(int n, const char *mapset)
26{
27 int i;
28
29 if (n >= nlist) {
30 G_fatal_error(_("%s: invalid index %d"), "M_do_list()", n);
31 }
32
33 if (n < 0) {
34 for (i = 0; i < nlist; i++) {
35 G_list_element(list[i].element[0], list[i].desc[0], mapset, NULL);
36 }
37 }
38 else {
39 G_list_element(list[n].element[0], list[n].desc[0], mapset, NULL);
40 }
41}
#define NULL
Definition ccmath.h:32
void M_do_list(int n, const char *mapset)
List elements.
Definition do_list.c:25
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
Definition gis/error.c:159
void G_list_element(const char *element, const char *desc, const char *mapset, int(*lister)(const char *, const char *, char *))
General purpose list function.
Definition gis/list.c:51
int nlist
Definition read_list.c:23
struct list * list
Definition read_list.c:24