GRASS 8 Programmer's Manual
8.6.0dev(2026)-55de52a352
Loading...
Searching...
No Matches
myname.c
Go to the documentation of this file.
1
/*!
2
* \file lib/gis/myname.c
3
*
4
* \brief GIS Library - Database name functions.
5
*
6
* SPDX-FileCopyrightText: 2001-2009 GRASS Development Team
7
* SPDX-License-Identifier: GPL-2.0-or-later
8
*
9
* \author Original author CERL
10
*/
11
12
#include <
string.h
>
13
#include <
grass/gis.h
>
14
#include <
grass/glocale.h
>
15
16
/*!
17
* \brief Returns location title.
18
*
19
* Returns a one line title for the database location. This title is
20
* read from the file MYNAME in the PERMANENT mapset. See also \ref
21
* Permanent_Mapset for a discussion of the PERMANENT mapset.
22
*
23
* <b>Note:</b> This name is the first line in the file
24
* $GISDBASE/$LOCATION_NAME/PERMANENT/MYNAME
25
*
26
* \return pointer to a string
27
*/
28
char
*
G_myname
(
void
)
29
{
30
char
name
[
GNAME_MAX
];
31
char
path
[
GPATH_MAX
];
32
FILE
*fd;
33
int
ok
;
34
35
ok
= 0;
36
37
G_file_name
(
path
,
""
,
"MYNAME"
,
"PERMANENT"
);
38
if
((fd =
fopen
(
path
,
"r"
))) {
39
ok
=
G_getl
(
name
,
sizeof
name
, fd);
40
fclose
(fd);
41
}
42
if
(!
ok
)
43
strcpy
(
name
,
_
(
"This location has no description."
));
44
45
return
G_store
(
name
);
46
}
AMI_STREAM
Definition
ami_stream.h:153
G_file_name
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
Definition
file_name.c:59
G_store
char * G_store(const char *)
Copy string to allocated memory.
Definition
strings.c:85
G_getl
int G_getl(char *, int, FILE *)
Gets a line of text from a file.
Definition
getl.c:31
gis.h
GPATH_MAX
#define GPATH_MAX
Definition
gis.h:196
GNAME_MAX
#define GNAME_MAX
Definition
gis.h:193
glocale.h
_
#define _(str)
Definition
glocale.h:10
G_myname
char * G_myname(void)
Returns location title.
Definition
myname.c:28
name
const char * name
Definition
named_colr.c:6
strcpy
#define strcpy
Definition
parson.c:66
string.h
path
Definition
path.h:15
lib
gis
myname.c
Generated on Thu Sep 10 2026 06:57:37 for GRASS 8 Programmer's Manual by
1.9.8