From d639bb8c99a5fd8282d245cd6b8b55965d306844 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 5 Jun 2015 13:40:34 +0300 Subject: [PATCH] libc: Add tolower implementation Add a tolower implementation that may be used in various parts of the operating system. Change-Id: I5aa855b41e2a09fcb077860b4580dbe1e6d4a093 Signed-off-by: Jukka Rissanen --- lib/libc/minimal/include/ctype.h | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/libc/minimal/include/ctype.h diff --git a/lib/libc/minimal/include/ctype.h b/lib/libc/minimal/include/ctype.h new file mode 100644 index 00000000000..4bd4dff168f --- /dev/null +++ b/lib/libc/minimal/include/ctype.h @@ -0,0 +1,41 @@ +/* ctype.h */ + +/* + * Copyright (c) 2015 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2) Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3) Neither the name of Wind River Systems nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __INC_ctype_h__ +#define __INC_ctype_h__ + +static inline int tolower(int chr) +{ + return (chr >= 'A' && chr <= 'Z') ? (chr + 32) : (chr); +} + +#endif /* __INC_ctype_h__ */