Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/common/commandoption.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/jsonconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/fastfetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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")) // <module>-format
else if(ffCharIsEnglishAlphabet(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // <module>-format
printCommandFormatHelp(command);
else if(!printSpecificCommandHelp(command))
fprintf(stderr, "Error: No specific help for command '%s' provided\n", command);
Expand Down
5 changes: 5 additions & 0 deletions src/util/stringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}