From a632711155260c9d7bd679736987857041afbddb Mon Sep 17 00:00:00 2001 From: Oskar Date: Sun, 31 Mar 2024 21:58:56 +0200 Subject: new function call_singles --- TODO | 1 + startmode.c | 64 +++++++++++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/TODO b/TODO index 3ada509..e354e52 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,7 @@ TODO list. This is mostly so i can plan more granularly and remember small stuff i was working on last time and what i should prioritise first. This is not my overall big planning board. (1 highest prio, 10 lowest) +1 - Make all singles work. 1 - Have a big long think about how the strings will be processed and translate in to actually doing things in the program. 1 - implement the logic that will actually interpret the validated input 3 - improve the length check (i have NO idea how it actually works because im slow stupid!) diff --git a/startmode.c b/startmode.c index ff209eb..a52e4d2 100644 --- a/startmode.c +++ b/startmode.c @@ -39,6 +39,32 @@ int display_name_linecount(char *filename) { return 0; } +int call_singles(char single) { + + switch(single) { + case 'p': + case 'P': + + break; + case 'e': + case 'E': + + break; + case 'c': + case 'C': + + break; + case 'q': + case 'Q': + + break; + case 'a': + case 'A': + + break; + } +} + int startmode(char filename[]) { // The entry to the program. Count lines and display the count. Also show which file is being edited. int dnl = display_name_linecount(filename); @@ -47,21 +73,27 @@ int startmode(char filename[]) { } uint64_t focus = 1; // The focus variable. Which is the actual line number we have "selected" - char *multiple; - char single; - int smode_input_ret = smode_input(&single, &multiple, focus); - if (smode_input_ret == _SINGLE) { - fprintf(stdout, "single\n"); - fprintf(stdout, "%c\n", single); - } - if (smode_input_ret == _MULTIPLE) { - fprintf(stdout, "multiple\n"); - fprintf(stdout, "%s", multiple); - free(multiple); - } - if (smode_input_ret == _FAIL) { - fprintf(stdout, "?\n"); + while (1) { + char *multiple; + char single; + int smode_input_ret = smode_input(&single, &multiple, focus); + + switch (smode_input_ret) { + + case _SINGLE: + fprintf(stdout, "single\n"); + fprintf(stdout, "%c\n", single); + break; + case _MULTIPLE: + fprintf(stdout, "multiple\n"); + fprintf(stdout, "%s", multiple); + free(multiple); + break; + case _FAIL: + fprintf(stdout, "?\n"); + break; + + } + } - - return EXIT_SUCCESS; } -- cgit v1.2.3