d595991ae618ce5f57957ee5336df0961efd7472
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/rtl/string.c
5 * PURPOSE: Ascii string functions
6 * PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
8 * 1999/07/29 ekohl Created
11 /* INCLUDES *****************************************************************/
16 /* FUNCTIONS *****************************************************************/
18 int _stricmp(const char *s1
, const char *s2
)
20 while (toupper(*s1
) == toupper(*s2
))
27 return toupper(*(unsigned const char *)s1
) - toupper(*(unsigned const char *)(s2
));
31 char * _strlwr(char *x
)
44 int _strnicmp(const char *s1
, const char *s2
, size_t n
)
50 if (toupper(*s1
) != toupper(*s2
++))
51 return toupper(*(unsigned const char *)s1
) - toupper(*(unsigned const char *)--s2
);
59 char* _strnset(char* szToFill
, int szFill
, size_t sizeMaxFill
)
63 while (*szToFill
!= 0 && i
< sizeMaxFill
)
74 char * _strrev(char *s
)
95 char* _strset(char* szToFill
, int szFill
)
98 while (*szToFill
!= 0)
108 char *_strupr(char *x
)
121 char *strcat(char *s
, const char *append
)
126 while ((*s
++ = *append
++));
131 char *strchr(const char *s
, int c
)
149 int strcmp(const char *s1
, const char *s2
)
159 return *(unsigned const char *)s1
- *(unsigned const char *)(s2
);
163 char* strcpy(char *to
, const char *from
)
167 for (; (*to
= *from
); ++from
, ++to
);
173 size_t strlen(const char *str
)
179 for (s
= str
; *s
; ++s
);
185 char *strncat(char *dst
, const char *src
, size_t n
)
196 if ((*d
= *s
++) == 0)
208 int strncmp(const char *s1
, const char *s2
, size_t n
)
215 return *(unsigned const char *)s1
- *(unsigned const char *)--s2
;
225 char *strncpy(char *dst
, const char *src
, size_t n
)
234 if ((*d
++ = *s
++) == 0)
248 char *strrchr(const char *s
, int c
)
251 const char *sp
=(char *)0;
267 size_t strspn(const char *s1
, const char *s2
)
269 const char *p
= s1
, *spanp
;
274 for (spanp
= s2
; (sc
= *spanp
++) != 0;)
282 char *strstr(const char *s
, const char *find
)
287 if ((c
= *find
++) != 0)
294 if ((sc
= *s
++) == 0)
299 while (strncmp(s
, find
, len
) != 0);