/* See interface.h for function descriptions. */ int if_init(void) { if (init_curses()) return 1; hl_groups_instance = hl_groups_initialize(); if (!hl_groups_instance) return 3; if (hl_groups_setup(hl_groups_instance) == -1) return 3; /* Set up the signal handler to catch SIGWINCH */ if (set_up_signal() == -1) return 2; if (ioctl(fileno(stdout), TIOCGWINSZ, &screen_size) == -1) { screen_size.ws_row = LINES; screen_size.ws_col = COLS; } /* Create the file dialog object */ if ((fd = filedlg_new(0, 0, HEIGHT, WIDTH)) == NULL) return 5; /* Set up window layout */ window_height_shift = (int) ((HEIGHT / 2) * (cur_win_split / 2.0)); switch (if_layout()) { case 2: return 4; } return 0; }
/* See interface.h for function descriptions. */ int if_init(void) { if (init_curses()) { clog_error(CLOG_CGDB, "Unable to initialize the ncurses library"); return -1; } hl_groups_instance = hl_groups_initialize(); if (!hl_groups_instance) { clog_error(CLOG_CGDB, "Unable to setup highlighting groups"); return -1; } if (hl_groups_setup(hl_groups_instance) == -1) { clog_error(CLOG_CGDB, "Unable to setup highlighting groups"); return -1; } /* Set up the signal handler to catch SIGWINCH */ if (set_up_signal() == -1) { clog_error(CLOG_CGDB, "Unable to handle signal: SIGWINCH"); return -1; } if (ioctl(fileno(stdout), TIOCGWINSZ, &screen_size) == -1) { screen_size.ws_row = swin_lines(); screen_size.ws_col = swin_cols(); } /* Create the file dialog object */ fd = filedlg_new(0, 0, HEIGHT, WIDTH); /* Set up window layout */ window_shift = (int) ((HEIGHT / 2) * (cur_win_split / 2.0)); switch (if_layout()) { case 2: return 4; } G_line_number = ibuf_init(); return 0; }