Skip to content

Commit b9faf8d

Browse files
authored
fastfetch: fix #868 (#871)
Fix #868.
1 parent 4175dfd commit b9faf8d

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/common/commandoption.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
bool ffParseModuleOptions(const char* key, const char* value)
1313
{
14-
if (!ffStrStartsWith(key, "--") || !isalpha(key[2])) return false;
14+
if (!ffStrStartsWith(key, "--") || !ffCharIsEnglishAlphabet(key[2])) return false;
1515

1616
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(key[2]) - 'A']; *modules; ++modules)
1717
{
@@ -102,7 +102,7 @@ static void parseStructureCommand(
102102
}
103103
}
104104

105-
if(isalpha(line[0]))
105+
if(ffCharIsEnglishAlphabet(line[0]))
106106
{
107107
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
108108
{

src/common/jsonconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static inline void genJsonResult(FFModuleBaseInfo* baseInfo, yyjson_mut_doc* doc
9494

9595
static bool parseModuleJsonObject(const char* type, yyjson_val* jsonVal, yyjson_mut_doc* jsonDoc)
9696
{
97-
if(!isalpha(type[0])) return false;
97+
if(!ffCharIsEnglishAlphabet(type[0])) return false;
9898

9999
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(type[0]) - 'A']; *modules; ++modules)
100100
{

src/fastfetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static void printCommandHelp(const char* command)
249249
puts(FASTFETCH_DATATEXT_HELP_COLOR);
250250
else if(ffStrEqualsIgnCase(command, "format"))
251251
puts(FASTFETCH_DATATEXT_HELP_FORMAT);
252-
else if(isalpha(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // <module>-format
252+
else if(ffCharIsEnglishAlphabet(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // <module>-format
253253
printCommandFormatHelp(command);
254254
else if(!printSpecificCommandHelp(command))
255255
fprintf(stderr, "Error: No specific help for command '%s' provided\n", command);

src/util/stringUtils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,8 @@ static inline bool ffStrContainsC(const char* str, char compareTo)
6969
{
7070
return strchr(str, compareTo) != NULL;
7171
}
72+
73+
static inline bool ffCharIsEnglishAlphabet(char c)
74+
{
75+
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
76+
}

0 commit comments

Comments
 (0)