GRASS GIS 7 Programmer's Manual  7.0.2(2015)-r00000
myname.c
Go to the documentation of this file.
1 
14 #include <string.h>
15 #include <grass/gis.h>
16 #include <grass/glocale.h>
17 
31 char *G_myname(void)
32 {
33  char name[GNAME_MAX];
34  char path[GPATH_MAX];
35  FILE *fd;
36  int ok;
37 
38  ok = 0;
39 
40  G_file_name(path, "", "MYNAME", "PERMANENT");
41  if ((fd = fopen(path, "r"))) {
42  ok = G_getl(name, sizeof name, fd);
43  fclose(fd);
44  }
45  if (!ok)
46  strcpy(name, _("This location has no description."));
47 
48  return G_store(name);
49 }
char * G_myname(void)
Returns location title.
Definition: myname.c:31
char * G_store(const char *s)
Copy string to allocated memory.
Definition: strings.c:86
char * G_file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
Definition: file_name.c:33
int G_getl(char *buf, int n, FILE *fd)
Gets a line of text from a file.
Definition: getl.c:31
Definition: path.h:16
const char * name
Definition: named_colr.c:7