summaryrefslogtreecommitdiff
path: root/usr/sdk/common/string/strcmp.c
blob: cb47cfb05015612302ad117b5d6cdcc8c80d415e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * Copyright (c) 2025, Ian Moffett.
 * Provided under the BSD-3 clause.
 */

#include <sdk/string.h>
#include <sdk/types.h>

int
strcmp(const char *s1, const char *s2)
{
    while (*s1 == *s2++) {
        if (*s1++ == 0) {
            return (0);
        }
    }

    return (*(UBYTE *)s1 - *(UBYTE *)--s2);
}