*
* 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"
* 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);
} else print_string ("Cannot open file\n");
-/* done: */
-
SET_WORD (H_FLAGS, h_flags)
}/* script_open */
if (c == ZC_GAP)
{ script_char (' '); script_char (' '); return; }
- fputc (c, sfp); script_width++;
+ fputwc (c, sfp); script_width++;
}/* script_char */
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++;
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++)