-
-
Notifications
You must be signed in to change notification settings - Fork 294
/
list.c
52 lines (37 loc) · 877 Bytes
/
list.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*!
\file lib/manage/list.c
\brief Manage Library - Element info
(C) 2001-2011 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
\author Original author CERL
*/
#include <grass/gis.h>
#include "manage_local_proto.h"
/*!
\brief Get list structure
\param n element id
\return pointer to list structure
\return NULL on error
*/
const struct list *M_get_list(int n)
{
if (n >= nlist)
return NULL;
return &(list[n]);
}
/*!
\brief Find element type by name
\param data_type element type
\return element id
\return -1 not found
*/
int M_get_element(const char *data_type)
{
int n;
for (n = 0; n < nlist; n++) {
if (G_strcasecmp(list[n].alias, data_type) == 0)
return n;
}
return -1;
}