diff options
author | Oskar <[email protected]> | 2024-03-31 21:58:56 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-03-31 21:58:56 +0200 |
commit | a632711155260c9d7bd679736987857041afbddb (patch) | |
tree | 22cbedab0541a1dd3382d0d922b6ef3e0eec55fd | |
parent | 6104c0ee7257ae99e5187f56593442ca9f04084b (diff) |
new function call_singles
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | startmode.c | 64 |
2 files changed, 49 insertions, 16 deletions
@@ -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; } |