while (2 == fscanf (f, "%hd %hd, ", &dummy.command, &dummy.ch));
}
fscanf (f, ";\n");
if (s == k)
found = 1;
} while (!found || !saved_macros_loaded);
if (!saved_macros_loaded) {
saved_macro[i] = 0;
saved_macros_loaded = 1;
}
fclose (f);
return found;
} else
/* This heads the 'Load Macro' dialog box */
edit_error_dialog (_(" Load macro "),
get_sys_error (_(" Error trying to open macro file ")));
return 0;
}
/* }}} Macro stuff starts here */
/* returns 1 on success */
int edit_save_confirm_cmd (WEdit * edit)
{
char *f;
if (edit_confirm_save) {
#ifdef MIDNIGHT
f = catstrs (_(" Confirm save file? : "), edit->filename, " ", 0);
#else
f = catstrs (_(" Confirm save file? : "), edit->dir, edit->filename, " ", 0);
#endif
/* Buttons to 'Confirm save file' query */
if (edit_query_dialog2 (_(" Save file "), f, _("Save"), _("Cancel")))
return 0;
}
return edit_save_cmd (edit);
}
/* returns 1 on success */
int edit_save_cmd (WEdit * edit)
{
edit->force |= REDRAW_COMPLETELY;
if (!edit_save_file (edit, catstrs (edit->dir, edit->filename, 0)))
return edit_save_as_cmd (edit);
edit->modified = 0;
#if defined(MIDNIGHT) || defined(GTK)
edit->delete_file = 0;
#endif
return 1;
}
/* returns 1 on success */
int edit_new_cmd (WEdit * edit)
{
edit->force |= REDRAW_COMPLETELY;
if (edit->modified)
if (edit_query_dialog2 (_ (" Warning "), _ (" Current text was modified without a file save. \n Continue discards these changes. "), _ ("Continue"), _ ("Cancel")))
return 0;
edit->modified = 0;
return edit_renew (edit); /* if this gives an error, something has really screwed up */
}
/* returns 1 on error */
int edit_load_file_from_filename (WEdit *edit, char *exp)
{
int file;
if ((file = open ((char *) exp, O_RDONLY, MY_O_TEXT)) != -1) {
close (file);
if (!edit_reload (edit, exp, 0, "", 0))
return 1;
edit_split_filename (edit, exp);
edit->modified = 0;
return 0;
} else {
/* Heads the 'Load' file dialog box */
edit_error_dialog (_ (" Load "), get_sys_error (_ (" Error trying to open file for reading ")));
}
return 1;
}
int edit_load_cmd (WEdit * edit)
{
char *exp;
edit->force |= REDRAW_COMPLETELY;
if (edit->modified)
if (edit_query_dialog2 (_ (" Warning "), _ (" Current text was modified without a file save. \n Continue discards these changes. "), _ ("Continue"), _ ("Cancel")))