3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "support/userinfo.h"
14 #include "support/environment.h"
15 #include "support/docstring.h"
17 #include "support/lassert.h"
20 # include "support/gettext.h"
29 #ifdef HAVE_SYS_TYPES_H
30 # include <sys/types.h>
38 string const user_name()
43 DWORD size = UNLEN + 1;
44 if (!GetUserName(name, &size))
45 return to_utf8(_("Unknown user"));
46 return to_utf8(from_local8bit(name));
48 struct passwd * pw = getpwuid(geteuid());
49 LASSERT(pw, return string());
51 const string gecos = pw->pw_gecos;
52 const size_t pos = gecos.find(",");
53 string name = gecos.substr(0, pos);
56 return to_utf8(from_local8bit(name));
61 string const user_email()
63 //FIXME: quick fix wrt bug #3764; only Anonymous is detected now.
64 //The code after should be used only after user approval.
68 string email = getEnv("EMAIL_ADDRESS");
70 email = getEnv("EMAIL");
71 return to_utf8(from_local8bit(email));
75 } // namespace support