Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 779:057ffe7c43dc
Initialize locale charset earlier
This patch fixes a segfault when scr_LogPrint() is called before
scr_InitCurses().
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 27 Mar 2006 22:09:30 +0200 |
parents | e25b8a348ebd |
children | 7e0562e3bc83 |
comparison
equal
deleted
inserted
replaced
778:a22665116104 | 779:057ffe7c43dc |
---|---|
268 add_keyseq("[d", MKEY_EQUIV, 393); // Shift-Left | 268 add_keyseq("[d", MKEY_EQUIV, 393); // Shift-Left |
269 add_keyseq("[5$", MKEY_SHIFT_PGUP, 0); // Shift-PageUp | 269 add_keyseq("[5$", MKEY_SHIFT_PGUP, 0); // Shift-PageUp |
270 add_keyseq("[6$", MKEY_SHIFT_PGDOWN, 0); // Shift-PageDown | 270 add_keyseq("[6$", MKEY_SHIFT_PGDOWN, 0); // Shift-PageDown |
271 } | 271 } |
272 | 272 |
273 void scr_InitLocaleCharSet(void) | |
274 { | |
275 setlocale(LC_CTYPE, ""); | |
276 LocaleCharSet = nl_langinfo(CODESET); | |
277 utf8_mode = (strcmp(LocaleCharSet, "UTF-8") == 0); | |
278 } | |
279 | |
273 void scr_InitCurses(void) | 280 void scr_InitCurses(void) |
274 { | 281 { |
275 /* Key sequences initialization */ | 282 /* Key sequences initialization */ |
276 init_keycodes(); | 283 init_keycodes(); |
277 | 284 |
291 // Note scr_DrawMainWindow() should be called early after scr_InitCurses() | 298 // Note scr_DrawMainWindow() should be called early after scr_InitCurses() |
292 // to update Log_Win_Height and set max{X,Y} | 299 // to update Log_Win_Height and set max{X,Y} |
293 | 300 |
294 inputLine[0] = 0; | 301 inputLine[0] = 0; |
295 ptr_inputline = inputLine; | 302 ptr_inputline = inputLine; |
296 | |
297 setlocale(LC_CTYPE, ""); | |
298 LocaleCharSet = nl_langinfo(CODESET); | |
299 utf8_mode = (strcmp(LocaleCharSet, "UTF-8") == 0); | |
300 | 303 |
301 return; | 304 return; |
302 } | 305 } |
303 | 306 |
304 void scr_TerminateCurses(void) | 307 void scr_TerminateCurses(void) |