summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc270
1 files changed, 135 insertions, 135 deletions
diff --git a/src/main.cc b/src/main.cc
index e63700d..dc81685 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -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.8 2002/10/13 21:48:28 fluxgen Exp $ 25// $Id: main.cc,v 1.9 2002/12/01 13:42:07 rathnor Exp $
26 26
27 27
28 28
@@ -68,151 +68,151 @@ uds::uds_flags_t uds::flags = uds::leak_check;
68#endif //!DEBUG_UDS 68#endif //!DEBUG_UDS
69 69
70const char *getNLSYesNoMsg(bool val) { 70const char *getNLSYesNoMsg(bool val) {
71 if (val) { 71 if (val) {
72 return I18n::instance()->getMessage( 72 return I18n::instance()->getMessage(
73 FBNLS::CommonSet, FBNLS::CommonYes, 73 FBNLS::CommonSet, FBNLS::CommonYes,
74 "yes"); 74 "yes");
75 } 75 }
76 76
77 return I18n::instance()->getMessage( 77 return I18n::instance()->getMessage(
78 FBNLS::CommonSet, FBNLS::CommonNo, 78 FBNLS::CommonSet, FBNLS::CommonNo,
79 "no"); 79 "no");
80} 80}
81 81
82int main(int argc, char **argv) { 82int main(int argc, char **argv) {
83 #ifdef DEBUG_UDS 83#ifdef DEBUG_UDS
84 uds::Init uds_init; 84 uds::Init uds_init;
85 #endif //!DEBUG_UDS 85#endif //!DEBUG_UDS
86 86
87 char *session_display = (char *) 0; 87 char *session_display = (char *) 0;
88 char *rc_file = (char *) 0; 88 char *rc_file = (char *) 0;
89 89
90 NLSInit("blackbox.cat"); 90 NLSInit("blackbox.cat");
91 I18n *i18n = I18n::instance(); 91 I18n *i18n = I18n::instance();
92 92
93 int i; 93 int i;
94 for (i = 1; i < argc; ++i) { 94 for (i = 1; i < argc; ++i) {
95 if (! strcmp(argv[i], "-rc")) { 95 if (! strcmp(argv[i], "-rc")) {
96 // look for alternative rc file to use 96 // look for alternative rc file to use
97 97
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
106 rc_file = argv[i]; 106 rc_file = argv[i];
107 } else if (! strcmp(argv[i], "-display")) { 107 } else if (! strcmp(argv[i], "-display")) {
108 // check for -display option... to run on a display other than the one 108 // check for -display option... to run on a display other than the one
109 // set by the environment variable DISPLAY 109 // set by the environment variable DISPLAY
110 110
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
119 session_display = argv[i]; 119 session_display = argv[i];
120 char dtmp[255]; 120 char dtmp[255];
121 sprintf(dtmp, "DISPLAY=%s", session_display); 121 sprintf(dtmp, "DISPLAY=%s", session_display);
122 122
123 if (putenv(dtmp)) { 123 if (putenv(dtmp)) {
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) {
132 // print current version string 132 // print current version string
133 printf("Fluxbox %s : (c) 2001-2002 Henrik Kinnunen \n\n", 133 printf("Fluxbox %s : (c) 2001-2002 Henrik Kinnunen \n\n",
134 __fluxbox_version); 134 __fluxbox_version);
135 exit(0); 135 exit(0);
136 } else if (strcmp(argv[i], "-help") == 0) { 136 } else if (strcmp(argv[i], "-help") == 0) {
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 // some people have requested that we print out command line options
149 // as well 149 // as well
150 printf(i18n-> 150 printf(i18n->
151 getMessage( 151 getMessage(
152 FBNLS::mainSet, FBNLS::mainCompileOptions, 152 FBNLS::mainSet, FBNLS::mainCompileOptions,
153 "Compile time options:\n" 153 "Compile time options:\n"
154 " Debugging:\t\t\t%s\n" 154 " Debugging:\t\t\t%s\n"
155 " Interlacing:\t\t\t%s\n" 155 " Interlacing:\t\t\t%s\n"
156 " Shape:\t\t\t%s\n" 156 " Shape:\t\t\t%s\n"
157 " Slit:\t\t\t\t%s\n" 157 " Slit:\t\t\t\t%s\n"
158 " 8bpp Ordered Dithering:\t%s\n\n"), 158 " 8bpp Ordered Dithering:\t%s\n\n"),
159 #ifdef DEBUG 159#ifdef DEBUG
160 getNLSYesNoMsg(true), 160 getNLSYesNoMsg(true),
161 #else // !DEBUG 161#else // !DEBUG
162 getNLSYesNoMsg(false), 162 getNLSYesNoMsg(false),
163 #endif // DEBUG 163#endif // DEBUG
164 164
165 #ifdef INTERLACE 165#ifdef INTERLACE
166 getNLSYesNoMsg(true), 166 getNLSYesNoMsg(true),
167 #else // !INTERLACE 167#else // !INTERLACE
168 getNLSYesNoMsg(false), 168 getNLSYesNoMsg(false),
169 #endif // INTERLACE 169#endif // INTERLACE
170 170
171 #ifdef SHAPE 171#ifdef SHAPE
172 getNLSYesNoMsg(true), 172 getNLSYesNoMsg(true),
173 #else // !SHAPE 173#else // !SHAPE
174 getNLSYesNoMsg(false), 174 getNLSYesNoMsg(false),
175 #endif // SHAPE 175#endif // SHAPE
176 176
177 #ifdef SLIT 177#ifdef SLIT
178 getNLSYesNoMsg(true), 178 getNLSYesNoMsg(true),
179 #else // !SLIT 179#else // !SLIT
180 getNLSYesNoMsg(false), 180 getNLSYesNoMsg(false),
181 #endif // SLIT 181#endif // SLIT
182 182
183 #ifdef ORDEREDPSEUDO 183#ifdef ORDEREDPSEUDO
184 getNLSYesNoMsg(true) 184 getNLSYesNoMsg(true)
185 #else // !ORDEREDPSEUDO 185#else // !ORDEREDPSEUDO
186 getNLSYesNoMsg(false) 186 getNLSYesNoMsg(false)
187 #endif // ORDEREDPSEUDO 187#endif // ORDEREDPSEUDO
188 188
189 ); 189 );
190 190
191 ::exit(0); 191 ::exit(0);
192 } 192 }
193 } 193 }
194 194
195#ifdef __EMX__ 195#ifdef __EMX__
196 _chdir2(getenv("X11ROOT")); 196 _chdir2(getenv("X11ROOT"));
197#endif // __EMX__ 197#endif // __EMX__
198 Fluxbox *fluxbox=0; 198 Fluxbox *fluxbox=0;
199 int exitcode=EXIT_SUCCESS; 199 int exitcode=EXIT_SUCCESS;
200 try { 200 try {
201 201
202 fluxbox = new Fluxbox(argc, argv, session_display, rc_file); 202 fluxbox = new Fluxbox(argc, argv, session_display, rc_file);
203 fluxbox->eventLoop(); 203 fluxbox->eventLoop();
204 204
205 } catch (std::out_of_range oor) { 205 } catch (std::out_of_range oor) {
206 cerr<<"Fluxbox: Out of range: "<<oor.what()<<endl; 206 cerr<<"Fluxbox: Out of range: "<<oor.what()<<endl;
207 } catch (std::logic_error le) { 207 } catch (std::logic_error le) {
208 cerr<<"Fluxbox: Logic error: "<<le.what()<<endl; 208 cerr<<"Fluxbox: Logic error: "<<le.what()<<endl;
209 } catch (std::runtime_error re) { 209 } catch (std::runtime_error re) {
210 cerr<<"Fluxbox: Runtime error: "<<re.what()<<endl; 210 cerr<<"Fluxbox: Runtime error: "<<re.what()<<endl;
211 } catch (...) { 211 } catch (...) {
212 cerr<<"Fluxbox: Unknown error."<<endl; 212 cerr<<"Fluxbox: Unknown error."<<endl;
213 } 213 }
214 214
215 if (fluxbox) 215 if (fluxbox)
216 delete fluxbox; 216 delete fluxbox;
217 exit(exitcode); 217 exit(exitcode);
218} 218}