--- smsdaemon/util.cpp 2008/06/11 06:46:14 43 +++ smsdaemon/util.cpp 2008/06/11 19:42:24 59 @@ -7,7 +7,7 @@ #include #include #include - +#include #include #include "util.h" @@ -121,6 +121,14 @@ } + string str_formatint(int i) + { + std::ostringstream os; + os << i; + return os.str(); + } + + string str_characters(string str) { string rep; @@ -177,8 +185,10 @@ string document; ostringstream command; - command << "wget -O " << tempfile << " -o /dev/null \"" << url << "\""; - system( command.str().c_str() ); + command << "wget -O " << tempfile << " --tries=1 --timeout=15 -o /dev/null \"" << url << "\""; + int res = system( command.str().c_str() ); + if (res) + throw std::runtime_error("Command time out"); ifstream in( tempfile.c_str() );