/[projects]/smsdaemon/Common.cpp
ViewVC logotype

Diff of /smsdaemon/Common.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 158 by torben, Mon Dec 8 21:49:49 2008 UTC revision 217 by torben, Tue Dec 23 14:20:43 2008 UTC
# Line 13  Line 13 
13  #include "TaskManager.h"  #include "TaskManager.h"
14  #include "PluginManager.h"  #include "PluginManager.h"
15  #include "ConfigFile.h"  #include "ConfigFile.h"
16    #include "Util.h"
17    #include "Logger.h"
18    
19  using namespace std;  using namespace std;
20    
# Line 24  Common* Common::instance() Line 26  Common* Common::instance()
26    
27    
28  Common::Common()  Common::Common()
29          : _pluginManager(0), _taskManager(0)                  : _pluginManager(0), _taskManager(0)
30  {  {
31          _pluginManager = new PluginManager();          _pluginManager = new PluginManager();
32          _taskManager = new TaskManager();          _taskManager = new TaskManager();
# Line 32  Common::Common() Line 34  Common::Common()
34          _configFile = new ConfigFile();          _configFile = new ConfigFile();
35    
36          daemonized = false;          daemonized = false;
37            reloadConfig = false;
38  }  }
39    
40    
# Line 70  void Common::printUsage() Line 73  void Common::printUsage()
73          cout << "  --debug :        Run as normal (frontground) process," << endl;          cout << "  --debug :        Run as normal (frontground) process," << endl;
74          cout << "                   with all messages written to std out" << endl;          cout << "                   with all messages written to std out" << endl;
75          cout << "  --config <file>: Specify which config file to use " << endl;          cout << "  --config <file>: Specify which config file to use " << endl;
76          cout << "                   default" << configFilePath << endl;          cout << "                   default" << configFilePath << endl;
77          cout << "  --help :         Show this help screen" << endl;          cout << "  --help :         Show this help screen" << endl;
78    
79          exit(0);          exit(0);
# Line 84  void Common::loadConfig(int argc, char* Line 87  void Common::loadConfig(int argc, char*
87          for (int i = 1; i< argc; i++)          for (int i = 1; i< argc; i++)
88          {          {
89                  string current(argv[i]);                  string current(argv[i]);
90          if (current == "--daemon")                  if (current == "--daemon")
91                  {                  {
92                  isDaemon = true;                          isDaemon = true;
93                          isDebug = false;                          isDebug = false;
94                            
95                  }                  }
96                  else if (current == "--debug")                  else if (current == "--debug")
97                  {                  {
# Line 97  void Common::loadConfig(int argc, char* Line 100  void Common::loadConfig(int argc, char*
100                  }                  }
101                  else if (current == "--config")                  else if (current == "--config")
102                  {                  {
103                            i++;
104                            if ( i<argc)
105                            {
106                                    configFilePath = argv[i];
107                            }
108                            else
109                            {
110                                    printUsage();
111                                    exit(1);
112                            }
113    
114                  }                  }
115                  else if (current == "-h" || current == "--help")                  else if (current == "-h" || current == "--help")
116                  {                  {
# Line 124  std::string Common::getStatusMessage() Line 138  std::string Common::getStatusMessage()
138          out << "Uptime " << diff << " seconds. ";          out << "Uptime " << diff << " seconds. ";
139          out << "Messages received:" << this->smsCounter.incomming << ". ";          out << "Messages received:" << this->smsCounter.incomming << ". ";
140          out << "Messages sent:" << this->smsCounter.outgoing << ".";          out << "Messages sent:" << this->smsCounter.outgoing << ".";
141            
142          return out.str();          return out.str();
143  }  }
144    

Legend:
Removed from v.158  
changed lines
  Added in v.217

  ViewVC Help
Powered by ViewVC 1.1.20