mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Chore: strcasecmp => ffStrEqualsIgnCase
This commit is contained in:
parent
d860ce528a
commit
0b75caaf96
@ -43,11 +43,11 @@ static bool detectPlasmaFromFile(const char* filename, FFQtResult* result)
|
||||
char categoryName[32];
|
||||
sscanf(line, "[%31[^]]", categoryName);
|
||||
|
||||
if(strcasecmp(categoryName, "General") == 0)
|
||||
if(ffStrEqualsIgnCase(categoryName, "General"))
|
||||
category = PLASMA_CATEGORY_GENERAL;
|
||||
else if(strcasecmp(categoryName, "KDE") == 0)
|
||||
else if(ffStrEqualsIgnCase(categoryName, "KDE"))
|
||||
category = PLASMA_CATEGORY_KDE;
|
||||
else if(strcasecmp(categoryName, "Icons") == 0)
|
||||
else if(ffStrEqualsIgnCase(categoryName, "Icons"))
|
||||
category = PLASMA_CATEGORY_ICONS;
|
||||
else
|
||||
category = PLASMA_CATEGORY_OTHER;
|
||||
|
@ -17,7 +17,7 @@ static uint32_t getNumElements(const char* searchPath /* including `\*` suffix *
|
||||
do // Managed to locate and create an handle to that folder.
|
||||
{
|
||||
if(!(wfd.dwFileAttributes & type)) continue;
|
||||
if(!flag && strcasecmp(ignore, wfd.cFileName) == 0)
|
||||
if(!flag && ffStrEqualsIgnCase(ignore, wfd.cFileName))
|
||||
{
|
||||
flag = true;
|
||||
continue;
|
||||
|
@ -231,33 +231,33 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
|
||||
if(ffStrEqualsIgnCase(exeName, "sh")) // #849
|
||||
return false;
|
||||
|
||||
if(strcasecmp(exeName, "bash") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "bash"))
|
||||
return getShellVersionBash(exe, version);
|
||||
if(strcasecmp(exeName, "zsh") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "zsh"))
|
||||
return getExeVersionGeneral(exe, version); //zsh 5.9 (arm-apple-darwin21.3.0)
|
||||
if(strcasecmp(exeName, "fish") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "fish"))
|
||||
return getShellVersionFish(exe, version);
|
||||
if(strcasecmp(exeName, "pwsh") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "pwsh"))
|
||||
return getShellVersionPwsh(exe, version);
|
||||
if(strcasecmp(exeName, "csh") == 0 || strcasecmp(exeName, "tcsh") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "csh") || ffStrEqualsIgnCase(exeName, "tcsh"))
|
||||
return getExeVersionGeneral(exe, version); //tcsh 6.24.07 (Astron) 2022-12-21 (aarch64-apple-darwin) options wide,nls,dl,al,kan,sm,rh,color,filec
|
||||
if(strcasecmp(exeName, "nu") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "nu"))
|
||||
return getShellVersionNushell(exe, version);
|
||||
if(strcasecmp(exeName, "ksh") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "ksh"))
|
||||
return getShellVersionKsh(exe, version);
|
||||
if(strcasecmp(exeName, "oksh") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "oksh"))
|
||||
return getShellVersionOksh(exe, version);
|
||||
if(strcasecmp(exeName, "oil.ovm") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "oil.ovm"))
|
||||
return getShellVersionOils(exe, version);
|
||||
if(strcasecmp(exeName, "elvish") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "elvish"))
|
||||
return getExeVersionRaw(exe, version);
|
||||
if(strcasecmp(exeName, "ash") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "ash"))
|
||||
return getShellVersionAsh(exe, version);
|
||||
if(strcasecmp(exeName, "xonsh") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "xonsh"))
|
||||
return getShellVersionXonsh(exe, version);
|
||||
|
||||
#ifdef _WIN32
|
||||
if(strcasecmp(exeName, "powershell") == 0 || strcasecmp(exeName, "powershell_ise") == 0)
|
||||
if(ffStrEqualsIgnCase(exeName, "powershell") || ffStrEqualsIgnCase(exeName, "powershell_ise"))
|
||||
return getShellVersionWinPowerShell(exe, version);
|
||||
|
||||
return getFileVersion(exe->chars, version);
|
||||
|
@ -679,7 +679,7 @@ static void parseArguments(FFdata* data, int argc, char** argv, void (*parser)(F
|
||||
if(i == argc - 1 || (
|
||||
argv[i + 1][0] == '-' &&
|
||||
argv[i + 1][1] != '\0' && // `-` is used as an alias for `/dev/stdin`
|
||||
strcasecmp(argv[i], "--separator-string") != 0 // Separator string can start with a -
|
||||
!ffStrEqualsIgnCase(argv[i], "--separator-string") // Separator string can start with a -
|
||||
)) {
|
||||
parser(data, argv[i], NULL);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ void ffOptionsInitLogo(FFOptionsLogo* options)
|
||||
|
||||
bool ffOptionsParseLogoCommandLine(FFOptionsLogo* options, const char* key, const char* value)
|
||||
{
|
||||
if (strcasecmp(key, "-l") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "-l"))
|
||||
goto logoType;
|
||||
|
||||
const char* subKey = ffOptionTestPrefix(key, "logo");
|
||||
@ -50,7 +50,7 @@ logoType:
|
||||
else
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
}
|
||||
else if(strcasecmp(subKey, "type") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "type"))
|
||||
{
|
||||
options->type = (FFLogoType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "auto", FF_LOGO_TYPE_AUTO },
|
||||
@ -88,29 +88,29 @@ logoType:
|
||||
}
|
||||
ffOptionParseColor(value, &options->colors[index]);
|
||||
}
|
||||
else if(strcasecmp(subKey, "width") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "width"))
|
||||
options->width = ffOptionParseUInt32(key, value);
|
||||
else if(strcasecmp(subKey, "height") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "height"))
|
||||
options->height = ffOptionParseUInt32(key, value);
|
||||
else if(strcasecmp(subKey, "padding") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "padding"))
|
||||
{
|
||||
uint32_t padding = ffOptionParseUInt32(key, value);
|
||||
options->paddingLeft = padding;
|
||||
options->paddingRight = padding;
|
||||
}
|
||||
else if(strcasecmp(subKey, "padding-top") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "padding-top"))
|
||||
options->paddingTop = ffOptionParseUInt32(key, value);
|
||||
else if(strcasecmp(subKey, "padding-left") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "padding-left"))
|
||||
options->paddingLeft = ffOptionParseUInt32(key, value);
|
||||
else if(strcasecmp(subKey, "padding-right") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "padding-right"))
|
||||
options->paddingRight = ffOptionParseUInt32(key, value);
|
||||
else if(strcasecmp(subKey, "print-remaining") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "print-remaining"))
|
||||
options->printRemaining = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(subKey, "preserve-aspect-ratio") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "preserve-aspect-ratio"))
|
||||
options->preserveAspectRatio = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(subKey, "recache") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "recache"))
|
||||
options->recache = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(subKey, "separate") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "separate"))
|
||||
options->separate = ffOptionParseBoolean(value);
|
||||
else
|
||||
return false;
|
||||
@ -122,7 +122,7 @@ logoType:
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_FILE;
|
||||
}
|
||||
else if(strcasecmp(subKey, "raw") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "raw"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_FILE_RAW;
|
||||
@ -137,7 +137,7 @@ logoType:
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_DATA;
|
||||
}
|
||||
else if(strcasecmp(subKey, "raw") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "raw"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_DATA_RAW;
|
||||
@ -145,27 +145,27 @@ logoType:
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if(strcasecmp(key, "--sixel") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--sixel"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_IMAGE_SIXEL;
|
||||
}
|
||||
else if(strcasecmp(key, "--kitty") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--kitty"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_IMAGE_KITTY;
|
||||
}
|
||||
else if(strcasecmp(key, "--kitty-direct") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--kitty-direct"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_IMAGE_KITTY_DIRECT;
|
||||
}
|
||||
else if(strcasecmp(key, "--iterm") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--iterm"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_IMAGE_ITERM;
|
||||
}
|
||||
else if(strcasecmp(key, "--raw") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--raw"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_IMAGE_RAW;
|
||||
@ -177,11 +177,11 @@ logoType:
|
||||
ffOptionParseString(key, value, &options->source);
|
||||
options->type = FF_LOGO_TYPE_IMAGE_CHAFA;
|
||||
}
|
||||
else if(strcasecmp(subKey, "fg-only") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "fg-only"))
|
||||
options->chafaFgOnly = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(subKey, "symbols") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "symbols"))
|
||||
ffOptionParseString(key, value, &options->chafaSymbols);
|
||||
else if(strcasecmp(subKey, "canvas-mode") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "canvas-mode"))
|
||||
{
|
||||
options->chafaCanvasMode = (uint32_t) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "TRUECOLOR", 0 },
|
||||
@ -195,7 +195,7 @@ logoType:
|
||||
{},
|
||||
});
|
||||
}
|
||||
else if(strcasecmp(subKey, "color-space") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "color-space"))
|
||||
{
|
||||
options->chafaColorSpace = (uint32_t) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "RGB", 0 },
|
||||
@ -203,7 +203,7 @@ logoType:
|
||||
{},
|
||||
});
|
||||
}
|
||||
else if(strcasecmp(subKey, "dither-mode") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "dither-mode"))
|
||||
{
|
||||
options->chafaDitherMode = (uint32_t) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "NONE", 0 },
|
||||
@ -257,7 +257,7 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
|
||||
if (strcasecmp(key, "type") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "type"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
@ -282,12 +282,12 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
|
||||
options->type = (FFLogoType) value;
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "source") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "source"))
|
||||
{
|
||||
ffStrbufSetS(&options->source, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "color") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "color"))
|
||||
{
|
||||
if (!yyjson_is_obj(val))
|
||||
return "Property 'color' must be an object";
|
||||
@ -305,7 +305,7 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "width") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "width"))
|
||||
{
|
||||
uint32_t value = (uint32_t) yyjson_get_uint(val);
|
||||
if (value == 0)
|
||||
@ -313,7 +313,7 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
|
||||
options->width = value;
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "height") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "height"))
|
||||
{
|
||||
uint32_t value = (uint32_t) yyjson_get_uint(val);
|
||||
if (value == 0)
|
||||
@ -321,7 +321,7 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
|
||||
options->height = value;
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "padding") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "padding"))
|
||||
{
|
||||
if (!yyjson_is_obj(val))
|
||||
return "Logo padding must be an object";
|
||||
@ -340,27 +340,27 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
|
||||
#undef FF_PARSE_PADDING_POSITON
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "printRemaining") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "printRemaining"))
|
||||
{
|
||||
options->printRemaining = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "preserveAspectRatio") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "preserveAspectRatio"))
|
||||
{
|
||||
options->preserveAspectRatio = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "recache") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "recache"))
|
||||
{
|
||||
options->recache = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "separate") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "separate"))
|
||||
{
|
||||
options->separate = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "chafa") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "chafa"))
|
||||
{
|
||||
if (!yyjson_is_obj(val))
|
||||
return "Chafa config must be an object";
|
||||
|
Loading…
x
Reference in New Issue
Block a user