Applied patch from Mika Lindqvist: This patch implements both strlwr() and strupr() functions in libroot and includes strupr() in kernel build.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26226 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2008-07-02 19:30:46 +00:00
parent 72401b8f9e
commit 765ae3a785
6 changed files with 44 additions and 14 deletions

View File

@ -66,8 +66,8 @@ extern size_t strlcpy(char *dest, const char *source, size_t length);
extern size_t strnlen(const char *string, size_t count);
/* extern char *strlwr(char *string); */
/* extern char *strupr(char *string); */
extern char *strlwr(char *string);
extern char *strupr(char *string);
/* extern char *strsep(char **stringPointer, const char *delimiter); */

View File

@ -138,6 +138,7 @@
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
#define asm __asm
@ -206,18 +207,6 @@ do { \
} while (0)
/* Kernel doesn't have strupr, should be fixed. */
static __inline char *
strupr(char *str)
{
char *c = str;
while(*c) {
*c = toupper(*c);
c++;
}
return(str);
}
#else /* _KERNEL_MODE */
#include <ctype.h>

View File

@ -109,6 +109,7 @@ KernelMergeObject kernel_lib_posix.o :
strspn.c
strstr.c
strtok.c
strupr.c
: $(TARGET_KERNEL_PIC_CCFLAGS)
;

View File

@ -25,6 +25,7 @@ MergeObject posix_string.o :
strerror.c
strlcat.c
strlcpy.c
strlwr.c
strncat.c
strncmp.c
strncpy.c
@ -34,6 +35,7 @@ MergeObject posix_string.o :
strspn.c
strstr.c
strtok.c
strupr.c
strxfrm.c
;

View File

@ -0,0 +1,19 @@
/*
** Copyright 2008, Mika Lindqvist. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
#include <ctype.h>
#include <string.h>
char *
strlwr(char *str)
{
char *c = str;
while(*c) {
*c = tolower(*c);
c++;
}
return(str);
}

View File

@ -0,0 +1,19 @@
/*
** Copyright 2008, Mika Lindqvist. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
#include <ctype.h>
#include <string.h>
char *
strupr(char *str)
{
char *c = str;
while(*c) {
*c = toupper(*c);
c++;
}
return(str);
}