diff --git a/src/common/commandoption.c b/src/common/commandoption.c index e05cdbf92..d1824d0fc 100644 --- a/src/common/commandoption.c +++ b/src/common/commandoption.c @@ -11,7 +11,7 @@ bool ffParseModuleOptions(const char* key, const char* value) { - if (!ffStrStartsWith(key, "--") || !isalpha(key[2])) return false; + if (!ffStrStartsWith(key, "--") || !ffCharIsEnglishAlphabet(key[2])) return false; for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(key[2]) - 'A']; *modules; ++modules) { @@ -102,7 +102,7 @@ static void parseStructureCommand( } } - if(isalpha(line[0])) + if(ffCharIsEnglishAlphabet(line[0])) { for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules) { diff --git a/src/common/jsonconfig.c b/src/common/jsonconfig.c index 3131cd750..de34b2b10 100644 --- a/src/common/jsonconfig.c +++ b/src/common/jsonconfig.c @@ -94,7 +94,7 @@ static inline void genJsonResult(FFModuleBaseInfo* baseInfo, yyjson_mut_doc* doc static bool parseModuleJsonObject(const char* type, yyjson_val* jsonVal, yyjson_mut_doc* jsonDoc) { - if(!isalpha(type[0])) return false; + if(!ffCharIsEnglishAlphabet(type[0])) return false; for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(type[0]) - 'A']; *modules; ++modules) { diff --git a/src/fastfetch.c b/src/fastfetch.c index 629c4dad0..474abd78f 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -249,7 +249,7 @@ static void printCommandHelp(const char* command) puts(FASTFETCH_DATATEXT_HELP_COLOR); else if(ffStrEqualsIgnCase(command, "format")) puts(FASTFETCH_DATATEXT_HELP_FORMAT); - else if(isalpha(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // -format + else if(ffCharIsEnglishAlphabet(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // -format printCommandFormatHelp(command); else if(!printSpecificCommandHelp(command)) fprintf(stderr, "Error: No specific help for command '%s' provided\n", command); diff --git a/src/util/stringUtils.h b/src/util/stringUtils.h index dd5d7e5ba..ad24057b5 100644 --- a/src/util/stringUtils.h +++ b/src/util/stringUtils.h @@ -69,3 +69,8 @@ static inline bool ffStrContainsC(const char* str, char compareTo) { return strchr(str, compareTo) != NULL; } + +static inline bool ffCharIsEnglishAlphabet(char c) +{ + return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); +}