X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fuserinfo.cpp;h=c873afe24744d9c5616348f97e34662c77869ce3;hb=892e237fe1c5d7574b08d017070262239465f70b;hp=da86eb3355b96861dadaf0649ac8ef42197f983d;hpb=a8cd9a4b8fd325b00c75f601c66c6d618ba276db;p=lyx.git diff --git a/src/support/userinfo.cpp b/src/support/userinfo.cpp index da86eb3355..c873afe247 100644 --- a/src/support/userinfo.cpp +++ b/src/support/userinfo.cpp @@ -14,10 +14,10 @@ #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 @@ -30,7 +30,7 @@ # include #endif -using std::string; +using namespace std; namespace lyx { namespace support { @@ -46,9 +46,11 @@ docstring const user_name() return from_local8bit(name); #else struct passwd * pw = getpwuid(geteuid()); - BOOST_ASSERT(pw); + 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);