X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fuserinfo.cpp;h=c873afe24744d9c5616348f97e34662c77869ce3;hb=892e237fe1c5d7574b08d017070262239465f70b;hp=3a8d43e556057316e13292e616bd73cd1dee4223;hpb=f212b483355d68e93132fb469814e13335d0886b;p=lyx.git diff --git a/src/support/userinfo.cpp b/src/support/userinfo.cpp index 3a8d43e556..c873afe247 100644 --- a/src/support/userinfo.cpp +++ b/src/support/userinfo.cpp @@ -12,11 +12,12 @@ #include "support/userinfo.h" #include "support/environment.h" +#include "support/docstring.h" -#include +#include "support/lassert.h" #if defined (_WIN32) -# include "gettext.h" +# include "support/gettext.h" # include # include #else @@ -29,7 +30,7 @@ # include #endif -using std::string; +using namespace std; namespace lyx { namespace support { @@ -44,10 +45,12 @@ docstring const user_name() return _("Unknown user"); return from_local8bit(name); #else - struct passwd * pw(getpwuid(geteuid())); - BOOST_ASSERT(pw); + struct passwd * pw = getpwuid(geteuid()); + LASSERT(pw, /**/); - string name = pw->pw_gecos; + const string gecos = pw->pw_gecos; + const size_t pos = gecos.find(","); + string name = gecos.substr(0, pos); if (name.empty()) name = pw->pw_name; return from_local8bit(name); @@ -57,6 +60,11 @@ docstring const user_name() docstring const user_email() { + //FIXME: quick fix wrt bug #3764; only Anonymous is detected now. + //The code after should be used only after user approval. + return docstring(); + + string email = getEnv("EMAIL_ADDRESS"); if (email.empty()) email = getEnv("EMAIL");