better (more precise) values for wxGetOsDescription() (patch 1047539)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-11-10 22:08:37 +00:00
parent 3e5f6c1c4f
commit db1d019338
5 changed files with 87 additions and 12 deletions

View File

@@ -837,11 +837,20 @@ bool wxGetUserName(wxChar *buf, int sz)
wxString wxGetOsDescription()
{
#ifndef WXWIN_OS_DESCRIPTION
#error WXWIN_OS_DESCRIPTION should be defined in config.h by configure
#else
return wxString::FromAscii( WXWIN_OS_DESCRIPTION );
#endif
FILE *f = popen("uname -s -r -m", "r");
if (f)
{
char buf[256];
size_t c = fread(buf, 1, sizeof(buf) - 1, f);
pclose(f);
// Trim newline from output.
if (c && buf[c - 1] == '\n')
--c;
buf[c] = '\0';
return wxString::FromAscii( buf );
}
wxFAIL_MSG( _T("uname failed") );
return _T("");
}
#endif // !__WXMAC__