22 #include <grass/config.h>
28 #include <grass/gis.h>
29 #include <grass/glocale.h>
31 static int G__open_misc(
const char *dir,
33 const char *
name,
const char *mapset,
int mode)
44 if (*mapset && strcmp(xmapset, mapset) != 0) {
45 G_warning(_(
"G__open_misc(read): mapset <%s> doesn't match xmapset <%s>"),
63 if (mode == 1 || mode == 2) {
66 if (strcmp(xmapset, mapset) != 0) {
67 G_warning(_(
"G__open_misc(write): xmapset <%s> != G_mapset() <%s>"),
78 if (mode == 1 || access(path, 0) != 0) {
80 close(creat(path, 0666));
83 return open(path, mode);
105 return G__open_misc(dir, element, name,
G_mapset(), 1);
127 return G__open_misc(dir, element, name, mapset, 0);
149 fd = G__open_misc(dir, element, name,
G_mapset(), 2);
151 lseek(fd, 0L, SEEK_END);
176 fd = G__open_misc(dir, element, name,
G_mapset(), 1);
180 return fdopen(fd,
"w");
205 fd = G__open_misc(dir, element, name, mapset, 0);
209 return fdopen(fd,
"r");
217 fd = G__open_misc(dir, element, name,
G_mapset(), 2);
220 lseek(fd, 0L, SEEK_END);
222 return fdopen(fd,
"a");
230 fd = G__open_misc(dir, element, name,
G_mapset(), 2);
233 lseek(fd, 0L, SEEK_END);
235 return fdopen(fd,
"r+");
char * G_mapset(void)
current mapset name
FILE * G_fopen_modify_misc(const char *dir, const char *element, const char *name)
char * G__file_name_misc(char *path, const char *dir, const char *element, const char *name, const char *mapset)
char * G_find_file2_misc(const char *dir, const char *element, const char *name, const char *mapset)
FILE * G_fopen_old_misc(const char *dir, const char *element, const char *name, const char *mapset)
open a database file for reading
FILE * G_fopen_append_misc(const char *dir, const char *element, const char *name)
int G_open_old_misc(const char *dir, const char *element, const char *name, const char *mapset)
open a database file for reading
int G_open_new_misc(const char *dir, const char *element, const char *name)
open a new database file
int G__make_mapset_element_misc(const char *dir, const char *name)
Create misc element in the current mapset.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
FILE * G_fopen_new_misc(const char *dir, const char *element, const char *name)
open a new database file
int G__check_gisinit(void)
Checks to see if GIS engine is initialized.
int G_open_update_misc(const char *dir, const char *element, const char *name)
open a database file for update
int G_legal_filename(const char *s)
Check for legal database file name.
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)