please ;-;
This commit is contained in:
parent
83cf16d15a
commit
ac1eef983f
@ -45,11 +45,22 @@ void user_input(char *input) {
|
||||
} else if (strncmp(input, "ADD", 3) == 0) {
|
||||
// Parse the base register value from the user input
|
||||
char base_str[16];
|
||||
kprint("Enter base register value: ");
|
||||
kread(base_str);
|
||||
u32 base = atoi(base_str);
|
||||
|
||||
// Get input from your input source (you need to implement this)
|
||||
get_input(base_str);
|
||||
|
||||
// Check if the input matches the expected message
|
||||
if (strcmp(base_str, "Enter base register value: ") == 0) {
|
||||
// Input matches, proceed to read the value
|
||||
get_input(base_str); // Assuming get_input reads the actual value
|
||||
u32 base = digit_conver(base_str);
|
||||
|
||||
umem_head = add_node(umem_head, base, 0x100, true, global_id++);
|
||||
} else {
|
||||
// Input doesn't match the expected message
|
||||
kprint("Invalid input format.\n");
|
||||
// Handle the error or prompt the user again
|
||||
}
|
||||
} else if (strcmp(input, "LIST") == 0) {
|
||||
kprint("***** FORWARD ****\n");
|
||||
print_list( umem_head, true);
|
||||
@ -113,3 +124,20 @@ void user_input(char *input) {
|
||||
}
|
||||
kprint("> ");
|
||||
}
|
||||
|
||||
|
||||
int digconver(const char *str) {
|
||||
int result = 0;
|
||||
int i = 0;
|
||||
|
||||
while (str[i] != '\0') {
|
||||
if (str[i] >= '0' && str[i] <= '9') {
|
||||
result = result * 10 + (str[i] - '0');
|
||||
} else {
|
||||
kprint("Error - Provided input is not a valid number.\n");
|
||||
return 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -11,4 +11,6 @@
|
||||
|
||||
void user_input(char *input);
|
||||
|
||||
int digit_conver(const char *str);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user