]> git.lyx.org Git - lyx.git/blob - src/support/userinfo.C
Change Assert to BOOST_ASSERT.
[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 "filetools.h"
15
16 #include <boost/assert.hpp>
17
18 #include <pwd.h>
19 #include <unistd.h>
20 #include <sys/types.h>
21
22 namespace lyx {
23 namespace support {
24
25 string const user_name()
26 {
27         struct passwd * pw(getpwuid(geteuid()));
28         BOOST_ASSERT(pw);
29
30         string name = pw->pw_gecos;
31         if (name.empty())
32                 name = pw->pw_name;
33         return name;
34 }
35
36
37 string const user_email()
38 {
39         string email = GetEnv("EMAIL_ADDRESS");
40         if (email.empty())
41                 email = GetEnv("EMAIL");
42         return email;
43 }
44
45 } // namespace support
46 } // namespace lyx