CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/CondCore/DBCommon/src/IOVInfo.cc

Go to the documentation of this file.
00001 #include "CondCore/DBCommon/interface/IOVInfo.h"
00002 
00003 #include <unistd.h>
00004 #include <cstdlib>
00005 #include <sstream>
00006 #include <vector>
00007 namespace cond {
00008 
00009   std::string userInfo() {
00010     // this are really static stuff
00011     std::ostringstream user_info;
00012     char * user= ::getenv("USER");
00013     std::vector<char> hname(1024,'\0');
00014     char * hostname = &hname.front();
00015     ::gethostname(hostname, 1024);
00016     char * pwd = ::getenv("PWD");
00017     if (user) { user_info<< "USER=" << user <<";" ;} else { user_info<< "USER="<< "??;";}
00018     if (hostname[0] != '\0') {user_info<< "HOSTNAME=" << hostname <<";";} 
00019     else { user_info<< "HOSTNAME="<< "??;";}
00020     if (pwd) {user_info<< "PWD=" << pwd <<";";} else  {user_info<< "PWD="<< "??;";}
00021     return user_info.str();
00022   }
00023   
00024 }