GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
mapset_nme.c File Reference

GIS library - Mapset name, search path routines. More...

#include <grass/config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <grass/gis.h>
#include "gis_local_proto.h"
Include dependency graph for mapset_nme.c:

Go to the source code of this file.

Functions

const charG_get_mapset_name (int n)
 Get name of the n'th mapset from the current mapset search path.
 
void G__get_list_of_mapsets (void)
 Fill list of mapsets from search path (internal use only)
 
void G_create_alt_search_path (void)
 Define alternative mapset search path.
 
void G_switch_search_path (void)
 Switch mapset search path.
 
void G_reset_mapsets (void)
 Reset number of mapsets.
 
char ** G_get_available_mapsets (void)
 Get list of available mapsets for current location.
 
void G_add_mapset_to_search_path (const char *mapset)
 Add mapset to the list of mapsets in search path.
 
int G_is_mapset_in_search_path (const char *mapset)
 Check if given mapset is in search path.
 

Detailed Description

GIS library - Mapset name, search path routines.

SPDX-FileCopyrightText: 1999-2014 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later

Definition in file mapset_nme.c.

Function Documentation

◆ G__get_list_of_mapsets()

void G__get_list_of_mapsets ( void  )

Fill list of mapsets from search path (internal use only)

Definition at line 55 of file mapset_nme.c.

References G_fopen_old(), G_mapset(), G_mapset_permissions(), GNAME_MAX, name, NULL, and UntypedStream::path.

Referenced by G_get_mapset_name(), and G_init_all().

◆ G_add_mapset_to_search_path()

void G_add_mapset_to_search_path ( const char mapset)

Add mapset to the list of mapsets in search path.

Mapset is add in memory only, not to the SEARCH_PATH file! List is check first if already exists.

Parameters
mapsetmapset name to be added to the search path

Definition at line 201 of file mapset_nme.c.

References G_is_mapset_in_search_path().

◆ G_create_alt_search_path()

void G_create_alt_search_path ( void  )

Define alternative mapset search path.

Definition at line 104 of file mapset_nme.c.

References UntypedStream::path.

◆ G_get_available_mapsets()

char ** G_get_available_mapsets ( void  )

Get list of available mapsets for current location.

List is updated by each call to this function.

Returns
pointer to NULL terminated array of available mapsets

Definition at line 145 of file mapset_nme.c.

References AMI_STREAM< T >::AMI_STREAM(), UntypedStream::buf, closedir(), G_calloc, G_debug(), G_free(), G_location_path(), G_realloc, G_stat(), G_store(), GPATH_MAX, NULL, opendir(), and readdir().

◆ G_get_mapset_name()

const char * G_get_mapset_name ( int  n)

Get name of the n'th mapset from the current mapset search path.

The first call will initialize the list.

Parameters
nmapset index
Returns
mapset name
NULL if mapset not found

Definition at line 42 of file mapset_nme.c.

References G__get_list_of_mapsets(), NULL, and UntypedStream::path.

Referenced by G_list_element(), and I_signatures_list_by_type().

◆ G_is_mapset_in_search_path()

int G_is_mapset_in_search_path ( const char mapset)

Check if given mapset is in search path.

Parameters
mapsetmapset name
Returns
1 mapset found in search path
0 mapset not found

Definition at line 215 of file mapset_nme.c.

References AMI_STREAM< T >::AMI_STREAM(), and UntypedStream::path.

Referenced by G_add_mapset_to_search_path().

◆ G_reset_mapsets()

void G_reset_mapsets ( void  )

Reset number of mapsets.

Definition at line 133 of file mapset_nme.c.

References UntypedStream::path.

◆ G_switch_search_path()

void G_switch_search_path ( void  )

Switch mapset search path.

Definition at line 115 of file mapset_nme.c.

References count, and UntypedStream::path.