GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71790
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gis/list.c File Reference

List elements. More...

#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <grass/gis.h>
#include <grass/glocale.h>
Include dependency graph for gis/list.c:

Go to the source code of this file.

Functions

void G_list_element (const char *element, const char *desc, const char *mapset, int(*lister)(const char *, const char *, const char *))
 General purpose list function. More...
 
char ** G_list (int element, const char *gisbase, const char *location, const char *mapset)
 List specified type of elements. Application must release the allocated memory. More...
 
void G_free_list (char **list)
 Free list. More...
 

Detailed Description

List elements.

Author
Unknown (probably CERL)

(C) 2000, 2010 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.

Definition in file gis/list.c.

Function Documentation

void G_free_list ( char **  list)

Free list.

Parameters
listchar* array to be freed
Returns

Definition at line 251 of file gis/list.c.

References G_free().

char** G_list ( int  element,
const char *  gisbase,
const char *  location,
const char *  mapset 
)

List specified type of elements. Application must release the allocated memory.

Parameters
elementelement type (G_ELEMENT_RASTER, G_ELEMENT_VECTOR, G_ELEMENT_REGION )
gisbasepath to GISBASE
locationlocation name
mapsetmapset name
Returns
zero terminated array of element names

Definition at line 176 of file gis/list.c.

References _, count, G_ELEMENT_GROUP, G_ELEMENT_RASTER, G_ELEMENT_REGION, G_ELEMENT_VECTOR, G_fatal_error(), G_free(), list, NULL, opendir(), and readdir().

void G_list_element ( const char *  element,
const char *  desc,
const char *  mapset,
int(*)(const char *, const char *, const char *)  lister 
)

General purpose list function.

Will list files from all mapsets in the mapset list for a specified database element.

Note: output is to stdout piped thru the more utility

lister (char *name char *mapset, char* buf)

Given file name, and mapset, lister() should copy a string into 'buf' when called with name == "", should set buf to general title for mapset list.

Parameters
elementdatabase element (eg, "cell", "cellhd", etc.)
descdescription for element (if NULL, element is used)
mapsetmapset to be listed "" to list all mapsets in mapset search list "." will list current mapset
listerif given will call this routine to get a list title. NULL if no titles desired.

Definition at line 50 of file gis/list.c.

References _, count, G_close_pager(), G_get_mapset_name(), and G_open_pager().

Referenced by M_do_list().