Merge branch 'special-tokens'
This commit is contained in:
commit
a7337c12cd
3 changed files with 6 additions and 5 deletions
|
@ -24,6 +24,7 @@
|
|||
#ifndef __ICONSOLELISTENER_H__
|
||||
#define __ICONSOLELISTENER_H__
|
||||
|
||||
#include "interfaces/interface.h"
|
||||
|
||||
class IConsoleListener
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ void SysLog::text(const std::string & txt)
|
|||
|
||||
void SysLog::message(Level level, const std::string & txt)
|
||||
{
|
||||
syslog(level == INFO ? LOG_INFO : LOG_NOTICE, "%s", txt);
|
||||
syslog(level == INFO ? LOG_INFO : LOG_NOTICE, "%s", txt.c_str());
|
||||
}
|
||||
|
||||
#endif
|
|
@ -236,7 +236,7 @@ void Url::applyExceptions()
|
|||
}
|
||||
|
||||
|
||||
static std::string & replace(std::string & str, const std::string & what, const std::string & other)
|
||||
static std::string & Replace(std::string & str, const std::string & what, const std::string & other)
|
||||
{
|
||||
if(str.empty() || what.empty() || what == other)
|
||||
{
|
||||
|
@ -256,7 +256,7 @@ static std::string & replace(std::string & str, const std::string & what, const
|
|||
static std::string replaceWithTokens(const std::string & value)
|
||||
{
|
||||
char hostname[1024] = {'\0'};
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
gethostname(hostname, sizeof(hostname) - 1);
|
||||
struct hostent* hostentry = gethostbyname(hostname);
|
||||
|
||||
// get ip
|
||||
|
@ -284,8 +284,8 @@ static std::string replaceWithTokens(const std::string & value)
|
|||
|
||||
// set user replacing tokens
|
||||
std::string ret = value;
|
||||
ret = replace(ret, "%HOST_NAME%", hostname);
|
||||
ret = replace(ret, "%IP_ADD%", ipbuf == NULL ? "" : ipbuf);
|
||||
ret = Replace(ret, "%HOST_NAME%", hostname);
|
||||
ret = Replace(ret, "%IP_ADD%", ipbuf == NULL ? "" : ipbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue