diff options
Diffstat (limited to 'std/stdlib.src')
| -rw-r--r-- | std/stdlib.src | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/std/stdlib.src b/std/stdlib.src index 5c09a55..5904bef 100644 --- a/std/stdlib.src +++ b/std/stdlib.src @@ -5,3 +5,27 @@ let println = (str: *i8, args: varargs) => void { printf("\n"); return; }; + +let strcmp = (stra: *i8, strb: *i8) => bool { + let i = 0; + while true { + let ca = (*(stra + i)); + let cb = (*(strb + i)); + + if ca == '\0' { + return cb == '\0'; + }; + + if cb == '\0' { + return ca == '\0'; + }; + + if !(ca == cb) { + return false; + }; + + i = i + 1; + }; + + return true; +}; |