]> git.lyx.org Git - lyx.git/blob - src/support/userinfo.C
Collapse all those LFUN_XYZ_APPLY to a single LFUN_INSET_APPLY.
[lyx.git] / src / support / userinfo.C
1 /**
2  * \file userinfo.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "userinfo.h"
14 #include "LAssert.h"
15 #include "filetools.h"
16
17 #include <pwd.h>
18 #include <unistd.h>
19 #include <sys/types.h>
20
21 namespace lyx {
22
23 string const user_name()
24 {
25         struct passwd * pw(getpwuid(geteuid()));
26         lyx::Assert(pw);
27
28         string name = pw->pw_gecos;
29         if (name.empty())
30                 name = pw->pw_name;
31         return name;
32 }
33
34
35 string const user_email()
36 {
37         string email = GetEnv("EMAIL_ADDRESS");
38         if (email.empty())
39                 email = GetEnv("EMAIL");
40         return email;
41 }
42
43
44 } // namespace lyx