} /* print_c_string */
+/*
+ * os_warn
+ *
+ * Display a warning message and continue with the game.
+ *
+ */
+void os_warn (const char *s, ...)
+{
+ va_list m;
+ char errorstring[81];
+ int style;
+
+ va_start(m, s);
+ vsnprintf(errorstring, sizeof(char) * 80, s, m);
+ va_end(m);
+
+ style = os_get_text_style();
+ os_beep(BEEP_HIGH);
+ os_set_text_style(BOLDFACE_STYLE);
+ print_c_string("Warning: ");
+ os_set_text_style(NORMAL_STYLE);
+ print_c_string(errorstring);
+ new_line();
+ os_set_text_style(style);
+ return;
+}
+
+
/*
* os_fatal
*
int saved_record = ostream_record;
char file_name[FILENAME_MAX + 1];
zchar answer[4];
+ char *ext;
/* Turn off playback and recording temporarily */
istream_replay = 0;
ostream_record = 0;
- if (f_setup.restore_mode) {
+ if (f_setup.restore_mode || flag == FILE_NO_PROMPT) {
file_name[0] = 0;
} else {
print_string("Enter a file name.\nDefault is \"");
if (file_name[0] == 0)
strcpy(file_name, default_name);
+ if (flag == FILE_NO_PROMPT) {
+ ext = strrchr(file_name, '.');
+ if (strncmp(ext, EXT_AUX, 4)) {
+ os_warn("Blocked unprompted access of %s. Should only be %s files.", file_name, EXT_AUX);
+ return NULL;
+ }
+ }
+
/* Warn if overwriting a file. */
if ((flag == FILE_SAVE || flag == FILE_SAVE_AUX ||
flag == FILE_RECORD || flag == FILE_SCRIPT)
return font_info_cache[style];
}
+static int current_zfont = TEXT_FONT;
+static int current_style = 0;
+
+/*
+ * os_get_text_style
+ *
+ * Return the current text style. Following flags can be set:
+ *
+ * REVERSE_STYLE
+ * BOLDFACE_STYLE
+ * EMPHASIS_STYLE (aka underline aka italics)
+ * FIXED_WIDTH_STYLE
+ *
+ */
+int os_get_text_style (void)
+{
+ return current_style;
+}
+
/*
* os_set_text_style
* FIXED_WIDTH_STYLE
*
*/
-static int current_zfont = TEXT_FONT;
-static int current_style = 0;
-
void os_set_text_style(int new_style)
{
if (new_style & REVERSE_STYLE)