print all lines to the window. */
| 163 | |
| 164 | /* print all lines to the window. */ |
| 165 | void fill_window(WINDOW *win, const char *text) |
| 166 | { |
| 167 | int x, y; |
| 168 | int total_lines = get_line_no(text); |
| 169 | int i; |
| 170 | |
| 171 | getmaxyx(win, y, x); |
| 172 | /* do not go over end of line */ |
| 173 | total_lines = min(total_lines, y); |
| 174 | for (i = 0; i < total_lines; i++) { |
| 175 | char tmp[x+10]; |
| 176 | const char *line = get_line(text, i); |
| 177 | int len = get_line_length(line); |
| 178 | strncpy(tmp, line, min(len, x)); |
| 179 | tmp[len] = '\0'; |
| 180 | mvwprintw(win, i, 0, "%s", tmp); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | /* get the message, and buttons. |
| 185 | * each button must be a char* |
no test coverage detected