PatchworkOS  3984a1d
A non-POSIX operating system.
Loading...
Searching...
No Matches
wordcmp.c
Go to the documentation of this file.
1#include <sys/proc.h>
2
3#include <string.h>
4
5int64_t wordcmp(const char* string, const char* word)
6{
7 size_t len = strlen(word);
8 return strncmp(string, word, len) == 0 && (string[len] == '\0' || string[len] == ' ') ? 0 : -1;
9}
int64_t y
Definition main.c:153
int64_t wordcmp(const char *string, const char *word)
Helper for comparing the first word of a string.
Definition wordcmp.c:5
__INT64_TYPE__ int64_t
Definition stdint.h:16
_PUBLIC int strncmp(const char *s1, const char *s2, size_t n)
Definition strncmp.c:3
_PUBLIC size_t strlen(const char *s)
Definition strlen.c:3