sites_title.c

Go to the documentation of this file.
00001 /**************************************************************
00002  * 
00003  * char *G_get_cell_title (name, mapset)
00004  *   char *name        name of map file
00005  *   char *mapset      mapset containing name
00006  *
00007  *   returns pointer to string containing cell title. (from cats file)
00008  *************************************************************/
00009 
00010 #include "gis.h"
00011 #include "site.h"
00012 
00013 char *
00014 G_get_sites_title (name, mapset)
00015     char *name;
00016     char *mapset;
00017 {
00018     FILE *fd;
00019     int stat;
00020     Site_head head;
00021 
00022     stat = -1;
00023     fd = G_fopen_old ("site_lists", name, mapset);
00024     if (fd)
00025     {
00026         stat = 1;
00027         if (G_site_get_head (fd, &head) != 0)
00028             stat = -1;
00029 
00030         fclose (fd);
00031     }
00032 
00033     if (stat < 0)
00034         return G_store("");
00035 
00036     if (head.name)   G_free(head.name);
00037     if (head.form)   G_free(head.form);
00038     if (head.labels) G_free(head.labels);
00039     if (head.stime)  G_free(head.stime);
00040     if (head.time)   G_free(head.time);
00041 
00042     if (!head.desc)
00043         return G_store("");
00044 
00045     G_strip (head.desc);
00046 
00047     return head.desc;
00048 }

Generated on Mon Jan 1 19:49:26 2007 for GRASS by  doxygen 1.5.1