GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
manage/list.c
Go to the documentation of this file.
1/*!
2 \file lib/manage/list.c
3
4 \brief Manage Library - Element info
5
6 SPDX-FileCopyrightText: 2001-2011 GRASS Development Team
7 SPDX-License-Identifier: GPL-2.0-or-later
8
9 \author Original author CERL
10 */
11
12#include <grass/gis.h>
13
14#include "manage_local_proto.h"
15
16/*!
17 \brief Get list structure
18
19 \param n element id
20
21 \return pointer to list structure
22 \return NULL on error
23 */
24const struct list *M_get_list(int n)
25{
26 if (n >= nlist)
27 return NULL;
28
29 return &(list[n]);
30}
31
32/*!
33 \brief Find element type by name
34
35 \param data_type element type
36
37 \return element id
38 \return -1 not found
39 */
40int M_get_element(const char *data_type)
41{
42 int n;
43
44 for (n = 0; n < nlist; n++) {
45 if (G_strcasecmp(list[n].alias, data_type) == 0)
46 return n;
47 }
48
49 return -1;
50}
#define NULL
Definition ccmath.h:32
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
Definition strings.c:45
int M_get_element(const char *data_type)
Find element type by name.
Definition manage/list.c:40
const struct list * M_get_list(int n)
Get list structure.
Definition manage/list.c:24
int nlist
Definition read_list.c:21
Definition manage.h:4
char * alias
Definition manage.h:6