11 std::ostringstream user_info;
12 char *
user= ::getenv(
"USER");
13 std::vector<char> hname(1024,
'\0');
14 char * hostname = &hname.front();
15 ::gethostname(hostname, 1024);
16 char *
pwd = ::getenv(
"PWD");
17 if (user) { user_info<<
"USER=" << user <<
";" ;}
else { user_info<<
"USER="<<
"??;";}
18 if (hostname[0] !=
'\0') {user_info<<
"HOSTNAME=" << hostname <<
";";}
19 else { user_info<<
"HOSTNAME="<<
"??;";}
20 if (pwd) {user_info<<
"PWD=" << pwd <<
";";}
else {user_info<<
"PWD="<<
"??;";}
21 return user_info.str();