GRASS Programmer's Manual  6.4.2(2012)
put_window.c
Go to the documentation of this file.
00001 /*
00002  **********************************************************************
00003  *
00004  * G_put_window (window)
00005  *      write the current mapset window
00006  **********************************************************************
00007  *
00008  * G__put_window (window, dir, name)
00009  *      write the window 'name' in 'mapset'
00010  *      returns -1  error
00011  *               1  ok
00012  *********************************************************************/
00013 
00014 #include <stdlib.h>
00015 #include <grass/gis.h>
00016 
00032 int G_put_window(const struct Cell_head *window)
00033 {
00034     char *wind = getenv("WIND_OVERRIDE");
00035 
00036     return wind ? G__put_window(window, "windows", wind)
00037         : G__put_window(window, "", "WIND");
00038 }
00039 
00040 int G__put_window(const struct Cell_head *window, char *dir, char *name)
00041 {
00042     FILE *fd;
00043 
00044     if (!(fd = G_fopen_new(dir, name)))
00045         return -1;
00046 
00047     G__write_Cell_head3(fd, window, 0);
00048     fclose(fd);
00049 
00050     return 1;
00051 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines