diff options
author | Timo Sirainen <cras@irssi.org> | 2001-12-17 18:41:06 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-12-17 18:41:06 +0000 |
commit | 35d363136f2c3e8f358942d84c5a41c26256c097 (patch) | |
tree | a8adfe2e20599a8786a5d9f9465c7a1d0722031a /src/fe-text/irssi.c | |
parent | 475aa2758822a9b49923b300ea25a9c07dee14dc (diff) | |
download | irssi-35d363136f2c3e8f358942d84c5a41c26256c097.zip |
Separate irssi-dummy binary was a bit stupid idea, now it can be started with -d command line parameter.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2264 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/irssi.c')
-rw-r--r-- | src/fe-text/irssi.c | 91 |
1 files changed, 56 insertions, 35 deletions
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c index 4b2ed8d8..b0b69e64 100644 --- a/src/fe-text/irssi.c +++ b/src/fe-text/irssi.c @@ -72,7 +72,10 @@ void mainwindow_activity_deinit(void); void mainwindows_layout_init(void); void mainwindows_layout_deinit(void); -static int dirty, full_redraw; +void term_dummy_init(void); +void term_dummy_deinit(void); + +static int dirty, full_redraw, dummy; static GMainLoop *main_loop; int quitting; @@ -107,7 +110,7 @@ void irssi_set_dirty(void) static void dirty_check(void) { - if (!dirty) + if (!dirty || dummy) return; term_resize_dirty(); @@ -147,21 +150,25 @@ static void textui_finish_init(void) { quitting = FALSE; - term_refresh_freeze(); - textbuffer_init(); - textbuffer_view_init(); - textbuffer_commands_init(); - textbuffer_reformat_init(); - gui_expandos_init(); - gui_printtext_init(); - gui_readline_init(); - lastlog_init(); - mainwindows_init(); - mainwindow_activity_init(); - mainwindows_layout_init(); - gui_windows_init(); - statusbar_init(); - term_refresh_thaw(); + if (dummy) + term_dummy_init(); + else { + term_refresh_freeze(); + textbuffer_init(); + textbuffer_view_init(); + textbuffer_commands_init(); + textbuffer_reformat_init(); + gui_expandos_init(); + gui_printtext_init(); + gui_readline_init(); + lastlog_init(); + mainwindows_init(); + mainwindow_activity_init(); + mainwindows_layout_init(); + gui_windows_init(); + statusbar_init(); + term_refresh_thaw(); + } settings_check(); module_register("core", "fe-text"); @@ -198,22 +205,26 @@ static void textui_deinit(void) dirty_check(); /* one last time to print any quit messages */ signal_remove("gui exit", (SIGNAL_FUNC) sig_exit); - lastlog_deinit(); - statusbar_deinit(); - gui_printtext_deinit(); - gui_readline_deinit(); - gui_windows_deinit(); - mainwindows_layout_deinit(); - mainwindow_activity_deinit(); - mainwindows_deinit(); - gui_expandos_deinit(); - textbuffer_reformat_deinit(); - textbuffer_commands_deinit(); - textbuffer_view_deinit(); - textbuffer_deinit(); - - term_refresh_thaw(); - term_deinit(); + if (dummy) + term_dummy_deinit(); + else { + lastlog_deinit(); + statusbar_deinit(); + gui_printtext_deinit(); + gui_readline_deinit(); + gui_windows_deinit(); + mainwindows_layout_deinit(); + mainwindow_activity_deinit(); + mainwindows_deinit(); + gui_expandos_deinit(); + textbuffer_reformat_deinit(); + textbuffer_commands_deinit(); + textbuffer_view_deinit(); + textbuffer_deinit(); + + term_refresh_thaw(); + term_deinit(); + } theme_unregister(); @@ -288,6 +299,12 @@ static void winsock_init(void) int main(int argc, char **argv) { + static struct poptOption options[] = { + { "dummy", 'd', POPT_ARG_NONE, &dummy, 0, "Use the dummy terminal mode", NULL }, + { NULL, '\0', 0, NULL } + }; + + dummy = FALSE; quitting = FALSE; core_init_paths(argc, argv); @@ -305,10 +322,14 @@ int main(int argc, char **argv) #endif textui_init(); + args_register(options); args_execute(argc, argv); - if (!term_init()) - g_error("Can't initialize screen handling, quitting.\n"); + if (!dummy && !term_init()) { + fprintf(stderr, "Can't initialize screen handling, quitting.\n"); + fprintf(stderr, "You can still use the dummy mode with -d parameter\n"); + return 1; + } textui_finish_init(); main_loop = g_main_new(TRUE); |