void filesave(char *temp) { FILE *tmp; NODE *arg; int save_yield_flag; if (::FindWindow(NULL, "Editor")) { MainWindowx->CommandWindow->MessageBox("Did you know you have an edit session running?\n\nAny changes in this edit session are not being saved.", "Information", MB_OK | MB_ICONQUESTION); } arg = cons(make_strnode(temp, NULL, strlen(temp), STRING, strnzcpy), NIL); tmp = writestream; writestream = open_file(car(arg), "w+"); if (writestream != NULL) { save_yield_flag = yield_flag; yield_flag = 0; lsetcursorwait(); setcar(arg, cons(lcontents(), NIL)); lpo(car(arg)); fclose(writestream); IsDirty = 0; lsetcursorarrow(); yield_flag = save_yield_flag; } else err_logo(FILE_ERROR, make_static_strnode("Could not open file")); writestream = tmp; }
NODE *lsave(NODE *arg) { FILE *tmp; tmp = writestream; writestream = open_file(car(arg), "w+"); if (writestream != NULL) { setcar(arg, cons(lcontents(), NIL)); lpo(car(arg)); fclose(writestream); } else err_logo(FILE_ERROR, make_static_strnode("Could not open file")); writestream = tmp; return(UNBOUND); }
NODE *lsave(NODE *arg) { FILE *tmp; NODE *name; if (arg == NIL) name = save_name; else name = car(arg); tmp = writestream; if (name != NIL) { writestream = open_file(name, "w+"); if (writestream != NULL) { lpo(cons(lcontents(NIL), NIL)); fclose(writestream); need_save = 0; save_name = name; } else err_logo(CANT_OPEN_ERROR, car(arg)); } else err_logo(NOT_ENOUGH, NIL); writestream = tmp; return(UNBOUND); }