X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=interpreters%2Ffrotz%2Ffiles.c;h=5804d7f4758e936a5747b9693627e49714fe9732;hb=a3d8dbef8ec2442280d6085d43601bf4ba6cadf9;hp=6ed8c3371a67e5897680a7e5c95c9dda90f41059;hpb=b1f1dc50b22b30c4d7176e1ff7c0805e80fe0724;p=projects%2Fchimara%2Fchimara.git diff --git a/interpreters/frotz/files.c b/interpreters/frotz/files.c index 6ed8c33..5804d7f 100644 --- a/interpreters/frotz/files.c +++ b/interpreters/frotz/files.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include "frotz.h" @@ -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++)