GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 }