Fix unix compilation
This commit is contained in:
parent
17bf8907a9
commit
fa670dfe15
1 changed files with 2 additions and 2 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
#include <unistd.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
@ -254,7 +255,6 @@ static std::string & replace(std::string & str, const std::string & what, const
|
||||||
|
|
||||||
static std::string replaceWithTokens(const std::string & value)
|
static std::string replaceWithTokens(const std::string & value)
|
||||||
{
|
{
|
||||||
char hosturl[1024] = {'\0'};
|
|
||||||
char hostname[1024] = {'\0'};
|
char hostname[1024] = {'\0'};
|
||||||
gethostname(hostname, sizeof(hostname));
|
gethostname(hostname, sizeof(hostname));
|
||||||
struct hostent* hostentry = gethostbyname(hostname);
|
struct hostent* hostentry = gethostbyname(hostname);
|
||||||
|
@ -285,7 +285,7 @@ static std::string replaceWithTokens(const std::string & value)
|
||||||
// set user replacing tokens
|
// set user replacing tokens
|
||||||
std::string ret = value;
|
std::string ret = value;
|
||||||
ret = replace(ret, "%HOST_NAME%", hostname);
|
ret = replace(ret, "%HOST_NAME%", hostname);
|
||||||
ret = replace(ret, "%IP_ADD%", ipbuf);
|
ret = replace(ret, "%IP_ADD%", ipbuf == NULL ? "" : ipbuf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue