MCPcopy Create free account
hub / github.com/NetHack/NetHack / mswin_display_file

Function mswin_display_file

outdated/sys/wince/mswproc.c:964–999  ·  view source on GitHub ↗

Display the file named str. Complain about missing files iff complain is TRUE. */

Source from the content-addressed store, hash-verified

962 iff complain is TRUE.
963*/
964void
965mswin_display_file(const char *filename, BOOLEAN_P must_exist)
966{
967 dlb *f;
968 TCHAR wbuf[BUFSZ];
969
970 logDebug("mswin_display_file(%s, %d)\n", filename, must_exist);
971
972 f = dlb_fopen(filename, RDTMODE);
973 if (!f) {
974 if (must_exist) {
975 TCHAR message[90];
976 _stprintf(message, TEXT("Warning! Could not find file: %s\n"),
977 NH_A2W(filename, wbuf, sizeof(wbuf)));
978 MessageBox(GetNHApp()->hMainWnd, message, TEXT("ERROR"),
979 MB_OK | MB_ICONERROR);
980 }
981 } else {
982 winid text;
983 char line[LLEN];
984
985 text = mswin_create_nhwindow(NHW_TEXT);
986
987 while (dlb_fgets(line, LLEN, f)) {
988 size_t len;
989 len = strlen(line);
990 if (line[len - 1] == '\n')
991 line[len - 1] = '\x0';
992 mswin_putstr(text, ATR_NONE, line);
993 }
994 (void) dlb_fclose(f);
995
996 mswin_display_nhwindow(text, 1);
997 mswin_destroy_nhwindow(text);
998 }
999}
1000
1001/* Start using window as a menu. You must call start_menu()
1002 before add_menu(). After calling start_menu() you may not

Callers

nothing calls this directly

Calls 9

dlb_fopenFunction · 0.85
dlb_fgetsFunction · 0.85
dlb_fcloseFunction · 0.85
logDebugFunction · 0.70
GetNHAppFunction · 0.70
mswin_create_nhwindowFunction · 0.70
mswin_putstrFunction · 0.70
mswin_display_nhwindowFunction · 0.70
mswin_destroy_nhwindowFunction · 0.70

Tested by

no test coverage detected