CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IOVInfo.cc
Go to the documentation of this file.
2 
3 #include <unistd.h>
4 #include <cstdlib>
5 #include <sstream>
6 #include <vector>
7 namespace cond {
8 
9  std::string userInfo() {
10  // this are really static stuff
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();
22  }
23 
24 }
std::string userInfo()
Definition: IOVInfo.cc:9