find finished

This commit is contained in:
2025-03-03 16:47:03 +08:00
parent 930df1c35b
commit b362c49120
10 changed files with 123 additions and 4 deletions

View File

@@ -21,12 +21,33 @@ char *strcpy(char *s, const char *t) {
return os;
}
char *strncpy(char *s, const char *t, int n) {
char *os;
os = s;
if (n <= 0)
return os;
while (--n > 0 && (*s++ = *t++) != 0)
;
while (n-- > 0)
*s++ = 0;
return os;
}
int strcmp(const char *p, const char *q) {
while (*p && *p == *q)
p++, q++;
return (uchar)*p - (uchar)*q;
}
int strncmp(const char *p, const char *q, int n) {
while (n > 0 && *p && *p == *q)
p++, q++, n--;
if (n == 0)
return 0;
return (uchar)*p - (uchar)*q;
}
uint strlen(const char *s) {
int n;