aboutsummaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authormathias <mathias>2006-10-27 06:57:43 (GMT)
committermathias <mathias>2006-10-27 06:57:43 (GMT)
commit10082d821d6691f42a8d8ad6fa2e42e5b3f44edd (patch)
tree99c94a6105cf35612307e307be343eda2aea8baf /src/main.cc
parent34b7f7ddfc3e914238fd0d30ff50c4f37c2a6dd8 (diff)
downloadfluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.zip
fluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.tar.bz2
cosmetic patch from slava semushin, removes whitespaces and
uses only those things from "namespace std" what we really need.
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc51
1 files changed, 32 insertions, 19 deletions
diff --git a/src/main.cc b/src/main.cc
index 22862fa..1c62744 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -59,8 +59,21 @@
59#include <stdexcept> 59#include <stdexcept>
60#include <typeinfo> 60#include <typeinfo>
61 61
62using namespace std; 62using std::cout;
63void showInfo(ostream &ostr) { 63using std::cerr;
64using std::endl;
65using std::string;
66using std::ostream;
67using std::ofstream;
68using std::streambuf;
69using std::auto_ptr;
70using std::out_of_range;
71using std::runtime_error;
72using std::bad_cast;
73using std::bad_alloc;
74using std::exception;
75
76static void showInfo(ostream &ostr) {
64 _FB_USES_NLS; 77 _FB_USES_NLS;
65 ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl; 78 ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl;
66 79
@@ -73,7 +86,7 @@ void showInfo(ostream &ostr) {
73 ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl; 86 ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl;
74#endif // __fluxbox_compiler 87#endif // __fluxbox_compiler
75#ifdef __fluxbox_compiler_version 88#ifdef __fluxbox_compiler_version
76 ostr<<_FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl; 89 ostr<<_FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl;
77#endif // __fluxbox_compiler_version 90#endif // __fluxbox_compiler_version
78 91
79 ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl; 92 ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl;
@@ -177,9 +190,9 @@ void showInfo(ostream &ostr) {
177 190
178int main(int argc, char **argv) { 191int main(int argc, char **argv) {
179 192
180 std::string session_display = ""; 193 string session_display = "";
181 std::string rc_file; 194 string rc_file;
182 std::string log_filename; 195 string log_filename;
183 196
184 FbTk::NLSInit("fluxbox.cat"); 197 FbTk::NLSInit("fluxbox.cat");
185 _FB_USES_NLS; 198 _FB_USES_NLS;
@@ -191,7 +204,7 @@ int main(int argc, char **argv) {
191 204
192 if ((++i) >= argc) { 205 if ((++i) >= argc) {
193 cerr<<_FB_CONSOLETEXT(main, RCRequiresArg, 206 cerr<<_FB_CONSOLETEXT(main, RCRequiresArg,
194 "error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl;; 207 "error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl;
195 exit(1); 208 exit(1);
196 } 209 }
197 210
@@ -208,7 +221,7 @@ int main(int argc, char **argv) {
208 } 221 }
209 222
210 session_display = argv[i]; 223 session_display = argv[i];
211 std::string display_env = "DISPLAY=" + session_display; 224 string display_env = "DISPLAY=" + session_display;
212 if (putenv(const_cast<char *>(display_env.c_str()))) { 225 if (putenv(const_cast<char *>(display_env.c_str()))) {
213 cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv, 226 cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv,
214 "warning: couldn't set environment variable 'DISPLAY'", 227 "warning: couldn't set environment variable 'DISPLAY'",
@@ -252,7 +265,7 @@ int main(int argc, char **argv) {
252#ifdef __EMX__ 265#ifdef __EMX__
253 _chdir2(getenv("X11ROOT")); 266 _chdir2(getenv("X11ROOT"));
254#endif // __EMX__ 267#endif // __EMX__
255 std::auto_ptr<Fluxbox> fluxbox; 268 auto_ptr<Fluxbox> fluxbox;
256 int exitcode=EXIT_FAILURE; 269 int exitcode=EXIT_FAILURE;
257 270
258 streambuf *outbuf = 0; 271 streambuf *outbuf = 0;
@@ -279,17 +292,17 @@ int main(int argc, char **argv) {
279 292
280 exitcode = EXIT_SUCCESS; 293 exitcode = EXIT_SUCCESS;
281 294
282 } catch (std::out_of_range &oor) { 295 } catch (out_of_range &oor) {
283 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl; 296 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl;
284 } catch (std::runtime_error &re) { 297 } catch (runtime_error &re) {
285 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl; 298 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl;
286 } catch (std::bad_cast &bc) { 299 } catch (bad_cast &bc) {
287 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl; 300 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl;
288 } catch (std::bad_alloc &ba) { 301 } catch (bad_alloc &ba) {
289 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl; 302 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl;
290 } catch (std::exception &e) { 303 } catch (exception &e) {
291 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl; 304 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl;
292 } catch (std::string error_str) { 305 } catch (string error_str) {
293 cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl; 306 cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl;
294 } catch (...) { 307 } catch (...) {
295 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl; 308 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl;
@@ -297,11 +310,11 @@ int main(int argc, char **argv) {
297 } 310 }
298 311
299 bool restarting = false; 312 bool restarting = false;
300 std::string restart_argument; 313 string restart_argument;
301 314
302 if (fluxbox.get()) { 315 if (fluxbox.get()) {
303 restarting = fluxbox->isRestarting(); 316 restarting = fluxbox->isRestarting();
304 restart_argument = fluxbox->getRestartArgument(); 317 restart_argument = fluxbox->getRestartArgument();
305 } 318 }
306 319
307 // destroy fluxbox 320 // destroy fluxbox