2
/**************************************************************
3
* G_put_cell_title (name, title)
4
* char *name name of map file
5
* char *title new title
7
* changes the title for the cell file 'name' in current mapset
9
* returns 1 if ok, -1 if error
10
*************************************************************/
13
#include <grass/gis.h>
14
#include <grass/glocale.h>
16
int G_put_cell_title(const char *name, const char *title)
26
in = G_fopen_old("cats", name, mapset);
29
_("category information for [%s] in [%s] missing or invalid"),
35
tempfile = G_tempfile();
36
out = fopen(tempfile, "w");
39
sprintf(buf, _("G_put_title - can't create a temp file"));
44
for (line = 0; G_getl(buf, sizeof buf, in); line++) {
49
fprintf(out, "%s\n", buf);
54
/* must be #cats line, title line, and label for cat 0 */
56
sprintf(buf, _("category information for [%s] in [%s] invalid"), name,
62
in = fopen(tempfile, "r");
64
sprintf(buf, _("G_put_title - can't reopen temp file"));
69
out = G_fopen_new("cats", name);
72
sprintf(buf, _("can't write category information for [%s] in [%s]"),
78
while (fgets(buf, sizeof buf, in))
79
fprintf(out, "%s", buf);