From 73b0414254e6b888656b4e5346292f27b67ac9d9 Mon Sep 17 00:00:00 2001 From: Oskar Date: Fri, 19 Apr 2024 23:18:03 +0200 Subject: Added a way for the program to check if file exists or not. If not then it creates it. If changes are made to the file like writing newlines or edits from editmode is written then it will create the file. --- editmode.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'editmode.c') diff --git a/editmode.c b/editmode.c index f552f4a..3ed80be 100644 --- a/editmode.c +++ b/editmode.c @@ -6,6 +6,8 @@ #include "7ed.h" #include +extern uint8_t new; + int delete_specified_newline(char filename[], long focus) { // special version of write_line that does as the name says char *line; @@ -277,6 +279,7 @@ int editmode(char filename[], uint64_t focus) { // the editing interface return 0; } + new = 0; size_t editbuffer_size = strlen(editbuffer); write_line(filename, focus, editbuffer, editbuffer_size); -- cgit v1.2.3