From 5409424816298234bb1b6909ce9e534e25304b0c Mon Sep 17 00:00:00 2001 From: Thomas Roehl <Thomas.Roehl@googlemail.com> Date: Fri, 5 Mar 2021 22:55:49 +0100 Subject: [PATCH] Lowercase string tokens while tokenizing --- calculator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/calculator.c b/calculator.c index a401123..0486550 100644 --- a/calculator.c +++ b/calculator.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include <math.h> // Temporary #include <getopt.h> #include "stack.h" @@ -713,10 +714,10 @@ int tokenize(char *str, char *(**tokensRef)) // Assemble an n-character (plus null-terminator) text token { int len = 1; - tmpToken[0] = ch; + tmpToken[0] = tolower(ch); for(len = 1; *ptr && type(*ptr) == text && len <= prefs.maxtokenlength; ++len) { - tmpToken[len] = *ptr++; + tmpToken[len] = tolower(*ptr++); } tmpToken[len] = '\0'; }