GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
Main Page
Related Pages
+
Data Structures
Data Structures
Class Hierarchy
+
Data Fields
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
x
y
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
y
z
+
Enumerations
a
c
d
e
h
l
m
n
o
p
r
s
t
v
y
+
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
mach_name.c
Go to the documentation of this file.
1
#include <unistd.h>
2
#include <
grass/gis.h
>
3
#include <
grass/config.h
>
4
#ifdef HAVE_SYS_UTSNAME_H
5
#include <sys/utsname.h>
6
#endif
7
8
/* this routine returns a name for the machine
9
* it returns the empty string, if this info
10
* not available (it never returns a NULL pointer)
11
*
12
* the name is stored in a static array and the pointer to this
13
* array is returned.
14
*
15
*/
16
17
const
char
*
G__machine_name
(
void
)
18
{
19
static
int
initialized;
20
static
char
name
[128];
21
22
if
(
G_is_initialized
(&initialized))
23
return
name
;
24
25
#if defined(HAVE_GETHOSTNAME)
26
gethostname(name,
sizeof
(name));
27
name[
sizeof
(
name
) - 1] = 0;
/* make sure NUL terminated */
28
#elif defined(HAVE_SYS_UTSNAME_H)
29
{
30
struct
utsname attname;
31
uname(&attname);
32
strcpy(name, attname.nodename);
33
}
34
#else
35
strcpy(name,
"unknown"
);
36
#endif
37
38
G_initialize_done
(&initialized);
39
return
name
;
40
}
config.h
G_initialize_done
void G_initialize_done(int *)
Definition:
counter.c:76
gis.h
G__machine_name
const char * G__machine_name(void)
Definition:
mach_name.c:17
G_is_initialized
int G_is_initialized(int *)
Definition:
counter.c:59
name
const char * name
Definition:
named_colr.c:7
lib
gis
mach_name.c
Generated on Mon May 31 2021 05:21:30 for GRASS GIS 7 Programmer's Manual by
1.8.13