#include "apps.h" #include namespace trygvis { namespace apps { using namespace log4cplus; using namespace std; namespace po = boost::program_options; std::string get_hostname() { struct addrinfo hints, *info, *p; // int gai_result; char hostname[1024]; hostname[1023] = '\0'; gethostname(hostname, 1023); memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_CANONNAME; if (getaddrinfo(hostname, "http", &hints, &info)) { return "uknown"; } string s = "unknown"; if (info) { s = string(info->ai_canonname); } freeaddrinfo(info); return s; } void app_execution::usage() { cerr << desc << endl; } } }