summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-12-02 22:02:35 (GMT)
committerfluxgen <fluxgen>2002-12-02 22:02:35 (GMT)
commitb20972bbe4700b14dcfdbe92d686ac06b9c93da1 (patch)
treeb08b191b2cacbff9198b1b4eede3b51bf90d010a
parentaf7c6a7c6b637edc2649d8f2d565b53c5f4c84fa (diff)
downloadfluxbox_lack-b20972bbe4700b14dcfdbe92d686ac06b9c93da1.zip
fluxbox_lack-b20972bbe4700b14dcfdbe92d686ac06b9c93da1.tar.bz2
catch more exceptions
-rw-r--r--src/main.cc64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/main.cc b/src/main.cc
index dc81685..d7b5464 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -1,4 +1,4 @@
1// main.cc for Fluxbox Window manager 1// Main.cc for Fluxbox Window manager
2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) 2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org)
3// 3//
4// main.cc for Blackbox - an X11 Window manager 4// main.cc for Blackbox - an X11 Window manager
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: main.cc,v 1.9 2002/12/01 13:42:07 rathnor Exp $ 25// $Id: main.cc,v 1.10 2002/12/02 22:02:35 fluxgen Exp $
26 26
27 27
28 28
@@ -63,7 +63,7 @@ using namespace std;
63#include <uds/uds.hh> 63#include <uds/uds.hh>
64 64
65// configure UDS 65// configure UDS
66uds::uds_flags_t uds::flags = uds::leak_check; 66uds::uds_flags_t uds::flags = uds::leak_check | uds::std_backtraces | uds::log_allocs | uds::leak_check;
67 67
68#endif //!DEBUG_UDS 68#endif //!DEBUG_UDS
69 69
@@ -98,8 +98,8 @@ int main(int argc, char **argv) {
98 if ((++i) >= argc) { 98 if ((++i) >= argc) {
99 fprintf(stderr, 99 fprintf(stderr,
100 i18n->getMessage( 100 i18n->getMessage(
101 FBNLS::mainSet, FBNLS::mainRCRequiresArg, 101 FBNLS::mainSet, FBNLS::mainRCRequiresArg,
102 "error: '-rc' requires and argument\n")); 102 "error: '-rc' requires and argument\n"));
103 exit(1); 103 exit(1);
104 } 104 }
105 105
@@ -111,8 +111,8 @@ int main(int argc, char **argv) {
111 if ((++i) >= argc) { 111 if ((++i) >= argc) {
112 fprintf(stderr, 112 fprintf(stderr,
113 i18n->getMessage( 113 i18n->getMessage(
114 FBNLS::mainSet, FBNLS::mainDISPLAYRequiresArg, 114 FBNLS::mainSet, FBNLS::mainDISPLAYRequiresArg,
115 "error: '-display' requires an argument\n")); 115 "error: '-display' requires an argument\n"));
116 exit(1); 116 exit(1);
117 } 117 }
118 118
@@ -124,8 +124,8 @@ int main(int argc, char **argv) {
124 fprintf(stderr, 124 fprintf(stderr,
125 i18n-> 125 i18n->
126 getMessage( 126 getMessage(
127 FBNLS::mainSet, FBNLS::mainWarnDisplaySet, 127 FBNLS::mainSet, FBNLS::mainWarnDisplaySet,
128 "warning: couldn't set environment variable 'DISPLAY'\n")); 128 "warning: couldn't set environment variable 'DISPLAY'\n"));
129 perror("putenv()"); 129 perror("putenv()");
130 } 130 }
131 } else if (strcmp(argv[i], "-version") == 0) { 131 } else if (strcmp(argv[i], "-version") == 0) {
@@ -137,25 +137,24 @@ int main(int argc, char **argv) {
137 // print program usage and command line options 137 // print program usage and command line options
138 printf(i18n-> 138 printf(i18n->
139 getMessage( 139 getMessage(
140 FBNLS::mainSet, FBNLS::mainUsage, 140 FBNLS::mainSet, FBNLS::mainUsage,
141 "Fluxbox %s : (c) 2001-2002 Henrik Kinnunen\n\n" 141 "Fluxbox %s : (c) 2001-2002 Henrik Kinnunen\n\n"
142 " -display <string>\t\tuse display connection.\n" 142 " -display <string>\t\tuse display connection.\n"
143 " -rc <string>\t\t\tuse alternate resource file.\n" 143 " -rc <string>\t\t\tuse alternate resource file.\n"
144 " -version\t\t\tdisplay version and exit.\n" 144 " -version\t\t\tdisplay version and exit.\n"
145 " -help\t\t\t\tdisplay this help text and exit.\n\n"), 145 " -help\t\t\t\tdisplay this help text and exit.\n\n"),
146 __fluxbox_version); 146 __fluxbox_version);
147 147
148 // some people have requested that we print out command line options 148
149 // as well
150 printf(i18n-> 149 printf(i18n->
151 getMessage( 150 getMessage(
152 FBNLS::mainSet, FBNLS::mainCompileOptions, 151 FBNLS::mainSet, FBNLS::mainCompileOptions,
153 "Compile time options:\n" 152 "Compile time options:\n"
154 " Debugging:\t\t\t%s\n" 153 " Debugging:\t\t\t%s\n"
155 " Interlacing:\t\t\t%s\n" 154 " Interlacing:\t\t\t%s\n"
156 " Shape:\t\t\t%s\n" 155 " Shape:\t\t\t%s\n"
157 " Slit:\t\t\t\t%s\n" 156 " Slit:\t\t\t\t%s\n"
158 " 8bpp Ordered Dithering:\t%s\n\n"), 157 " 8bpp Ordered Dithering:\t%s\n\n"),
159#ifdef DEBUG 158#ifdef DEBUG
160 getNLSYesNoMsg(true), 159 getNLSYesNoMsg(true),
161#else // !DEBUG 160#else // !DEBUG
@@ -186,7 +185,7 @@ int main(int argc, char **argv) {
186 getNLSYesNoMsg(false) 185 getNLSYesNoMsg(false)
187#endif // ORDEREDPSEUDO 186#endif // ORDEREDPSEUDO
188 187
189 ); 188 );
190 189
191 ::exit(0); 190 ::exit(0);
192 } 191 }
@@ -202,14 +201,23 @@ int main(int argc, char **argv) {
202 fluxbox = new Fluxbox(argc, argv, session_display, rc_file); 201 fluxbox = new Fluxbox(argc, argv, session_display, rc_file);
203 fluxbox->eventLoop(); 202 fluxbox->eventLoop();
204 203
205 } catch (std::out_of_range oor) { 204 } catch (std::out_of_range &oor) {
206 cerr<<"Fluxbox: Out of range: "<<oor.what()<<endl; 205 cerr<<"Fluxbox: Out of range: "<<oor.what()<<endl;
207 } catch (std::logic_error le) { 206 } catch (std::logic_error &le) {
208 cerr<<"Fluxbox: Logic error: "<<le.what()<<endl; 207 cerr<<"Fluxbox: Logic error: "<<le.what()<<endl;
209 } catch (std::runtime_error re) { 208 } catch (std::runtime_error &re) {
210 cerr<<"Fluxbox: Runtime error: "<<re.what()<<endl; 209 cerr<<"Fluxbox: Runtime error: "<<re.what()<<endl;
210 } catch (std::bad_cast &bc) {
211 cerr<<"Fluxbox: Bad cast: "<<bc.what()<<endl;
212 } catch (std::bad_alloc &ba) {
213 cerr<<"Fluxbox: Bad Alloc: "<<ba.what()<<endl;
214 } catch (std::exception &e) {
215 cerr<<"Fluxbox: Standard exception: "<<e.what()<<endl;
216 } catch (std::string error_str) {
217 cerr<<"Error: "<<error_str<<endl;
211 } catch (...) { 218 } catch (...) {
212 cerr<<"Fluxbox: Unknown error."<<endl; 219 cerr<<"Fluxbox: Unknown error."<<endl;
220 abort();
213 } 221 }
214 222
215 if (fluxbox) 223 if (fluxbox)