GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
gis/whoami.c
Go to the documentation of this file.
1
17
#include <unistd.h>
18
#include <stdlib.h>
19
20
#ifndef __MINGW32__
21
#include <pwd.h>
22
#endif
23
24
#include <grass/gis.h>
25
26
40
char
*
G_whoami
(
void
)
41
{
42
#ifdef __MINGW32__
43
char
*
name
=
getenv
(
"USERNAME"
);
44
45
if
(name ==
NULL
) {
46
name =
"user_name"
;
47
}
48
#else
49
static
char
*name =
NULL
;
50
51
#ifdef COMMENTED_OUT
52
char
*getlogin();
53
char
*ttyname();
54
55
if
(name ==
NULL
) {
56
char
*x;
57
58
x = ttyname(0);
59
if
(x && *x) {
60
x = getlogin();
61
if
(x && *x)
62
name =
G_store
(x);
63
}
64
}
65
#endif
/* COMMENTED_OUT */
66
67
if
(name ==
NULL
) {
68
struct
passwd *p;
69
70
if
((p = getpwuid(getuid())))
71
name =
G_store
(p->pw_name);
72
}
73
if
(name ==
NULL
)
74
name =
G_store
(
"?"
);
75
76
#endif
77
78
return
name
;
79
}
lib
gis
whoami.c
Generated on Thu Sep 26 2013 09:48:07 for GRASS Programmer's Manual by
1.8.4