GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
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
(C) 2001-2011 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
16
#include "manage_local_proto.h"
17
18
/*!
19
\brief Get list structure
20
21
\param n element id
22
23
\return pointer to list structure
24
\return NULL on error
25
*/
26
const
struct
list
*
M_get_list
(
int
n)
27
{
28
if
(n >=
nlist
)
29
return
NULL
;
30
31
return
&(
list
[n]);
32
}
33
34
/*!
35
\brief Find element type by name
36
37
\param data_type element type
38
39
\return element id
40
\return -1 not found
41
*/
42
int
M_get_element
(
const
char
*data_type)
43
{
44
int
n;
45
46
for
(n = 0; n <
nlist
; n++) {
47
if
(
G_strcasecmp
(
list
[n].
alias
, data_type) == 0)
48
return
n;
49
}
50
51
return
-1;
52
}
NULL
#define NULL
Definition:
ccmath.h:32
G_strcasecmp
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
Definition:
strings.c:47
gis.h
M_get_element
int M_get_element(const char *data_type)
Find element type by name.
Definition:
manage/list.c:42
M_get_list
const struct list * M_get_list(int n)
Get list structure.
Definition:
manage/list.c:26
nlist
int nlist
Definition:
read_list.c:23
list
Definition:
manage.h:4
list::alias
char * alias
Definition:
manage.h:6
lib
manage
list.c
Generated on Sat Dec 21 2024 07:31:26 for GRASS GIS 8 Programmer's Manual by
1.9.1