GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
put_window.c
Go to the documentation of this file.
1 /*
2  **********************************************************************
3  *
4  * G_put_window (window)
5  * write the current mapset window
6  **********************************************************************
7  *
8  * G__put_window (window, dir, name)
9  * write the window 'name' in 'mapset'
10  * returns -1 error
11  * 1 ok
12  *********************************************************************/
13 
14 #include <stdlib.h>
15 #include <grass/gis.h>
16 
32 int G_put_window(const struct Cell_head *window)
33 {
34  char *wind = getenv("WIND_OVERRIDE");
35 
36  return wind ? G__put_window(window, "windows", wind)
37  : G__put_window(window, "", "WIND");
38 }
39 
40 int G__put_window(const struct Cell_head *window, char *dir, char *name)
41 {
42  FILE *fd;
43 
44  if (!(fd = G_fopen_new(dir, name)))
45  return -1;
46 
47  G__write_Cell_head3(fd, window, 0);
48  fclose(fd);
49 
50  return 1;
51 }
FILE * fd
Definition: g3dcolor.c:368
string name
Definition: render.py:1314
char * getenv()
int G_put_window(const struct Cell_head *window)
write the database region
Definition: put_window.c:32
tuple window
Definition: tools.py:543
FILE * G_fopen_new(const char *element, const char *name)
Open a new database file.
Definition: gis/open.c:197
fclose(fd)
int G__put_window(const struct Cell_head *window, char *dir, char *name)
Definition: put_window.c:40
int G__write_Cell_head3(FILE *fd, const struct Cell_head *cellhd, int is_cellhd)
Write 3D cell header or window.
Definition: wr_cellhd.c:80