Mercurial > pkg
diff src/hg-wrapper.cpp @ 16:cd47c42f1d0a
reorganizing.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 09 Jan 2013 11:38:31 +0000 |
parents | defaults/hg-wrapper.cpp@e056798af879 |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/hg-wrapper.cpp Wed Jan 09 11:38:31 2013 +0000 1.3 @@ -0,0 +1,17 @@ 1.4 +#include <cstdlib> 1.5 +#include <vector> 1.6 +#include <string> 1.7 +#include <unistd.h> 1.8 +#include <boost/algorithm/string/join.hpp> 1.9 + 1.10 +/** This a simple wrapper script to call 1.11 + mercurial as a semi-privleged user. */ 1.12 + 1.13 +main( int argc, char ** argv){ 1.14 + std::vector<std::string> input(argv, argv+argc); 1.15 + input[0] = std::string("hg"); 1.16 + std::string command = boost::algorithm::join(input, " "); 1.17 + setreuid(geteuid(), geteuid()); 1.18 + setregid(getegid(), getegid()); 1.19 + return system(command.c_str()); 1.20 +}