#[std] fn strlen(str: &char) -> num { for (let i=0; str[i] != '\0'; i=i+1) {} return i } fn strcpy(dst: &char, src: &char) { for (let i=0; src[i] != '\0'; i=i+1) { dst[i] = src[i]; } dst[i] = 0; } fn strcat(dst: &char, src: &char) { let offset = strlen(dst); for (let i=0; src[i] != '\0'; i=i+1) { dst[offset+i] = src[i]; } dst[offset+i] = 0; } fn input(buffer: &char) -> void { let i = 0; for (let ch = get_char(); ch != '\n'; ch = get_char()) { buffer[i] = ch; i = i + 1; } } fn main() -> void { let size = 256; putstr("Enter some text: "); let s = alloc(size) as &char; input(s); strcat(s, " take a sad song, and make it better!"); putstr("You said: \""); putstr(s); putcharln('"'); free s: size; }