feat: implemented strcpy, used constant
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user