Utils: Rename Daemon::fail() to Daemon::exit()
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@535
270642c3-0616-0410-b53a-bc976706d245
}
}
catch (senf::SystemException const & ex) {
- errno_ = ex.code();
+ errno_ = ex.errorNumber();
done();
return;
}
}
}
catch (senf::SystemException const & ex) {
- errno_ = ex.code();
+ errno_ = ex.errorNumber();
done();
return;
}
namespace {
/* Purposely *not* derived from std::exception */
- struct DaemonFailureException {
- DaemonFailureException(unsigned c) : code(c) {}
+ struct DaemonExitException {
+ DaemonExitException(unsigned c) : code(c) {}
unsigned code;
};
}
-prefix_ void senf::Daemon::fail(unsigned code)
+prefix_ void senf::Daemon::exit(unsigned code)
{
- throw DaemonFailureException(code);
+ throw DaemonExitException(code);
}
prefix_ int senf::Daemon::start(int argc, char const ** argv)
main();
}
- catch (DaemonFailureException & e) {
- return e.code > 0 ? e.code : 1;
+ catch (DaemonExitException & e) {
+ return e.code;
}
#ifdef NDEBUG
int argc(); ///< Access command line parameter count
char const ** argv(); ///< Access command line parameters
- void fail(unsigned code=1); ///< Terminate daemon with failure
+ void exit(unsigned code=0); ///< Terminate daemon with failure
///\}
return buffer_.c_str();
}
-prefix_ int senf::SystemException::code()
+prefix_ int senf::SystemException::errorNumber()
const
{
return code_;
public:
virtual char const * what() const throw(); ///< Return verbose error description
- int code() const; ///< Error code (\c errno number)
+ int errorNumber() const; ///< Error code (\c errno number)
char const * description() const; ///< Error description (strerror() value)
bool anyOf(int c0, int c1=0, int c2=0, int c3=0, int c4=0, int c5=0,
int c6=0, int c7=0, int c8=0, int c9=0);
- ///< \c true, if code() is one of \a c0 ... \a c9
+ ///< \c true, if errorNumber() is one of \a c0 ... \a c9
virtual ~SystemException() throw();
}
}
catch (senf::SystemException & e) {
- BOOST_CHECK_EQUAL( e.code(), ENOENT );
+ BOOST_CHECK_EQUAL( e.errorNumber(), ENOENT );
BOOST_CHECK_EQUAL( e.what(), "::open(): (2) No such file or directory: x=1, y=2" );
}
}