25 #include <grass/gis.h>
26 #include <grass/glocale.h>
50 static struct Cell_head dbwindow;
54 regvar =
getenv(
"GRASS_REGION");
57 char **tokens, *delm =
";";
67 G_fatal_error(_(
"region for current mapset %s\nrun \"g.region\""),
78 wind =
getenv(
"WIND_OVERRIDE");
85 G_fatal_error(_(
"region for current mapset %s\nrun \"g.region\""),
92 G_copy(window, &dbwindow,
sizeof(dbwindow));
119 if ((err =
G__get_window(window,
"",
"DEFAULT_WIND",
"PERMANENT"))) {
127 const char *element,
const char *
name,
const char *mapset)
132 G_zero((
char *)window,
sizeof(
struct Cell_head));
141 return G_store(_(
"is not set"));
150 sprintf(msg, _(
"is invalid\n%s"), err);
char * G_mapset(void)
current mapset name
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void G_free(void *buf)
Free allocated memory.
char * G_store(const char *s)
Copy string to allocated memory.
int G_free_tokens(char **tokens)
Free memory allocated to tokens.
char * G__read_Cell_head_array(char **array, struct Cell_head *cellhd, int is_cellhd)
int G_copy(void *a, const void *b, int n)
Copies n bytes starting at address b into address a.
int G_get_default_window(struct Cell_head *window)
read the default region
char ** G_tokenize(const char *buf, const char *delim)
Tokenize string.
int G_zero(void *buf, int i)
Zero out a buffer, buf, of length i.
int G_get_window(struct Cell_head *window)
read the database region
char * G__get_window(struct Cell_head *window, const char *element, const char *name, const char *mapset)
char * G__read_Cell_head(FILE *fd, struct Cell_head *cellhd, int is_cellhd)
FILE * G_fopen_old(const char *element, const char *name, const char *mapset)
Open a database file for reading.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.