56 #include <grass/gis.h>
57 #include <grass/glocale.h>
79 G_zero(hist,
sizeof(
struct History));
85 if (!
G_getl(hist->mapid,
sizeof(hist->mapid), fd))
89 if (!
G_getl(hist->title,
sizeof(hist->title), fd))
93 if (!
G_getl(hist->mapset,
sizeof(hist->mapset), fd))
97 if (!
G_getl(hist->creator,
sizeof(hist->creator), fd))
101 if (!
G_getl(hist->maptype,
sizeof(hist->maptype), fd))
105 if (!
G_getl(hist->datsrc_1,
sizeof(hist->datsrc_1), fd))
109 if (!
G_getl(hist->datsrc_2,
sizeof(hist->datsrc_2), fd))
113 if (!
G_getl(hist->keywrd,
sizeof(hist->keywrd), fd))
118 while ((hist->edlinecnt < MAXEDLINES) &&
120 (hist->edhist[hist->edlinecnt],
sizeof(hist->edhist[0]), fd))) {
132 G_warning(_(
"can't get history information for [%s] in mapset [%s]"),
162 fprintf(fd,
"%s\n", hist->mapid);
163 fprintf(fd,
"%s\n", hist->title);
164 fprintf(fd,
"%s\n", hist->mapset);
165 fprintf(fd,
"%s\n", hist->creator);
166 fprintf(fd,
"%s\n", hist->maptype);
167 fprintf(fd,
"%s\n", hist->datsrc_1);
168 fprintf(fd,
"%s\n", hist->datsrc_2);
169 fprintf(fd,
"%s\n", hist->keywrd);
171 for (i = 0; i < hist->edlinecnt; i++)
172 fprintf(fd,
"%s\n", hist->edhist[i]);
180 G_warning(_(
"can't write history information for [%s]"), name);
204 strncpy(hist->mapid,
G_date(), RECORD_LEN);
205 strncpy(hist->title, name, RECORD_LEN);
206 strncpy(hist->mapset,
G_mapset(), RECORD_LEN);
207 strncpy(hist->creator,
G_whoami(), RECORD_LEN);
208 strncpy(hist->maptype, type, RECORD_LEN);
211 strcpy(hist->datsrc_1,
"");
212 strcpy(hist->datsrc_2,
"");
260 cmdlen = strlen(cmdlin);
262 if (hist->edlinecnt > MAXEDLINES - 2) {
263 G_warning(_(
"Not enough room in history file to record command line."));
267 if (hist->edlinecnt > 0) {
268 strcpy(hist->edhist[hist->edlinecnt],
"");
278 while ((cmdlen - j) > 70) {
279 strncpy(hist->edhist[hist->edlinecnt], &cmdlin[j], 68);
280 hist->edhist[hist->edlinecnt][68] =
'\0';
281 strcat(hist->edhist[hist->edlinecnt],
"\\");
284 if (hist->edlinecnt > MAXEDLINES - 2) {
285 G_warning(_(
"Not enough room in history file for command line (truncated)."));
289 if ((cmdlen - j) > 0) {
290 strcpy(hist->edhist[hist->edlinecnt], &cmdlin[j]);