2 #include <boost/property_tree/ptree.hpp>
3 #include <boost/property_tree/ini_parser.hpp>
7 int main(int argc, const char **argv)
10 std::cerr << "Usage: " << argv[0] << " <configuration file>" << std::endl;
13 const char *filename = argv[1];
15 struct stat file_stat;
16 int ret = lstat(filename, &file_stat);
18 std::cerr << "Unable to stat " << filename << "." << std::endl;
21 /* Check if the file is suited */
22 if (!S_ISREG(file_stat.st_mode)) {
23 std::cerr << filename << " is not a file." << std::endl;
26 if (file_stat.st_uid != geteuid()) {
27 std::cerr << filename << " must be owned by user executing " << argv[0] << "." << std::endl;
30 if (file_stat.st_mode & (S_IWGRP | S_IWOTH)) { /* can be written by group/others */
31 std::cerr << filename << " must not be writeable by group or others." << std::endl;
35 std::cout << "Hi world!" << std::endl;