feat: implemented strcpy, used constant

This commit is contained in:
2021-01-30 20:20:12 +01:00
parent 5a1caef5b1
commit 468d5968a9
3 changed files with 8 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ static void keyboard_callback(registers_t regs) {
if ((status & 0b00000001) == 0) {
return;
}
unsigned char scancode = port_byte_in(0x60);
unsigned char scancode = port_byte_in(PORT_PS2_DATA);
print_scancode(scancode);
}
@@ -63,7 +63,7 @@ void print_scancode(unsigned char scancode) {
code -= 0x20; // to lowercase
}
memcpy(msg, MSG_KEY, strlen(MSG_KEY));
strcpy(msg, MSG_KEY);
msg[strlen(msg) - 3] = code;
kprint(msg);
}

View File

@@ -14,6 +14,10 @@ int memcpy(char *dst, char *src, int amount) {
return 0;
}
int strcpy(char *dst, char *src) {
return memcpy(dst, src, strlen(src) + 1);
}
int memset(char *dst, char data, int amount) {
for (int i = 0; i < amount; ++i) {
dst[i] = data;

View File

@@ -10,6 +10,8 @@
int memcpy(char *dst, char *src, int amount);
int strcpy(char *dst, char *src);
int memset(char *dst, char data, int amount);
int itoa(int i, char *target);