1 #include <boost/filesystem.hpp> 13 static T shell(conf.
GetName().c_str(), conf.
Get<
int>(
"console")!=1);
20 win <<
kRed <<
"ERROR - Couldn't open log-file " << conf.
Get<
string>(
"log") <<
": " << strerror(errno) << endl;
29 const string n = conf.
GetName()+
".log";
31 po::options_description config(
"Program options");
33 (
"dns", var<string>(
"localhost"),
"Dim nameserver (overwites DIM_DNS_NODE environment variable)")
34 (
"host", var<string>(
""),
"Address with which the Dim nameserver can connect to this host (overwites DIM_HOST_NODE environment variable)")
35 (
"log,l", var<string>(n),
"Write log-file")
36 (
"console,c", var<int>(0),
"Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
39 conf.
AddEnv(
"dns",
"DIM_DNS_NODE");
40 conf.
AddEnv(
"host",
"DIM_HOST_NODE");
57 "The chatclient is a simple Dim based chatclient.\n" 59 "The chatclient is always started with user intercation. " 60 "Just enter a message. It will be broadcasted through the chatserv, " 61 "which need to be running." 63 "Usage: chatclient [-c type] [OPTIONS]\n" 64 " or: chatclient [OPTIONS]\n";
75 int main(
int argc,
const char *argv[])
86 if (conf.
Get<
int>(
"console")==0)
87 RunShell<ChatShell>(conf);
89 RunShell<ChatConsole>(conf);
A C++ ostream to an ncurses window supporting attributes and colors.
void SetPrintUsage(const std::function< void(void)> &func)
T Get(const std::string &var)
void AddEnv(const std::string &conf, const std::string &env)
void Setup(const std::string &dns="", const std::string &host="")
int main(int argc, const char *argv[])
bool Has(const std::string &var)
void AddOptions(const po::options_description &opt, bool visible=true)
Commandline parsing, resource file parsing and database access.
void RunShell(Configuration &conf)
bool OpenLogFile(const std::string &filename, bool append=false)
Open a log-file.
bool DoParse(int argc, const char **argv, const std::function< void()> &func=std::function< void()>())
const std::string & GetName() const
void SetupConfiguration(Configuration &conf)