Mercurial > pkg
comparison defaults/hg-wrapper.cpp @ 10:bd465da5cd0f
remove USELESS code.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 09 Jan 2013 04:58:05 +0000 |
parents | a0c0ccd22ca5 |
children | 389f8678f1d8 |
comparison
equal
deleted
inserted
replaced
9:a0c0ccd22ca5 | 10:bd465da5cd0f |
---|---|
1 #include <stdio.h> | |
2 //#include <stdlib.h> | |
3 #include <cstdlib> | 1 #include <cstdlib> |
4 #include <iostream> | |
5 #include <vector> | 2 #include <vector> |
6 #include <string> | 3 #include <string> |
7 | |
8 #include <algorithm> | |
9 | |
10 #include <unistd.h> | 4 #include <unistd.h> |
11 //#include <numeric> | |
12 | |
13 | |
14 #include <boost/algorithm/string/join.hpp> | 5 #include <boost/algorithm/string/join.hpp> |
15 | 6 |
16 // void print_element(std::string x){ | |
17 // std::cout << x << std::endl; | |
18 // } | |
19 | |
20 | |
21 main( int argc, char ** argv){ | 7 main( int argc, char ** argv){ |
22 | |
23 // remove first element of argv, the program's name | |
24 std::vector<std::string> input(argv, argv+argc); | 8 std::vector<std::string> input(argv, argv+argc); |
25 | |
26 | |
27 //std::cout << input.size() << std::endl; | |
28 | |
29 input[0] = std::string("hg"); | 9 input[0] = std::string("hg"); |
30 | |
31 //input.insert(input.begin(),std::string("hg")); | |
32 | |
33 //std::cout << input.size() << std::endl; | |
34 | |
35 // for(unsigned i = 0; i < input.size(); i++){ | |
36 // std::cout << input[i] << std::endl; | |
37 | |
38 // } | |
39 | |
40 //for_each(input.begin(),input.end(), print_element); | |
41 | |
42 | |
43 // std::string command = | |
44 // accumulate(input.begin(), input.end(), std::string(" ")); | |
45 | |
46 std::string command = boost::algorithm::join(input, " "); | 10 std::string command = boost::algorithm::join(input, " "); |
47 | |
48 | |
49 //.c_str(); | |
50 | |
51 //std::cout << command << std::endl; | |
52 | |
53 setreuid( geteuid(), geteuid() ); | 11 setreuid( geteuid(), geteuid() ); |
54 //envp = 0; /* blocks IFS attack on non-bash shells */ | |
55 //system( "/usr/bin/hg", argv, envp ); | |
56 return system(command.c_str()); | 12 return system(command.c_str()); |
57 //perror( argv[0] ); | |
58 //return errno; | |
59 } | 13 } |