GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-6366aade04
loc_info.c
Go to the documentation of this file.
1 #include <grass/imagery.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <grass/gis.h>
5 
6 /* makes a three part title with location, mapset info */
7 char *I_location_info(const char *middle)
8 {
9  char left[80];
10  char right[80];
11  char *buf;
12  int len, buf_len;
13 
14  snprintf(left, 80, "LOCATION: %s", G_location());
15  snprintf(right, 80, "MAPSET: %s", G_mapset());
16  len = 79 - strlen(left) - strlen(middle) - strlen(right);
17  buf_len = len + strlen(left) + strlen(middle) + strlen(right);
18  buf = (char *)G_calloc(buf_len, sizeof(char));
19  snprintf(buf, buf_len, "%s%*s%s%*s%s", left, len / 2, "", middle, len / 2,
20  "", right);
21 
22  return buf;
23 }
#define G_calloc(m, n)
Definition: defs/gis.h:95
const char * G_mapset(void)
Get current mapset name.
Definition: gis/mapset.c:33
const char * G_location(void)
Get current location name.
Definition: location.c:32
char * I_location_info(const char *middle)
Definition: loc_info.c:7