summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar <[email protected]>2023-12-23 19:22:23 +0100
committerOskar <[email protected]>2023-12-23 19:22:23 +0100
commit03f53f231f0708b9f9f74302554a5d7d982aaa21 (patch)
tree10d8a8970c6db44f08d54e191f29cabaf60b9736
parent87a820faf9df7029c096f3183554159e11243989 (diff)
New delete line feature. Lost of fixes too
-rw-r--r--7ed.h2
-rw-r--r--README11
-rw-r--r--editmode.c1
-rw-r--r--startmode.c3
4 files changed, 1 insertions, 16 deletions
diff --git a/7ed.h b/7ed.h
index f0be605..ece0aab 100644
--- a/7ed.h
+++ b/7ed.h
@@ -8,8 +8,6 @@
#define BUF_SZ_4 4096
#define BUF_SZ_8 8192
-
-
int count_lines_in_file(char filename[], uint64_t *lines);
int count_lines_in_file_posix(char filename[], size_t *lines);
diff --git a/README b/README
index 366fb1d..f5d2f01 100644
--- a/README
+++ b/README
@@ -2,14 +2,3 @@ This is my take on a so called "Line editor"
Its a crude and simple line editor.
WARNING: Do not use this program on any files that you dont want to risk damaging, deleting or overwriting. I can not gaurantee that this program will function as expected.
-
-TODO:
-- Create a function to retrieve a line from file (DONE) It's called: GET_LINE(char filename[], long focus, char **line)
-- Create edit mode to actually make edits to the file (DONE)
-- Find and fix bugs. Fixed one bug in write_line() function. (btw this was written with 7ed!!!)
-- Create functionality to actually add new lines. You cant actually add a line on the end of the file. You also cant just add a line and move everything under it one line down. I will get to fixing that though.
-
-
-
-
-
diff --git a/editmode.c b/editmode.c
index a5d7641..2fb40b2 100644
--- a/editmode.c
+++ b/editmode.c
@@ -14,7 +14,6 @@ int delete_specified_newline(char filename[], long focus) { // special version o
if (ret == 1) {
return EXIT_FAILURE;
}
- // TODO: Some code that checks if its the first line in the file. Because such a situation might cause a problem. Im not entirely sure yet.
start = start-1; // decrement by 1 to place start position at the newline
diff --git a/startmode.c b/startmode.c
index 5df9032..7bd5049 100644
--- a/startmode.c
+++ b/startmode.c
@@ -109,7 +109,6 @@ int startmode(char filename[]) {
return EXIT_FAILURE;
}
fprintf(stdout, "%s", line);
- //printf("%ld", start);
free(line);
break;
@@ -189,7 +188,7 @@ int startmode(char filename[]) {
return 1;
}
int increment = 0;
- if (focus == 1) { // if we are at line 1 then increment becomes 1
+ if (focus == 1) { // checks if its line 1. This is so that we can remove the newline properly.
increment++;
}
int rlc = remove_line_contents(filename, focus);