From 11ff84f495c5e4cca545f4768829f764f668c804 Mon Sep 17 00:00:00 2001 From: jkaeber <jkaeber@wiback.org> Date: Thu, 3 Apr 2008 09:30:14 +0000 Subject: [PATCH] Modified argv() to return the original "char **" instead of "char const **". According to C99, section 5.1.2.2.1 (Program startup): "The parameters argc and argv and the strings pointed to by the argv array shall be modifiable by the program, and retain their last-stored values between program startup and program termination." And it makes using boost::program_options much easier :) --- Utils/Daemon/Daemon.cc | 4 ++-- Utils/Daemon/Daemon.hh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Utils/Daemon/Daemon.cc b/Utils/Daemon/Daemon.cc index f1ac715cd..1a684a525 100644 --- a/Utils/Daemon/Daemon.cc +++ b/Utils/Daemon/Daemon.cc @@ -82,7 +82,7 @@ prefix_ int senf::Daemon::argc() return argc_; } -prefix_ char const ** senf::Daemon::argv() +prefix_ char ** senf::Daemon::argv() { return argv_; } @@ -184,7 +184,7 @@ prefix_ void senf::Daemon::exit(unsigned code) throw DaemonExitException(code); } -prefix_ int senf::Daemon::start(int argc, char const ** argv) +prefix_ int senf::Daemon::start(int argc, char ** argv) { argc_ = argc; argv_ = argv; diff --git a/Utils/Daemon/Daemon.hh b/Utils/Daemon/Daemon.hh index 2a0ee697b..25b8e603f 100644 --- a/Utils/Daemon/Daemon.hh +++ b/Utils/Daemon/Daemon.hh @@ -154,13 +154,13 @@ namespace senf { successful startup. */ int argc(); ///< Access command line parameter count - char const ** argv(); ///< Access command line parameters + char ** argv(); ///< Access command line parameters static void exit(unsigned code=0); ///< Terminate daemon with failure ///\} - int start(int argc, char const ** argv); ///< Called from main() to launch daemon. + int start(int argc, char ** argv); ///< Called from main() to launch daemon. /**< Normally not called directly but from the \ref SENF_DAEMON_MAIN macro. */ @@ -201,7 +201,7 @@ namespace senf { bool pidfileCreate(); int argc_; - char const ** argv_; + char ** argv_; bool daemonize_; std::string stdoutLog_; @@ -222,7 +222,7 @@ namespace senf { \ingroup process */ # define SENF_DAEMON_MAIN(klass) \ - int main(int argc, char const ** argv) \ + int main(int argc, char ** argv) \ { \ klass instance; \ return instance.start(argc, argv); \ -- GitLab