summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-03-31 20:47:40 +0200
committerOskar <[email protected]>2024-03-31 20:47:40 +0200
commitc2844d947d2e8fdc43f9ede54fbeab89b3387183 (patch)
treee5a23165cfbc84a083ea2bd6f51a50ed9f077b69
parent637d43e58f72b0b6a3cc4577370cb52e07836b89 (diff)
Alright. 'D' and 'X' will work exactly like validate_LN with MODE_N. May
change in the future but for now it will only support MODE_N for simplicity sake. I really want the new input system out.
-rw-r--r--TODO1
-rw-r--r--i_validation.h4
-rw-r--r--input.c28
3 files changed, 24 insertions, 9 deletions
diff --git a/TODO b/TODO
index 0222b07..2045663 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
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 - Think about how i want 'd' and 'x' to work and how it will be validated
1 - Implement 'd' validation
1 - Test 'd' validation
2 - Implement 'x' validation
diff --git a/i_validation.h b/i_validation.h
index 52e7c51..39e5848 100644
--- a/i_validation.h
+++ b/i_validation.h
@@ -13,8 +13,8 @@
#define _IMM_NOTHING _VALID
#define _CONTINUE 6
#define _NA 7
-#define MODE_L 76
-#define MODE_N 78
+#define MODE_L 76 // MODE_L works for Commands with + and -
+#define MODE_N 78 // MODE_N works for Commands with + only
int validate_imm_numbers(char *smode_buf);
diff --git a/input.c b/input.c
index 8776f4d..1f2f81e 100644
--- a/input.c
+++ b/input.c
@@ -53,18 +53,34 @@ int smode_input(char *single, char **multiple, uint64_t focus) { // This functio
*multiple = (char *)malloc(strlen(smode_buf) + 1);
strcpy(*multiple, smode_buf);
return _MULTIPLE;
+
break; }
case 'x':
- case 'X':
+ case 'X': {
+
+ // X will work with MODE_N mode for now. I may update in the future to use MODE_L but for now i will only use MODE_N for simplicity sake.
+ int chk = validate_LN(smode_buf, MODE_N);
+ if (chk == _INVALID) {
+ return _FAIL;
+ }
+ *multiple = (char *)malloc(strlen(smode_buf) + 1);
+ strcpy(*multiple, smode_buf);
return _MULTIPLE;
- break;
- case 'd':
- case 'D':
- *multiple = (char *)malloc(strlen(smode_buf) + 1); // just a test
+ break; }
+ case 'd':
+ case 'D': {
+
+ // X will work with MODE_N mode for now. I may update in the future to use MODE_L but for now i will only use MODE_N for simplicity sake.
+ int chk = validate_LN(smode_buf, MODE_N);
+ if (chk == _INVALID) {
+ return _FAIL;
+ }
+ *multiple = (char *)malloc(strlen(smode_buf) + 1);
strcpy(*multiple, smode_buf);
return _MULTIPLE;
- break; // singles below this point
+
+ break; }// singles below this point
case 'p':
case 'P':
*single = smode_buf[0];