From 765ae3a785157ae7d8aa018280139122a7ec5443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 2 Jul 2008 19:30:46 +0000 Subject: [PATCH] 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 --- headers/posix/string.h | 4 ++-- .../acpi/include/platform/achaiku.h | 13 +------------ src/system/kernel/lib/Jamfile | 1 + src/system/libroot/posix/string/Jamfile | 2 ++ src/system/libroot/posix/string/strlwr.c | 19 +++++++++++++++++++ src/system/libroot/posix/string/strupr.c | 19 +++++++++++++++++++ 6 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 src/system/libroot/posix/string/strlwr.c create mode 100644 src/system/libroot/posix/string/strupr.c diff --git a/headers/posix/string.h b/headers/posix/string.h index 4800735cb4..cb660f8326 100644 --- a/headers/posix/string.h +++ b/headers/posix/string.h @@ -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); */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h index 3b3da035c1..68bab81ba0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/achaiku.h @@ -138,6 +138,7 @@ #include #include #include +#include #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 diff --git a/src/system/kernel/lib/Jamfile b/src/system/kernel/lib/Jamfile index 7d80284b64..d63b0f4ac3 100644 --- a/src/system/kernel/lib/Jamfile +++ b/src/system/kernel/lib/Jamfile @@ -109,6 +109,7 @@ KernelMergeObject kernel_lib_posix.o : strspn.c strstr.c strtok.c + strupr.c : $(TARGET_KERNEL_PIC_CCFLAGS) ; diff --git a/src/system/libroot/posix/string/Jamfile b/src/system/libroot/posix/string/Jamfile index 45813d64e7..00404fbc6d 100644 --- a/src/system/libroot/posix/string/Jamfile +++ b/src/system/libroot/posix/string/Jamfile @@ -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 ; diff --git a/src/system/libroot/posix/string/strlwr.c b/src/system/libroot/posix/string/strlwr.c new file mode 100644 index 0000000000..c6369d531e --- /dev/null +++ b/src/system/libroot/posix/string/strlwr.c @@ -0,0 +1,19 @@ +/* +** Copyright 2008, Mika Lindqvist. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + +#include +#include + +char * +strlwr(char *str) +{ + char *c = str; + while(*c) { + *c = tolower(*c); + c++; + } + return(str); +} + diff --git a/src/system/libroot/posix/string/strupr.c b/src/system/libroot/posix/string/strupr.c new file mode 100644 index 0000000000..1803b7b0a3 --- /dev/null +++ b/src/system/libroot/posix/string/strupr.c @@ -0,0 +1,19 @@ +/* +** Copyright 2008, Mika Lindqvist. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + +#include +#include + +char * +strupr(char *str) +{ + char *c = str; + while(*c) { + *c = toupper(*c); + c++; + } + return(str); +} +