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
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 }