31 #include "gis_local_proto.h"
33 static int G__open_misc(
const char *dir,
const char *
element,
const char *
name,
34 const char *mapset,
int mode)
45 if (*mapset && strcmp(xmapset, mapset) != 0) {
46 G_warning(
_(
"G__open_misc(read): mapset <%s> doesn't match "
62 if ((fd = open(
path, 0)) < 0)
63 G_warning(
"G__open_misc(read): Unable to open '%s': %s",
path,
68 if (mode == 1 || mode == 2) {
71 if (strcmp(xmapset, mapset) != 0) {
73 _(
"G__open_misc(write): xmapset <%s> != G_mapset() <%s>"),
84 if (mode == 1 || access(
path, 0) != 0) {
86 close(creat(
path, 0666));
89 if ((fd = open(
path, mode)) < 0)
90 G_warning(
"G__open_misc(write): Unable to open '%s': %s",
path,
135 return G__open_misc(dir,
element,
name, mapset, 0);
158 lseek(fd, 0L, SEEK_END);
186 return fdopen(fd,
"w");
214 return fdopen(fd,
"r");
225 lseek(fd, 0L, SEEK_END);
227 return fdopen(fd,
"a");
238 lseek(fd, 0L, SEEK_END);
240 return fdopen(fd,
"r+");
char * G_file_name_misc(char *, const char *, const char *, const char *, const char *)
Builds full path names to GIS misc data files.
int G_name_is_fully_qualified(const char *, char *, char *)
Check if map name is fully qualified (map @ mapset)
int G__make_mapset_element_misc(const char *, const char *)
Create misc element in the current mapset.
void G_warning(const char *,...) __attribute__((format(printf
int G_legal_filename(const char *)
Check for legal database file name.
const char * G_mapset(void)
Get current mapset name.
const char * G_find_file2_misc(const char *, const char *, const char *, const char *)
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)
void G__check_gisinit(void)
Checks to see if GIS engine is initialized.
int G_open_new_misc(const char *dir, const char *element, const char *name)
open a new database misc file
FILE * G_fopen_modify_misc(const char *dir, const char *element, const char *name)
FILE * G_fopen_old_misc(const char *dir, const char *element, const char *name, const char *mapset)
open a database misc file for reading
FILE * G_fopen_new_misc(const char *dir, const char *element, const char *name)
open a new database misc file
int G_open_update_misc(const char *dir, const char *element, const char *name)
open a database misc file for update
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 misc file for reading