GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
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 */
7char *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:140
const char * G_location(void)
Get current location name.
Definition location.c:32
const char * G_mapset(void)
Get current mapset name.
Definition gis/mapset.c:33
char * I_location_info(const char *middle)
Definition loc_info.c:7