diff options
author | Pixel <Pixel> | 2002-09-27 20:36:49 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-09-27 20:36:49 +0000 |
commit | 75d6916ec69878af6649dd41ccdc41b5df807230 (patch) | |
tree | dcad3360e3b190f129bc13e6af6e0f9fe8569755 /generic | |
parent | 28806bc90b9555e78944e80e78e90debfa632b4b (diff) |
Adding missing files
Diffstat (limited to 'generic')
-rw-r--r-- | generic/Main.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/generic/Main.cpp b/generic/Main.cpp new file mode 100644 index 0000000..774cf08 --- /dev/null +++ b/generic/Main.cpp @@ -0,0 +1,45 @@ +#include "Main.h" +#include "generic.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +Main::Main() : setted(false) {} + +Main::~Main() {} + +extern Main * Application; + +void Main::set_args(int a_argc, char ** a_argv, char ** a_enve) { + if (setted) { + return; + } + argc = a_argc; + argv = a_argv; + enve = a_enve; + setted = true; +} + +int main(int argc, char ** argv, char ** enve) { + int r; + + try { + Application->set_args(argc, argv, enve); + r = Application->startup(); + } + catch (Exit e) { + r = e.GetCode(); + } + catch (GeneralException e) { + printm(M_ERROR, "The application caused an exception: %s\n", e.GetMsg()); + delete Application; + exit(-1); + } + catch (...) { + printm(M_ERROR, "The application caused an unknow exception\n"); + delete Application; + exit(-1); + } + delete Application; + exit(r); +} |