GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gis/list.c File Reference
#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

int G_set_list_hit_return (int flag)
 
int 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...
 

Function Documentation

void G_free_list ( char **  list)

Free list.

Parameters
listchar* array to be freed
Returns

Definition at line 301 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 226 of file gis/list.c.

References buf, count, G_fatal_error(), G_free(), NULL, opendir(), readdir(), and sprintf().

int 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.
Returns
Number of elements

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

References count, G__mapset_name(), int, and n.

int G_set_list_hit_return ( int  flag)

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

References tools::flag.