From 4585ec623286900898a09b1714b3b5de38be4fec Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Fri, 28 Jan 2022 15:50:38 -0500 Subject: login: Add password authentication for registrations --- src/util.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/util.c (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..328a9cc --- /dev/null +++ b/src/util.c @@ -0,0 +1,38 @@ +/* + * ===================================================================================== + * + * Filename: util.c + * + * Description: + * + * Version: 1.0 + * Created: 01/28/2022 03:47:07 PM + * Revision: none + * Compiler: gcc + * + * Author: YOUR NAME (), + * Organization: + * + * ===================================================================================== + */ +#include +#include +#include + +char* trimwhitespace(char* str) { + char* end; + + // Trim leading spaces + while(isspace((unsigned char) *str)) str++; + + if (*str == 0) // All spaces? + return str; + + // trailing spaces + end = str + strlen(str) -1; + while (end > str && isspace((unsigned char)* end)) end--; + + end[1] = '\0'; + + return str; +} -- cgit v1.2.3