Borked strcat

pull/29/head
E. Almqvist 3 years ago
parent 4d6c6fd8dd
commit d7b97a830b
  1. 9
      kernel/kernel.c
  2. 7
      lib/str.c

@ -1,14 +1,15 @@
#include "../drivers/vga.h"
#include "../lib/str.h"
#include "../lib/strf.h"
void main() {
vga_init(); // Initialize the screen first
// i.e. clear the screen et cetera.
int test = 1234;
char* teststr;
teststr = int_to_str(test, teststr);
println(teststr, 0xf0);
char* strbuf = "HEJ";
char* str2 = "xD";
strbuf = strcat(strbuf, str2);
println(strbuf, 0xf0);
set_cursor_pos(28, 2);
print("eOS Version 0.1 2021", 0xf0);

@ -5,7 +5,6 @@ unsigned int strlen(char* str) {
for( c = str; *c != '\0'; c++ ) // search for end-of-string
return (unsigned int)(c - str); // get size by delta-address
}
char* strcat(char* buf, char* str) {
@ -15,7 +14,11 @@ char* strcat(char* buf, char* str) {
*(buf + bufferlen) = 0x3f; // placeholder
// concat the str to buf
int cc = 0;
for( char* c = str; *c != '\0'; c++ ) {
*(buf + bufferlen + cc) = *c;
cc++;
}
return buf;
}

Loading…
Cancel
Save