| 1 | /** |
| 2 | * @file pm_strncasecmp.h |
| 3 | * |
| 4 | * A custom strncasecmp implementation. |
| 5 | */ |
| 6 | #ifndef PRISM_STRNCASECMP_H |
| 7 | #define PRISM_STRNCASECMP_H |
| 8 | |
| 9 | #include "prism/defines.h" |
| 10 | |
| 11 | #include <ctype.h> |
| 12 | #include <stddef.h> |
| 13 | #include <stdint.h> |
| 14 | |
| 15 | /** |
| 16 | * Compare two strings, ignoring case, up to the given length. Returns 0 if the |
| 17 | * strings are equal, a negative number if string1 is less than string2, or a |
| 18 | * positive number if string1 is greater than string2. |
| 19 | * |
| 20 | * Note that this is effectively our own implementation of strncasecmp, but it's |
| 21 | * not available on all of the platforms we want to support so we're rolling it |
| 22 | * here. |
| 23 | * |
| 24 | * @param string1 The first string to compare. |
| 25 | * @param string2 The second string to compare |
| 26 | * @param length The maximum number of characters to compare. |
| 27 | * @return 0 if the strings are equal, a negative number if string1 is less than |
| 28 | * string2, or a positive number if string1 is greater than string2. |
| 29 | */ |
| 30 | int pm_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length); |
| 31 | |
| 32 | #endif |