]> git.lyx.org Git - lyx.git/blob - src/support/userinfo.C
split LyXText::rowlist_ into individual Paragraph::rows_ chunks
[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 namespace support {
23
24 string const user_name()
25 {
26         struct passwd * pw(getpwuid(geteuid()));
27         Assert(pw);
28
29         string name = pw->pw_gecos;
30         if (name.empty())
31                 name = pw->pw_name;
32         return name;
33 }
34
35
36 string const user_email()
37 {
38         string email = GetEnv("EMAIL_ADDRESS");
39         if (email.empty())
40                 email = GetEnv("EMAIL");
41         return email;
42 }
43
44 } // namespace support
45 } // namespace lyx