From ace65b453151845bc361f21f3e5b651c35f9f126 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Wed, 22 May 2024 13:00:41 -0400 Subject: massive refactor for mp and organization --- klib/toupper.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 klib/toupper.c (limited to 'klib/toupper.c') diff --git a/klib/toupper.c b/klib/toupper.c new file mode 100644 index 0000000..807eb38 --- /dev/null +++ b/klib/toupper.c @@ -0,0 +1,26 @@ +#include "string.h" + +int +toupper(int c) +{ + if(c >= 'a' && c <= 'z') + c -= ('a' - 'A'); + return c; +} + +char* +stoupper(char *s) +{ + char *o = s; + for(; *s != 0; s++) + *s = toupper(*s); + return o; +} + +char* +sntoupper(char *s, size_t limit) +{ + for(size_t i = 0; i < limit; i++) + s[i] = toupper(s[i]); + return s; +} -- cgit v1.2.1