diff options
author | Oskar <[email protected]> | 2024-02-11 17:51:01 +0100 |
---|---|---|
committer | Oskar <[email protected]> | 2024-02-11 17:51:01 +0100 |
commit | 32e27cbd2d5c151e7f4805dd862c5ec18ca62b9d (patch) | |
tree | d5978af5f32fa177b95913ceead88fb9bfa2fc3c | |
parent | dd8b6d127e366ace19860781b00812e44c0c4a27 (diff) |
README update
-rwxr-xr-x | 7ed | bin | 766048 -> 0 bytes | |||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | functions.c | 16 | ||||
-rw-r--r-- | startmode.c | 10 |
5 files changed, 13 insertions, 22 deletions
Binary files differ @@ -1,10 +1,11 @@ -CC=gcc #gcc works best here, mostly because i experienced errors in clang that i dont care to deal with quite yet. +CC=cc CFLAGS=-Wfatal-errors -Wall -Werror -Wextra -g -O2 -static CFLAGS_TESTBIN=-Wfatal-errors -Wall -Werror -Wextra -g -fsanitize=address TARGET=7ed TESTTARGET=7ed-TESTING INSTALL_DIRECTORY=/usr/local/bin + all: 7ed 7ed: $(CC) $(CFLAGS) 7ed.c functions.c startmode.c editmode.c -o $(TARGET) @@ -18,6 +19,6 @@ tests: $(CC) $(CFLAGS_TESTBIN) 7ed.c functions.c startmode.c editmode.c -o test/$(TESTTARGET) install: - cp $(TARGET) $(INSTALL_DIRECTORY) + @cp $(TARGET) $(INSTALL_DIRECTORY) @echo "$(TARGET) was installed to $(INSTALL_DIRECTORY)" @@ -2,3 +2,7 @@ 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: +-Add some sort of feature to do L+ or L- to increment or decrement without having to do too many inputs +-Change "N" to make it a bit less annoying to use diff --git a/functions.c b/functions.c index b308622..e0f6ba9 100644 --- a/functions.c +++ b/functions.c @@ -6,20 +6,6 @@ #include <string.h> #include <stdint.h> -void confirm() { - struct termios old,new; - - tcgetattr(fileno(stdin),&old); - tcgetattr(fileno(stdin),&new); - cfmakeraw(&new); - tcsetattr(fileno(stdin),TCSANOW,&new); - fputs("Press any key to continue...",stdout); - fflush(NULL); - fgetc(stdin); - tcsetattr(fileno(stdin),TCSANOW,&old); - puts(""); -} - int choice() { char choice; @@ -56,7 +42,7 @@ int count_lines_in_file (char filename[], uint64_t *lines) { file = fopen(filename,"rb"); // Open file if (file == NULL) { // Check if you can open file - fprintf(stderr, "Cannot open file. COUNT_LINES_IN_FILE\n"); + fprintf(stderr, "count_lines_in_file(): Cannot open file.\n"); return 1; } fseek(file, -1, SEEK_END); diff --git a/startmode.c b/startmode.c index bf948ce..9e0daf1 100644 --- a/startmode.c +++ b/startmode.c @@ -41,10 +41,8 @@ int startmode(char filename[]) { int ret = count_lines_in_file(filename, &Flines); if (ret == 1) { return EXIT_FAILURE; - } // I do not know WHY i can not have this return to a variable?? - // For some reason whenever i do int x = count_lines_in_file(.....) it will NOT compile - // I can not for the life of me figure out what the compiler is trying to say about the"expected expression" error - // I HAVE DONE THE SAME THING EVERYWHERE ELSE WHY WOULD IT INEXPLICABLY NOT WORK SPECIFICALLY HERE? + } + fprintf(stdout, "(%lu): ", focus); char command = getchar(); if (command == '\n') { @@ -217,11 +215,13 @@ int startmode(char filename[]) { break; } default: fprintf(stdout, "?\n"); + } - + } + return EXIT_SUCCESS; } |