aboutsummaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-06-21 14:41:16 (GMT)
committersimonb <simonb>2006-06-21 14:41:16 (GMT)
commit3ada3b1f0d6d2debaaab48eecf828a406e964c8e (patch)
tree3c2f02462317408ee8604d0c7bb41092ecfd1c3a /src/main.cc
parent62a298b0b30aa5b4990f462aece224e09e4fafe6 (diff)
downloadfluxbox-3ada3b1f0d6d2debaaab48eecf828a406e964c8e.zip
fluxbox-3ada3b1f0d6d2debaaab48eecf828a406e964c8e.tar.bz2
fix nls... notably classify text on conversion whether its for X or
console, plus handle catalogs better.
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc116
1 files changed, 63 insertions, 53 deletions
diff --git a/src/main.cc b/src/main.cc
index a8b7699..22862fa 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -62,106 +62,116 @@
62using namespace std; 62using namespace std;
63void showInfo(ostream &ostr) { 63void showInfo(ostream &ostr) {
64 _FB_USES_NLS; 64 _FB_USES_NLS;
65 ostr<<_FBTEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl; 65 ostr<<_FB_CONSOLETEXT(Common, FluxboxVersion, "Fluxbox version", "Fluxbox version heading")<<": "<<__fluxbox_version<<endl;
66 66
67 if (strlen(svnversion()) > 0) 67 if (strlen(svnversion()) > 0)
68 ostr << _FBTEXT(Common, SvnRevision, "SVN Revision", "Revision number in SVN repositary") << ": " << svnversion() << endl; 68 ostr << _FB_CONSOLETEXT(Common, SvnRevision, "SVN Revision", "Revision number in SVN repositary") << ": " << svnversion() << endl;
69#if defined(__DATE__) && defined(__TIME__) 69#if defined(__DATE__) && defined(__TIME__)
70 ostr<<_FBTEXT(Common, Compiled, "Compiled", "Time fluxbox was compiled")<<": "<<__DATE__<<" "<<__TIME__<<endl; 70 ostr<<_FB_CONSOLETEXT(Common, Compiled, "Compiled", "Time fluxbox was compiled")<<": "<<__DATE__<<" "<<__TIME__<<endl;
71#endif 71#endif
72#ifdef __fluxbox_compiler 72#ifdef __fluxbox_compiler
73 ostr<<_FBTEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl; 73 ostr<<_FB_CONSOLETEXT(Common, Compiler, "Compiler", "Compiler used to build fluxbox")<<": "<<__fluxbox_compiler<<endl;
74#endif // __fluxbox_compiler 74#endif // __fluxbox_compiler
75#ifdef __fluxbox_compiler_version 75#ifdef __fluxbox_compiler_version
76 ostr<<_FBTEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl; 76 ostr<<_FB_CONSOLETEXT(Common, CompilerVersion, "Compiler version", "Compiler version used to build fluxbox")<<": "<<__fluxbox_compiler_version<<endl;
77#endif // __fluxbox_compiler_version 77#endif // __fluxbox_compiler_version
78 78
79 ostr<<endl<<_FBTEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl; 79 ostr<<endl<<_FB_CONSOLETEXT(Common, Defaults, "Defaults", "Default values compiled in")<<":"<<endl;
80 80
81 ostr<<_FBTEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTMENU<<endl; 81 ostr<<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTMENU<<endl;
82 ostr<<_FBTEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")<<": "<<DEFAULTSTYLE<<endl; 82 ostr<<_FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)")<<": "<<DEFAULTSTYLE<<endl;
83 83
84 ostr<<_FBTEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTKEYSFILE<<endl; 84 ostr<<_FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)")<<": "<<DEFAULTKEYSFILE<<endl;
85 ostr<<_FBTEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")<<": "<<DEFAULT_INITFILE<<endl; 85 ostr<<_FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)")<<": "<<DEFAULT_INITFILE<<endl;
86 86
87#ifdef NLS 87#ifdef NLS
88 ostr<<_FBTEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")<<": "<<LOCALEPATH<<endl; 88 ostr<<_FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)")<<": "<<LOCALEPATH<<endl;
89#endif 89#endif
90 90
91 const char NOT[] = "-"; 91 const char NOT[] = "-";
92 ostr<<endl<< 92 ostr<<endl<<
93 _FBTEXT(Common, CompiledOptions, "Compiled options", "Options used when compiled") 93 _FB_CONSOLETEXT(Common, CompiledOptions, "Compiled options", "Options used when compiled")
94 <<" ("<<NOT<<" => "<< 94 <<" ("<<NOT<<" => "<<
95 _FBTEXT(Common, Disabled, "disabled", "option is turned off")<<"): "<<endl<< 95 _FB_CONSOLETEXT(Common, Disabled, "disabled", "option is turned off")<<"): "<<endl<<
96
97/**** NOTE: This list is in alphabetical order! ****/
98
96#ifndef DEBUG 99#ifndef DEBUG
97 NOT<< 100 NOT<<
98#endif // DEBUG 101#endif // DEBUG
99 "DEBUG"<<endl<< 102 "DEBUG"<<endl<<
100 103
101#ifndef SLIT 104#ifndef USE_NEWWMSPEC
102 NOT<<
103#endif // SLIT
104 "SLIT"<<endl<<
105
106#ifndef USE_TOOLBAR
107 NOT<< 105 NOT<<
108#endif // USE_TOOLBAR 106#endif // USE_NEWWMSPEC
109 "TOOLBAR"<<endl<< 107 "EWMH"<<endl<<
110 108
111#ifndef HAVE_XPM 109#ifndef USE_GNOME
112 NOT<< 110 NOT<<
113#endif // HAVE_XPM 111#endif // USE_GNOME
114 "XPM"<<endl<< 112 "GNOME"<<endl<<
115 113
116#ifndef HAVE_IMLIB2 114#ifndef HAVE_IMLIB2
117 NOT<< 115 NOT<<
118#endif // HAVE_IMLIB2 116#endif // HAVE_IMLIB2
119 "IMLIB2"<<endl<< 117 "IMLIB2"<<endl<<
120 118
121#ifndef USE_GNOME
122 NOT<<
123#endif // USE_GNOME
124 "GNOME"<<endl<<
125
126#ifndef KDE 119#ifndef KDE
127 NOT<< 120 NOT<<
128#endif // KDE 121#endif // KDE
129 "KDE"<<endl<< 122 "KDE"<<endl<<
130 123
131#ifndef USE_NEWWMSPEC 124#ifndef NLS
132 NOT<< 125 NOT<<
133#endif // USE_NEWWMSPEC 126#endif // NLS
134 "EWMH"<<endl<< 127 "NLS"<<endl<<
135 128
136#ifndef REMEMBER 129#ifndef REMEMBER
137 NOT<< 130 NOT<<
138#endif // REMEMBER 131#endif // REMEMBER
139 "REMEMBER"<<endl<< 132 "REMEMBER"<<endl<<
140 133
134#ifndef HAVE_XRENDER
135 NOT<<
136#endif // HAVE_XRENDER
137 "RENDER"<<endl<<
138
141#ifndef SHAPE 139#ifndef SHAPE
142 NOT<< 140 NOT<<
143#endif // SHAPE 141#endif // SHAPE
144 "SHAPE"<<endl<< 142 "SHAPE"<<endl<<
145 143
144#ifndef SLIT
145 NOT<<
146#endif // SLIT
147 "SLIT"<<endl<<
148
149#ifndef USE_TOOLBAR
150 NOT<<
151#endif // USE_TOOLBAR
152 "TOOLBAR"<<endl<<
153
146#ifndef USE_XFT 154#ifndef USE_XFT
147 NOT<< 155 NOT<<
148#endif // USE_XFT 156#endif // USE_XFT
149 "XFT"<<endl<< 157 "XFT"<<endl<<
150 158
159#ifndef XINERAMA
160 NOT<<
161#endif // XINERAMA
162 "XINERAMA"<<endl<<
163
151#ifndef USE_XMB 164#ifndef USE_XMB
152 NOT<< 165 NOT<<
153#endif // USE_XMB 166#endif // USE_XMB
154 "XMB"<<endl<< 167 "XMB"<<endl<<
155 168
156#ifndef XINERAMA 169#ifndef HAVE_XPM
157 NOT<< 170 NOT<<
158#endif // XINERAMA 171#endif // HAVE_XPM
159 "XINERAMA"<<endl<< 172 "XPM"<<endl<<
173
160 174
161#ifndef HAVE_XRENDER
162 NOT<<
163#endif // HAVE_XRENDER
164 "RENDER"<<endl<<
165 endl; 175 endl;
166} 176}
167 177
@@ -180,7 +190,7 @@ int main(int argc, char **argv) {
180 // look for alternative rc file to use 190 // look for alternative rc file to use
181 191
182 if ((++i) >= argc) { 192 if ((++i) >= argc) {
183 cerr<<_FBTEXT(main, RCRequiresArg, 193 cerr<<_FB_CONSOLETEXT(main, RCRequiresArg,
184 "error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl;; 194 "error: '-rc' requires an argument", "the -rc option requires a file argument")<<endl;;
185 exit(1); 195 exit(1);
186 } 196 }
@@ -191,7 +201,7 @@ int main(int argc, char **argv) {
191 // set by the environment variable DISPLAY 201 // set by the environment variable DISPLAY
192 202
193 if ((++i) >= argc) { 203 if ((++i) >= argc) {
194 cerr<<_FBTEXT(main, DISPLAYRequiresArg, 204 cerr<<_FB_CONSOLETEXT(main, DISPLAYRequiresArg,
195 "error: '-display' requires an argument", 205 "error: '-display' requires an argument",
196 "")<<endl; 206 "")<<endl;
197 exit(1); 207 exit(1);
@@ -200,7 +210,7 @@ int main(int argc, char **argv) {
200 session_display = argv[i]; 210 session_display = argv[i];
201 std::string display_env = "DISPLAY=" + session_display; 211 std::string display_env = "DISPLAY=" + session_display;
202 if (putenv(const_cast<char *>(display_env.c_str()))) { 212 if (putenv(const_cast<char *>(display_env.c_str()))) {
203 cerr<<_FBTEXT(main, WarnDisplayEnv, 213 cerr<<_FB_CONSOLETEXT(main, WarnDisplayEnv,
204 "warning: couldn't set environment variable 'DISPLAY'", 214 "warning: couldn't set environment variable 'DISPLAY'",
205 "")<<endl; 215 "")<<endl;
206 perror("putenv()"); 216 perror("putenv()");
@@ -211,13 +221,13 @@ int main(int argc, char **argv) {
211 exit(0); 221 exit(0);
212 } else if (strcmp(argv[i], "-log") == 0 ) { 222 } else if (strcmp(argv[i], "-log") == 0 ) {
213 if (i + 1 >= argc) { 223 if (i + 1 >= argc) {
214 cerr<<_FBTEXT(main, LOGRequiresArg, "error: '-log' needs an argument", "")<<endl; 224 cerr<<_FB_CONSOLETEXT(main, LOGRequiresArg, "error: '-log' needs an argument", "")<<endl;
215 exit(1); 225 exit(1);
216 } 226 }
217 log_filename = argv[++i]; 227 log_filename = argv[++i];
218 } else if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "-h") == 0) { 228 } else if (strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "-h") == 0) {
219 // print program usage and command line options 229 // print program usage and command line options
220 printf(_FBTEXT(main, Usage, 230 printf(_FB_CONSOLETEXT(main, Usage,
221 "Fluxbox %s : (c) %s Henrik Kinnunen\n" 231 "Fluxbox %s : (c) %s Henrik Kinnunen\n"
222 "Website: http://www.fluxbox.org/\n\n" 232 "Website: http://www.fluxbox.org/\n\n"
223 "-display <string>\t\tuse display connection.\n" 233 "-display <string>\t\tuse display connection.\n"
@@ -252,9 +262,9 @@ int main(int argc, char **argv) {
252 262
253 // setup log file 263 // setup log file
254 if (log_file) { 264 if (log_file) {
255 cerr<<_FBTEXT(main, LoggingTo, "Logging to", "Logging to a file")<<": "<<log_filename<<endl; 265 cerr<<_FB_CONSOLETEXT(main, LoggingTo, "Logging to", "Logging to a file")<<": "<<log_filename<<endl;
256 log_file<<"------------------------------------------"<<endl; 266 log_file<<"------------------------------------------"<<endl;
257 log_file<<_FBTEXT(main, LogFile, "Log File", "")<<": "<<log_filename<<endl; 267 log_file<<_FB_CONSOLETEXT(main, LogFile, "Log File", "")<<": "<<log_filename<<endl;
258 showInfo(log_file); 268 showInfo(log_file);
259 log_file<<"------------------------------------------"<<endl; 269 log_file<<"------------------------------------------"<<endl;
260 // setup log to use cout and cerr stream 270 // setup log to use cout and cerr stream
@@ -270,19 +280,19 @@ int main(int argc, char **argv) {
270 exitcode = EXIT_SUCCESS; 280 exitcode = EXIT_SUCCESS;
271 281
272 } catch (std::out_of_range &oor) { 282 } catch (std::out_of_range &oor) {
273 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl; 283 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorOutOfRange, "Out of range", "Error message")<<": "<<oor.what()<<endl;
274 } catch (std::runtime_error &re) { 284 } catch (std::runtime_error &re) {
275 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl; 285 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorRuntime, "Runtime error", "Error message")<<": "<<re.what()<<endl;
276 } catch (std::bad_cast &bc) { 286 } catch (std::bad_cast &bc) {
277 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl; 287 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadCast, "Bad cast", "Error message")<<": "<<bc.what()<<endl;
278 } catch (std::bad_alloc &ba) { 288 } catch (std::bad_alloc &ba) {
279 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl; 289 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorBadAlloc, "Bad Alloc", "Error message")<<": "<<ba.what()<<endl;
280 } catch (std::exception &e) { 290 } catch (std::exception &e) {
281 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl; 291 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorStandardException, "Standard Exception", "Error message")<<": "<<e.what()<<endl;
282 } catch (std::string error_str) { 292 } catch (std::string error_str) {
283 cerr<<_FBTEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl; 293 cerr<<_FB_CONSOLETEXT(Common, Error, "Error", "Error message header")<<": "<<error_str<<endl;
284 } catch (...) { 294 } catch (...) {
285 cerr<<"Fluxbox: "<<_FBTEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl; 295 cerr<<"Fluxbox: "<<_FB_CONSOLETEXT(main, ErrorUnknown, "Unknown error", "Error message")<<"."<<endl;
286 abort(); 296 abort();
287 } 297 }
288 298