Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
main.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-Today Guy Deleeuw
3  *
4  * See the LICENSE file for terms of use.
5  */
6 #define BOOST_FILESYSTEM_NO_DEPRECATED
7 #include <boost/filesystem/operations.hpp>
8 #include <boost/filesystem/exception.hpp>
9 #include "boost/date_time/gregorian/gregorian.hpp"
10 #include "boost/date_time/posix_time/posix_time.hpp"
11 
12 #include <User/WsUser.h>
13 #include <Logger/WsCrashLogger.h>
14 
15 #include "WsApplication.h"
16 
17 #include <signal.h>
18 
19 
20 
21 using namespace Wt;
22 
23 WApplication* createApplication(void* pTree, const WEnvironment& env)
24 {
25  return new WsApplication(env);
26 }
27 
28 
29 int main(int argc, char** argv)
30 {
31  signal(SIGSEGV, &WsCrashLogger::handleSignal);
32  signal( SIGABRT, &WsCrashLogger::handleSignal);
33  signal( SIGILL, &WsCrashLogger::handleSignal);
34  signal( SIGFPE, &WsCrashLogger::handleSignal);
35  boost::posix_time::ptime now;
36  std::string d2out;
37  now = boost::posix_time::microsec_clock::local_time(); // current *LOCAL TIMEZONE* time/date
38  d2out = boost::posix_time::to_iso_extended_string(now);
39  d2out[d2out.find('T')] = ' ';
40  bool isServer = argc < 2 || strcmp(argv[1], "client") != 0;
41  if ( isServer ) {
42  std::cerr << "[" << d2out << "] [notice]" << " main - in server." << std::endl;
43  } else {
44  std::cerr << "[" << d2out << "] [notice]" << " main - in client." << std::endl;
45  }
46  int ret = WRun(argc, argv, boost::bind(createApplication, (void*) 0, _1));
47  return ret;
48 }
49 
static void handleSignal(int signum)
int main(int argc, char **argv)
Definition: main.cpp:35
WApplication * createApplication(const WEnvironment &env)
Definition: main.cpp:17
User class.