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 docstring const user_name()
43 DWORD size = UNLEN + 1;
44 if (!GetUserName(name, &size))
45 return _("Unknown user");
46 return from_local8bit(name);
48 struct passwd * pw = getpwuid(geteuid());
49 LASSERT(pw, return docstring());
51 const string gecos = pw->pw_gecos;
52 const size_t pos = gecos.find(",");
53 string name = gecos.substr(0, pos);
56 return from_local8bit(name);
61 docstring 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 from_local8bit(email);
74 } // namespace support