Loading...
Searching...
No Matches
manage/list.c
Go to the documentation of this file.
/*!
\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;
}
NULL
#define NULL
Definition ccmath.h:32
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
struct list * list
Definition read_list.c:24
G_strcasecmp
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower).
Definition strings.c:47