| 1009 | } |
| 1010 | |
| 1011 | void |
| 1012 | mswin_putstr_ex(winid wid, int attr, const char *text, int app) |
| 1013 | { |
| 1014 | if ((wid >= 0) && (wid < MAXWINDOWS)) { |
| 1015 | if (GetNHApp()->windowlist[wid].win == NULL |
| 1016 | && GetNHApp()->windowlist[wid].type == NHW_MENU) { |
| 1017 | GetNHApp()->windowlist[wid].win = |
| 1018 | mswin_init_menu_window(MENU_TYPE_TEXT); |
| 1019 | GetNHApp()->windowlist[wid].dead = 0; |
| 1020 | } |
| 1021 | |
| 1022 | if (GetNHApp()->windowlist[wid].win != NULL) { |
| 1023 | MSNHMsgPutstr data; |
| 1024 | |
| 1025 | ZeroMemory(&data, sizeof(data)); |
| 1026 | data.attr = attr; |
| 1027 | data.text = text; |
| 1028 | data.append = app; |
| 1029 | SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND, |
| 1030 | (WPARAM) MSNH_MSG_PUTSTR, (LPARAM) &data); |
| 1031 | } |
| 1032 | /* yield a bit so it gets done immediately */ |
| 1033 | mswin_get_nh_event(); |
| 1034 | } else { |
| 1035 | char *was = GetNHApp()->saved_text; |
| 1036 | |
| 1037 | // build text to display later in message box |
| 1038 | GetNHApp()->saved_text = |
| 1039 | realloc(GetNHApp()->saved_text, |
| 1040 | strlen(text) + strlen(GetNHApp()->saved_text) + 1); |
| 1041 | if (!GetNHApp()->saved_text) { |
| 1042 | free(was); |
| 1043 | } else { |
| 1044 | strcat(GetNHApp()->saved_text, text); |
| 1045 | } |
| 1046 | } |
| 1047 | } |
| 1048 | |
| 1049 | /* Display the file named str. Complain about missing files |
| 1050 | iff complain is TRUE. |
no test coverage detected