GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73574
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
loc_info.c
Go to the documentation of this file.
1 #include <grass/imagery.h>
2 #include <string.h>
3 #include <grass/gis.h>
4 
5 /* makes a three part title with location, mapset info */
6 char *I_location_info(const char *middle)
7 {
8  char left[80];
9  char right[80];
10  char *buf;
11  int len, buf_len;
12 
13  G_snprintf(left, 80, "LOCATION: %s", G_location());
14  G_snprintf(right, 80, "MAPSET: %s", G_mapset());
15  len = 79 - strlen(left) - strlen(middle) - strlen(right);
16  buf_len = len + strlen(left) + strlen(middle) + strlen(right);
17  buf = (char*)G_calloc(buf_len, sizeof(char));
18  G_snprintf(buf, buf_len, "%s%*s%s%*s%s",
19  left, len / 2, "", middle, len / 2, "", right);
20 
21  return buf;
22 }
const char * G_location(void)
Get current location name.
Definition: location.c:32
int G_snprintf(char *str, size_t size, const char *fmt,...)
snprintf() clone.
Definition: snprintf.c:43
char * I_location_info(const char *middle)
Definition: loc_info.c:6
const char * G_mapset(void)
Get current mapset name.
Definition: gis/mapset.c:33