00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SCHROOT_BASE_RUN_H
00021 #define SCHROOT_BASE_RUN_H
00022
00023 #include <schroot-base/schroot-base-options.h>
00024
00025 #include <sbuild/sbuild-config.h>
00026
00027 #include <cstdlib>
00028 #include <iostream>
00029 #include <string>
00030
00031 namespace schroot_base
00032 {
00033
00043 template<class O, class M>
00044 static int
00045 run (int argc,
00046 char *argv[])
00047 {
00048 typedef O options_type;
00049 typedef M main_type;
00050
00051 try
00052 {
00053
00054 std::locale::global(std::locale(""));
00055 std::cout.imbue(std::locale());
00056 std::cerr.imbue(std::locale());
00057
00058 bindtextdomain (SBUILD_MESSAGE_CATALOGUE, LOCALEDIR);
00059 textdomain (SBUILD_MESSAGE_CATALOGUE);
00060
00061 typename options_type::ptr opts(new options_type);
00062 main_type kit(opts);
00063 exit (kit.run(argc, argv));
00064 }
00065 catch (std::exception const& e)
00066 {
00067 sbuild::log_exception_error(e);
00068 exit(EXIT_FAILURE);
00069 }
00070 catch (...)
00071 {
00072 sbuild::log_unknown_exception_error();
00073 exit(EXIT_FAILURE);
00074 }
00075 }
00076
00077 }
00078
00079 #endif
00080
00081
00082
00083
00084
00085