X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=interpreters%2Ffrotz%2Ffiles.c;fp=interpreters%2Ffrotz%2Ffiles.c;h=f40739593b664e8f6ddb7f097a4f4981d1e79d1a;hb=75009f8f40bbb580194e1722db76f4644bf18641;hp=6ed8c3371a67e5897680a7e5c95c9dda90f41059;hpb=89081782541e85e079f64839ffb26b4e74273eb7;p=projects%2Fchimara%2Fchimara.git diff --git a/interpreters/frotz/files.c b/interpreters/frotz/files.c index 6ed8c33..f407395 100644 --- a/interpreters/frotz/files.c +++ b/interpreters/frotz/files.c @@ -46,30 +46,21 @@ static FILE *pfp = NULL; * the old transscription file in V1 to V4, and to ask for a new file * name in V5+. * - * Alas, we cannot do this, since glk cannot give us the filename - * to reopen it again, and I dont want to mess with filerefs here. - * */ +static bool script_valid = FALSE; + void script_open (void) { - static bool script_valid = FALSE; h_flags &= ~SCRIPTING_FLAG; -#if 0 - if (h_version >= V5 || !script_valid) { - if (!os_read_file_name (new_name, script_name, FILE_SCRIPT)) - goto done; - } - - /* Opening in "at" mode doesn't work for script_erase_input... */ - - if ((sfp = fopen (sfp = fopen (script_name, "r+t")) != NULL || (sfp = fopen (script_name, "w+t")) != NULL) { - -#endif + if (h_version < V5 && script_valid) + sfp = frotzreopen(FILE_SCRIPT); + else + sfp = frotzopenprompt(FILE_SCRIPT); - if ((sfp = frotzopenprompt(FILE_SCRIPT)) != NULL) + if (sfp != NULL) { fseek (sfp, 0, SEEK_END); @@ -82,8 +73,6 @@ void script_open (void) } else print_string ("Cannot open file\n"); -/* done: */ - SET_WORD (H_FLAGS, h_flags) }/* script_open */ @@ -140,7 +129,7 @@ void script_char (zchar c) if (c == ZC_GAP) { script_char (' '); script_char (' '); return; } - fputc (c, sfp); script_width++; + fputwc (c, sfp); script_width++; }/* script_char */ @@ -170,7 +159,7 @@ void script_word (const zchar *s) else width += 1; - if (f_setup.script_cols != 0 && script_width + width > f_setup.script_cols) { + if (option_script_cols != 0 && script_width + width > option_script_cols) { if (*s == ' ' || *s == ZC_INDENT || *s == ZC_GAP) s++; @@ -203,7 +192,7 @@ void script_write_input (const zchar *buf, zchar key) for (i = 0, width = 0; buf[i] != 0; i++) width++; - if (f_setup.script_cols != 0 && script_width + width > f_setup.script_cols) + if (option_script_cols != 0 && script_width + width > option_script_cols) script_new_line (); for (i = 0; buf[i] != 0; i++)