mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Global: refactor strcasecmp() == 0 to ffStrEqualsIgnCase()
to prevent me from forgetting to write `== 0`
This commit is contained in:
+45
-44
@@ -4,6 +4,7 @@
|
||||
#include "common/io/io.h"
|
||||
#include "common/time.h"
|
||||
#include "modules/modules.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
@@ -11,17 +12,17 @@
|
||||
|
||||
bool ffJsonConfigParseModuleArgs(const char* key, yyjson_val* val, FFModuleArgs* moduleArgs)
|
||||
{
|
||||
if(strcasecmp(key, "key") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "key"))
|
||||
{
|
||||
ffStrbufSetNS(&moduleArgs->key, (uint32_t) yyjson_get_len(val), yyjson_get_str(val));
|
||||
return true;
|
||||
}
|
||||
else if(strcasecmp(key, "keyColor") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "keyColor"))
|
||||
{
|
||||
ffOptionParseColor(yyjson_get_str(val), &moduleArgs->keyColor);
|
||||
return true;
|
||||
}
|
||||
else if(strcasecmp(key, "format") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "format"))
|
||||
{
|
||||
ffStrbufSetNS(&moduleArgs->outputFormat, (uint32_t) yyjson_get_len(val), yyjson_get_str(val));
|
||||
return true;
|
||||
@@ -51,7 +52,7 @@ const char* ffJsonConfigParseEnum(yyjson_val* val, int* result, FFKeyValuePair p
|
||||
const char* strVal = yyjson_get_str(val);
|
||||
for (const FFKeyValuePair* pPair = pairs; pPair->key; ++pPair)
|
||||
{
|
||||
if (strcasecmp(strVal, pPair->key) == 0)
|
||||
if (ffStrEqualsIgnCase(strVal, pPair->key))
|
||||
{
|
||||
*result = pPair->value;
|
||||
return NULL;
|
||||
@@ -66,7 +67,7 @@ const char* ffJsonConfigParseEnum(yyjson_val* val, int* result, FFKeyValuePair p
|
||||
|
||||
static inline bool tryModule(FFinstance* instance, const char* type, yyjson_val* module, const char* moduleName, void (*const f)(FFinstance *instance, yyjson_val *module))
|
||||
{
|
||||
if (strcasecmp(type, moduleName) == 0)
|
||||
if (ffStrEqualsIgnCase(type, moduleName))
|
||||
{
|
||||
f(instance, module);
|
||||
return true;
|
||||
@@ -294,21 +295,21 @@ const char* ffParseGeneralJsonConfig(FFinstance* instance)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
|
||||
if (strcasecmp(key, "allowSlowOperations") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "allowSlowOperations"))
|
||||
config->allowSlowOperations = yyjson_get_bool(val);
|
||||
else if (strcasecmp(key, "thread") == 0 || strcasecmp(key, "multithreading") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "thread") || ffStrEqualsIgnCase(key, "multithreading"))
|
||||
config->multithreading = yyjson_get_bool(val);
|
||||
else if (strcasecmp(key, "stat") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "stat"))
|
||||
config->stat = yyjson_get_bool(val);
|
||||
else if (strcasecmp(key, "escapeBedrock") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "escapeBedrock"))
|
||||
config->escapeBedrock = yyjson_get_bool(val);
|
||||
else if (strcasecmp(key, "pipe") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "pipe"))
|
||||
config->pipe = yyjson_get_bool(val);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
else if (strcasecmp(key, "playerName") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "playerName"))
|
||||
ffStrbufSetS(&config->playerName, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "osFile") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "osFile"))
|
||||
ffStrbufSetS(&config->osFile, yyjson_get_str(val));
|
||||
#endif
|
||||
|
||||
@@ -339,15 +340,15 @@ const char* ffParseDisplayJsonConfig(FFinstance* instance)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
|
||||
if (strcasecmp(key, "showErrors") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showErrors"))
|
||||
config->showErrors = yyjson_get_bool(val);
|
||||
else if (strcasecmp(key, "disableLinewrap") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "disableLinewrap"))
|
||||
config->disableLinewrap = yyjson_get_bool(val);
|
||||
else if (strcasecmp(key, "hideCursor") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "hideCursor"))
|
||||
config->hideCursor = yyjson_get_bool(val);
|
||||
else if (strcasecmp(key, "separator") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "separator"))
|
||||
ffStrbufSetS(&config->keyValueSeparator, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "color") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "color"))
|
||||
{
|
||||
if (yyjson_is_str(val))
|
||||
{
|
||||
@@ -366,7 +367,7 @@ const char* ffParseDisplayJsonConfig(FFinstance* instance)
|
||||
else
|
||||
return "display.color must be either a string or an object";
|
||||
}
|
||||
else if (strcasecmp(key, "binaryPrefix") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "binaryPrefix"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
@@ -378,9 +379,9 @@ const char* ffParseDisplayJsonConfig(FFinstance* instance)
|
||||
if (error) return error;
|
||||
config->binaryPrefixType = (FFBinaryPrefixType) value;
|
||||
}
|
||||
else if (strcasecmp(key, "percentType") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "percentType"))
|
||||
config->percentType = (uint32_t) yyjson_get_uint(val);
|
||||
else if (strcasecmp(key, "noBuffer") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "noBuffer"))
|
||||
config->noBuffer = yyjson_get_bool(val);
|
||||
else
|
||||
return "Unknown display property";
|
||||
@@ -409,53 +410,53 @@ const char* ffParseLibraryJsonConfig(FFinstance* instance)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
|
||||
if (strcasecmp(key, "pci") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "pci"))
|
||||
ffStrbufSetS(&config->libPCI, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "vulkan") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "vulkan"))
|
||||
ffStrbufSetS(&config->libVulkan, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "freetype") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "freetype"))
|
||||
ffStrbufSetS(&config->libfreetype, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "wayland") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "wayland"))
|
||||
ffStrbufSetS(&config->libWayland, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "xcbRandr") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "xcbRandr"))
|
||||
ffStrbufSetS(&config->libXcbRandr, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "xcb") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "xcb"))
|
||||
ffStrbufSetS(&config->libXcb, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "Xrandr") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "Xrandr"))
|
||||
ffStrbufSetS(&config->libXrandr, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "X11") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "X11"))
|
||||
ffStrbufSetS(&config->libX11, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "gio") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "gio"))
|
||||
ffStrbufSetS(&config->libGIO, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "DConf") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "DConf"))
|
||||
ffStrbufSetS(&config->libDConf, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "dbus") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "dbus"))
|
||||
ffStrbufSetS(&config->libDBus, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "XFConf") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "XFConf"))
|
||||
ffStrbufSetS(&config->libXFConf, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "sqlite") == 0 || strcasecmp(key, "sqlite3") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "sqlite") || ffStrEqualsIgnCase(key, "sqlite3"))
|
||||
ffStrbufSetS(&config->libSQLite3, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "rpm") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "rpm"))
|
||||
ffStrbufSetS(&config->librpm, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "imagemagick") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "imagemagick"))
|
||||
ffStrbufSetS(&config->libImageMagick, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "z") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "z"))
|
||||
ffStrbufSetS(&config->libZ, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "chafa") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "chafa"))
|
||||
ffStrbufSetS(&config->libChafa, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "egl") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "egl"))
|
||||
ffStrbufSetS(&config->libEGL, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "glx") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "glx"))
|
||||
ffStrbufSetS(&config->libGLX, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "osmesa") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "osmesa"))
|
||||
ffStrbufSetS(&config->libOSMesa, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "opencl") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "opencl"))
|
||||
ffStrbufSetS(&config->libOpenCL, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "wlanapi") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "wlanapi"))
|
||||
ffStrbufSetS(&config->libwlanapi, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "pulse") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "pulse"))
|
||||
ffStrbufSetS(&config->libPulse, yyjson_get_str(val));
|
||||
else if (strcasecmp(key, "nm") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "nm"))
|
||||
ffStrbufSetS(&config->libnm, yyjson_get_str(val));
|
||||
else
|
||||
return "Unknown library property";
|
||||
|
||||
+8
-8
@@ -28,12 +28,12 @@ const char* ffOptionTestPrefix(const char* argumentKey, const char* moduleName)
|
||||
|
||||
bool ffOptionParseModuleArgs(const char* argumentKey, const char* subKey, const char* value, FFModuleArgs* result)
|
||||
{
|
||||
if(strcasecmp(subKey, "key") == 0)
|
||||
if(ffStrEqualsIgnCase(subKey, "key"))
|
||||
{
|
||||
ffOptionParseString(argumentKey, value, &result->key);
|
||||
return true;
|
||||
}
|
||||
else if(strcasecmp(subKey, "key-color") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "key-color"))
|
||||
{
|
||||
if(value == NULL)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ bool ffOptionParseModuleArgs(const char* argumentKey, const char* subKey, const
|
||||
ffOptionParseColor(value, &result->keyColor);
|
||||
return true;
|
||||
}
|
||||
else if(strcasecmp(subKey, "format") == 0)
|
||||
else if(ffStrEqualsIgnCase(subKey, "format"))
|
||||
{
|
||||
ffOptionParseString(argumentKey, value, &result->outputFormat);
|
||||
return true;
|
||||
@@ -91,7 +91,7 @@ int ffOptionParseEnum(const char* argumentKey, const char* requestedKey, FFKeyVa
|
||||
|
||||
for (const FFKeyValuePair* pPair = pairs; pPair->key; ++pPair)
|
||||
{
|
||||
if(strcasecmp(requestedKey, pPair->key) == 0)
|
||||
if(ffStrEqualsIgnCase(requestedKey, pPair->key))
|
||||
return pPair->value;
|
||||
}
|
||||
|
||||
@@ -103,10 +103,10 @@ bool ffOptionParseBoolean(const char* str)
|
||||
{
|
||||
return (
|
||||
!ffStrSet(str) ||
|
||||
strcasecmp(str, "true") == 0 ||
|
||||
strcasecmp(str, "yes") == 0 ||
|
||||
strcasecmp(str, "on") == 0 ||
|
||||
strcasecmp(str, "1") == 0
|
||||
ffStrEqualsIgnCase(str, "true") ||
|
||||
ffStrEqualsIgnCase(str, "yes") ||
|
||||
ffStrEqualsIgnCase(str, "on") ||
|
||||
ffStrEqualsIgnCase(str, "1")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+160
-165
@@ -53,13 +53,13 @@ static inline void printCommandHelp(const char* command)
|
||||
{
|
||||
if(command == NULL)
|
||||
puts(FASTFETCH_DATATEXT_HELP);
|
||||
else if(strcasecmp(command, "c") == 0 || strcasecmp(command, "color") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "c") || ffStrEqualsIgnCase(command, "color"))
|
||||
puts(FASTFETCH_DATATEXT_HELP_COLOR);
|
||||
else if(strcasecmp(command, "format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "format"))
|
||||
puts(FASTFETCH_DATATEXT_HELP_FORMAT);
|
||||
else if(strcasecmp(command, "load-config") == 0 || strcasecmp(command, "loadconfig") == 0 || strcasecmp(command, "config") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "load-config") || ffStrEqualsIgnCase(command, "loadconfig") || ffStrEqualsIgnCase(command, "config"))
|
||||
puts(FASTFETCH_DATATEXT_HELP_CONFIG);
|
||||
else if(strcasecmp(command, "os-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "os-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("os", "{3} {12}", 12,
|
||||
"System name (typically just Linux)",
|
||||
@@ -76,7 +76,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Architecture of the OS"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "host-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "host-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("host", "{2} {3}", 8,
|
||||
"product family",
|
||||
@@ -89,7 +89,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"sys vendor"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "bios-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "bios-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("bios", "{2} {3}", 4,
|
||||
"bios date",
|
||||
@@ -98,7 +98,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"bios version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "board-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "board-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("board", "{2} {3}", 3,
|
||||
"board name",
|
||||
@@ -106,7 +106,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"board version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "chassis-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "chassis-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("chassis", "{2} {3}", 4,
|
||||
"chassis type",
|
||||
@@ -114,7 +114,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"chassis version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "kernel-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "kernel-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("kernel", "{2}", 3,
|
||||
"Kernel sysname",
|
||||
@@ -122,7 +122,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Kernel version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "uptime-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "uptime-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("uptime", "{} days {} hours {} mins", 4,
|
||||
"Days",
|
||||
@@ -131,13 +131,13 @@ static inline void printCommandHelp(const char* command)
|
||||
"Seconds"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "processes-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "processes-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("processes", "{}", 1,
|
||||
"Count"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "packages-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "packages-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("packages", "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (port), {20} (scoop), {21} (choco)", 21,
|
||||
"Number of all packages",
|
||||
@@ -163,7 +163,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Number of choco packages"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "shell-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "shell-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("shell", "{3} {4}", 7,
|
||||
"Shell process name",
|
||||
@@ -175,7 +175,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"User shell version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "display-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "display-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("display", "{}x{} @ {}Hz", 7,
|
||||
"Screen width",
|
||||
@@ -188,7 +188,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Screen rotation"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "de-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "de-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("de", "{2} {3}", 3,
|
||||
"DE process name",
|
||||
@@ -196,7 +196,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"DE version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "wm-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "wm-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wm", "{2} ({3})", 3,
|
||||
"WM process name",
|
||||
@@ -204,31 +204,31 @@ static inline void printCommandHelp(const char* command)
|
||||
"WM protocol name"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "wm-theme-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "wm-theme-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wm-theme", "{}", 1,
|
||||
"WM theme name"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "theme-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "theme-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("theme", "{}", 1,
|
||||
"Combined themes"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "icons-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "icons-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("icons", "{}", 1,
|
||||
"Combined icons"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "wallpaper-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "wallpaper-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wallpaper", "{}", 1,
|
||||
"Wallpaper image file"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "font-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "font-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("font", "{} [QT], {} [GTK2], {} [GTK3], {} [GTK4]", 4,
|
||||
"Font 1",
|
||||
@@ -237,14 +237,14 @@ static inline void printCommandHelp(const char* command)
|
||||
"Font 4"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "cursor-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "cursor-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("cursor", "{} ({}pt)", 2,
|
||||
"Cursor theme",
|
||||
"Cursor size"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "terminal-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "terminal-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("terminal", "{3}", 10,
|
||||
"Terminal process name",
|
||||
@@ -259,7 +259,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"User shell version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "terminal-font-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "terminal-font-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("terminal-font", "{}", 4,
|
||||
"Terminal font",
|
||||
@@ -268,7 +268,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Terminal font styles"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "cpu-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "cpu-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("cpu", "{1} ({5}) @ {7}GHz", 8,
|
||||
"Name",
|
||||
@@ -281,13 +281,13 @@ static inline void printCommandHelp(const char* command)
|
||||
"Temperature"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "cpu-usage-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "cpu-usage-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("cpu-usage", "{0}%", 1,
|
||||
"CPU usage without percent mark"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "gpu-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "gpu-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("gpu", "{} {}", 6,
|
||||
"GPU vendor",
|
||||
@@ -298,7 +298,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"GPU type"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "memory-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "memory-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("memory", "{} / {} ({}%)", 3,
|
||||
"Used size",
|
||||
@@ -306,7 +306,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Percentage used"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "swap-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "swap-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("swap", "{} / {} ({}%)", 3,
|
||||
"Used size",
|
||||
@@ -314,7 +314,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Percentage used"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "disk-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "disk-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("disk", "{1} / {2} ({3}%)", 9,
|
||||
"Size used",
|
||||
@@ -328,7 +328,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Filesystem"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "battery-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "battery-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("battery", "{}%, {}", 5,
|
||||
"Battery manufactor",
|
||||
@@ -338,7 +338,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Battery status"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "poweradapter-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "poweradapter-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("poweradapter", "{}%, {}", 5,
|
||||
"PowerAdapter watts",
|
||||
@@ -348,25 +348,25 @@ static inline void printCommandHelp(const char* command)
|
||||
"PowerAdapter description"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "locale-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "locale-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("locale", "{}", 1,
|
||||
"Locale code"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "local-ip-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "local-ip-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("local-ip", "{}", 1,
|
||||
"Local IP address"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "public-ip-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "public-ip-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("public-ip", "{}", 1,
|
||||
"Public IP address"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "wifi-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "wifi-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wifi", "{4} - {6}", 3,
|
||||
"Interface description",
|
||||
@@ -381,7 +381,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Connection Security algorithm"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "player-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "player-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("player", "{}", 4,
|
||||
"Pretty player name",
|
||||
@@ -390,7 +390,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"URL name"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "media-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "media-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("media", "{3} - {1}", 4,
|
||||
"Pretty media name",
|
||||
@@ -399,7 +399,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Album name"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "datetime-format") == 0 || strcasecmp(command, "date-format") == 0 || strcasecmp(command, "time-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "datetime-format") == 0 || ffStrEqualsIgnCase(command, "date-format") || ffStrEqualsIgnCase(command, "time-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("[date][time]", "{1}-{4}-{11} {14}:{18}:{20}", 20,
|
||||
"year",
|
||||
@@ -424,7 +424,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"second with leading zero"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "vulkan-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "vulkan-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("vulkan", "{} (driver), {} (api version)", 3,
|
||||
"Driver name",
|
||||
@@ -432,7 +432,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Conformance version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "opengl-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "opengl-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("opengl", "{}", 3,
|
||||
"version",
|
||||
@@ -441,7 +441,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"shading language version"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "opencl-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "opencl-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("opencl", "{}", 3,
|
||||
"version",
|
||||
@@ -449,7 +449,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"vendor"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "bluetooth-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "bluetooth-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("bluetooth", "{1} (4%)", 4,
|
||||
"Name",
|
||||
@@ -458,7 +458,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Battery percentage"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "sound-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "sound-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("sound", "{2} (3%)", 4,
|
||||
"Main",
|
||||
@@ -467,7 +467,7 @@ static inline void printCommandHelp(const char* command)
|
||||
"Identifier"
|
||||
);
|
||||
}
|
||||
else if(strcasecmp(command, "gamepad-format") == 0)
|
||||
else if(ffStrEqualsIgnCase(command, "gamepad-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("gamepad", "{1}", 1,
|
||||
"Name",
|
||||
@@ -681,23 +681,18 @@ static inline void optionCheckString(const char* key, const char* value, FFstrbu
|
||||
ffStrbufEnsureFree(buffer, 63); //This is not needed, as ffStrbufSetS will resize capacity if needed, but giving a higher start should improve performance
|
||||
}
|
||||
|
||||
static inline bool startsWith(const char* str, const char* compareTo)
|
||||
{
|
||||
return strncasecmp(str, compareTo, strlen(compareTo)) == 0;
|
||||
}
|
||||
|
||||
static void parseOption(FFinstance* instance, FFdata* data, const char* key, const char* value)
|
||||
{
|
||||
///////////////////////
|
||||
//Informative options//
|
||||
///////////////////////
|
||||
|
||||
if(strcasecmp(key, "-h") == 0 || strcasecmp(key, "--help") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "-h") || ffStrEqualsIgnCase(key, "--help"))
|
||||
{
|
||||
printCommandHelp(value);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(key, "-v") == 0 || strcasecmp(key, "--version") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "-v") || ffStrEqualsIgnCase(key, "--version"))
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
#define FF_BUILD_TYPE "-debug"
|
||||
@@ -732,30 +727,30 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(key, "--version-raw") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--version-raw"))
|
||||
{
|
||||
puts(FASTFETCH_PROJECT_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
else if(startsWith(key, "--print"))
|
||||
else if(ffStrStartsWithIgnCase(key, "--print"))
|
||||
{
|
||||
const char* subkey = key + strlen("--print");
|
||||
if(strcasecmp(subkey, "-config-system") == 0)
|
||||
if(ffStrEqualsIgnCase(subkey, "-config-system"))
|
||||
{
|
||||
puts(FASTFETCH_DATATEXT_CONFIG_SYSTEM);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-config-user") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-config-user"))
|
||||
{
|
||||
puts(FASTFETCH_DATATEXT_CONFIG_USER);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-structure") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-structure"))
|
||||
{
|
||||
puts(FASTFETCH_DATATEXT_STRUCTURE);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-logos") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-logos"))
|
||||
{
|
||||
ffLogoBuiltinPrint(instance);
|
||||
exit(0);
|
||||
@@ -763,35 +758,35 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
else
|
||||
goto error;
|
||||
}
|
||||
else if(startsWith(key, "--list"))
|
||||
else if(ffStrStartsWithIgnCase(key, "--list"))
|
||||
{
|
||||
const char* subkey = key + strlen("--list");
|
||||
if(strcasecmp(subkey, "-modules") == 0)
|
||||
if(ffStrEqualsIgnCase(subkey, "-modules"))
|
||||
{
|
||||
puts(FASTFETCH_DATATEXT_MODULES);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-presets") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-presets"))
|
||||
{
|
||||
listAvailablePresets(instance);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-config-paths") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-config-paths"))
|
||||
{
|
||||
listConfigPaths(instance);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-data-paths") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-data-paths"))
|
||||
{
|
||||
listDataPaths(instance);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-features") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-features"))
|
||||
{
|
||||
ffListFeatures();
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-logos") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-logos"))
|
||||
{
|
||||
puts("Builtin logos:");
|
||||
ffLogoBuiltinList();
|
||||
@@ -799,7 +794,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
listAvailableLogos(instance);
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(subkey, "-logos-autocompletion") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-logos-autocompletion"))
|
||||
{
|
||||
ffLogoBuiltinListAutocompletion();
|
||||
exit(0);
|
||||
@@ -812,34 +807,34 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
//General options//
|
||||
///////////////////
|
||||
|
||||
else if(strcasecmp(key, "-r") == 0 || strcasecmp(key, "--recache") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "-r") || ffStrEqualsIgnCase(key, "--recache"))
|
||||
instance->config.recache = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--load-config") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--load-config"))
|
||||
optionParseConfigFile(instance, data, key, value);
|
||||
else if(strcasecmp(key, "--gen-config") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--gen-config"))
|
||||
generateConfigFile(instance, false);
|
||||
else if(strcasecmp(key, "--gen-config-force") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--gen-config-force"))
|
||||
generateConfigFile(instance, true);
|
||||
else if(strcasecmp(key, "--thread") == 0 || strcasecmp(key, "--multithreading") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--thread") || ffStrEqualsIgnCase(key, "--multithreading"))
|
||||
instance->config.multithreading = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--stat") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--stat"))
|
||||
{
|
||||
if((instance->config.stat = ffOptionParseBoolean(value)))
|
||||
instance->config.showErrors = true;
|
||||
}
|
||||
else if(strcasecmp(key, "--allow-slow-operations") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--allow-slow-operations"))
|
||||
instance->config.allowSlowOperations = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--escape-bedrock") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--escape-bedrock"))
|
||||
instance->config.escapeBedrock = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--pipe") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--pipe"))
|
||||
instance->config.pipe = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--load-user-config") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--load-user-config"))
|
||||
data->loadUserConfig = ffOptionParseBoolean(value);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
else if(strcasecmp(key, "--player-name") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--player-name"))
|
||||
ffOptionParseString(key, value, &instance->config.playerName);
|
||||
else if (strcasecmp(key, "--os-file") == 0)
|
||||
else if (ffStrEqualsIgnCase(key, "--os-file"))
|
||||
ffOptionParseString(key, value, &instance->config.osFile);
|
||||
#endif
|
||||
|
||||
@@ -853,33 +848,33 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
//Display options//
|
||||
///////////////////
|
||||
|
||||
else if(strcasecmp(key, "--show-errors") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--show-errors"))
|
||||
instance->config.showErrors = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--disable-linewrap") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--disable-linewrap"))
|
||||
instance->config.disableLinewrap = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--hide-cursor") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--hide-cursor"))
|
||||
instance->config.hideCursor = ffOptionParseBoolean(value);
|
||||
else if(strcasecmp(key, "-s") == 0 || strcasecmp(key, "--structure") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "-s") || ffStrEqualsIgnCase(key, "--structure"))
|
||||
ffOptionParseString(key, value, &data->structure);
|
||||
else if(strcasecmp(key, "--separator") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--separator"))
|
||||
ffOptionParseString(key, value, &instance->config.keyValueSeparator);
|
||||
else if(strcasecmp(key, "--color-keys") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--color-keys"))
|
||||
{
|
||||
optionCheckString(key, value, &instance->config.colorKeys);
|
||||
ffOptionParseColor(value, &instance->config.colorKeys);
|
||||
}
|
||||
else if(strcasecmp(key, "--color-title") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--color-title"))
|
||||
{
|
||||
optionCheckString(key, value, &instance->config.colorTitle);
|
||||
ffOptionParseColor(value, &instance->config.colorTitle);
|
||||
}
|
||||
else if(strcasecmp(key, "-c") == 0 || strcasecmp(key, "--color") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "-c") || ffStrEqualsIgnCase(key, "--color"))
|
||||
{
|
||||
optionCheckString(key, value, &instance->config.colorKeys);
|
||||
ffOptionParseColor(value, &instance->config.colorKeys);
|
||||
ffStrbufSet(&instance->config.colorTitle, &instance->config.colorKeys);
|
||||
}
|
||||
else if(strcasecmp(key, "--binary-prefix") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--binary-prefix"))
|
||||
{
|
||||
instance->config.binaryPrefixType = (FFBinaryPrefixType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "iec", FF_BINARY_PREFIX_TYPE_IEC },
|
||||
@@ -888,9 +883,9 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
{}
|
||||
});
|
||||
}
|
||||
else if(strcasecmp(key, "--percent-type") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--percent-type"))
|
||||
instance->config.percentType = ffOptionParseUInt32(key, value);
|
||||
else if(strcasecmp(key, "--no-buffer") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "--no-buffer"))
|
||||
instance->config.noBuffer = ffOptionParseBoolean(value);
|
||||
|
||||
///////////////////////
|
||||
@@ -951,56 +946,56 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
//Library options//
|
||||
///////////////////
|
||||
|
||||
else if(startsWith(key, "--lib"))
|
||||
else if(ffStrStartsWithIgnCase(key, "--lib"))
|
||||
{
|
||||
const char* subkey = key + strlen("--lib");
|
||||
if(strcasecmp(subkey, "-PCI") == 0)
|
||||
if(ffStrEqualsIgnCase(subkey, "-PCI"))
|
||||
ffOptionParseString(key, value, &instance->config.libPCI);
|
||||
else if(strcasecmp(subkey, "-vulkan") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-vulkan"))
|
||||
ffOptionParseString(key, value, &instance->config.libVulkan);
|
||||
else if(strcasecmp(subkey, "-freetype") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-freetype"))
|
||||
ffOptionParseString(key, value, &instance->config.libfreetype);
|
||||
else if(strcasecmp(subkey, "-wayland") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-wayland"))
|
||||
ffOptionParseString(key, value, &instance->config.libWayland);
|
||||
else if(strcasecmp(subkey, "-xcb-randr") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-xcb-randr"))
|
||||
ffOptionParseString(key, value, &instance->config.libXcbRandr);
|
||||
else if(strcasecmp(subkey, "-xcb") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-xcb"))
|
||||
ffOptionParseString(key, value, &instance->config.libXcb);
|
||||
else if(strcasecmp(subkey, "-Xrandr") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-Xrandr"))
|
||||
ffOptionParseString(key, value, &instance->config.libXrandr);
|
||||
else if(strcasecmp(subkey, "-X11") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-X11"))
|
||||
ffOptionParseString(key, value, &instance->config.libX11);
|
||||
else if(strcasecmp(subkey, "-gio") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-gio"))
|
||||
ffOptionParseString(key, value, &instance->config.libGIO);
|
||||
else if(strcasecmp(subkey, "-DConf") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-DConf"))
|
||||
ffOptionParseString(key, value, &instance->config.libDConf);
|
||||
else if(strcasecmp(subkey, "-dbus") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-dbus"))
|
||||
ffOptionParseString(key, value, &instance->config.libDBus);
|
||||
else if(strcasecmp(subkey, "-XFConf") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-XFConf"))
|
||||
ffOptionParseString(key, value, &instance->config.libXFConf);
|
||||
else if(strcasecmp(subkey, "-sqlite") == 0 || strcasecmp(subkey, "-sqlite3") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-sqlite") || ffStrEqualsIgnCase(subkey, "-sqlite3"))
|
||||
ffOptionParseString(key, value, &instance->config.libSQLite3);
|
||||
else if(strcasecmp(subkey, "-rpm") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-rpm"))
|
||||
ffOptionParseString(key, value, &instance->config.librpm);
|
||||
else if(strcasecmp(subkey, "-imagemagick") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-imagemagick"))
|
||||
ffOptionParseString(key, value, &instance->config.libImageMagick);
|
||||
else if(strcasecmp(subkey, "-z") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-z"))
|
||||
ffOptionParseString(key, value, &instance->config.libZ);
|
||||
else if(strcasecmp(subkey, "-chafa") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-chafa"))
|
||||
ffOptionParseString(key, value, &instance->config.libChafa);
|
||||
else if(strcasecmp(subkey, "-egl") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-egl"))
|
||||
ffOptionParseString(key, value, &instance->config.libEGL);
|
||||
else if(strcasecmp(subkey, "-glx") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-glx"))
|
||||
ffOptionParseString(key, value, &instance->config.libGLX);
|
||||
else if(strcasecmp(subkey, "-osmesa") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-osmesa"))
|
||||
ffOptionParseString(key, value, &instance->config.libOSMesa);
|
||||
else if(strcasecmp(subkey, "-opencl") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-opencl"))
|
||||
ffOptionParseString(key, value, &instance->config.libOpenCL);
|
||||
else if(strcasecmp(subkey, "-wlanapi") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-wlanapi"))
|
||||
ffOptionParseString(key, value, &instance->config.libwlanapi);
|
||||
else if(strcasecmp(key, "-pulse") == 0)
|
||||
else if(ffStrEqualsIgnCase(key, "-pulse"))
|
||||
ffOptionParseString(key, value, &instance->config.libPulse);
|
||||
else if(strcasecmp(subkey, "-nm") == 0)
|
||||
else if(ffStrEqualsIgnCase(subkey, "-nm"))
|
||||
ffOptionParseString(key, value, &instance->config.libnm);
|
||||
else
|
||||
goto error;
|
||||
@@ -1068,107 +1063,107 @@ static void parseArguments(FFinstance* instance, FFdata* data, int argc, const c
|
||||
|
||||
static void parseStructureCommand(FFinstance* instance, const char* line)
|
||||
{
|
||||
if(strcasecmp(line, FF_BREAK_MODULE_NAME) == 0)
|
||||
if(ffStrEqualsIgnCase(line, FF_BREAK_MODULE_NAME))
|
||||
ffPrintBreak(instance);
|
||||
else if(strcasecmp(line, FF_TITLE_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_TITLE_MODULE_NAME))
|
||||
ffPrintTitle(instance, &instance->config.title);
|
||||
else if(strcasecmp(line, FF_SEPARATOR_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_SEPARATOR_MODULE_NAME))
|
||||
ffPrintSeparator(instance, &instance->config.separator);
|
||||
else if(strcasecmp(line, FF_OS_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_OS_MODULE_NAME))
|
||||
ffPrintOS(instance, &instance->config.os);
|
||||
else if(strcasecmp(line, FF_HOST_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_HOST_MODULE_NAME))
|
||||
ffPrintHost(instance, &instance->config.host);
|
||||
else if(strcasecmp(line, FF_BIOS_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_BIOS_MODULE_NAME))
|
||||
ffPrintBios(instance, &instance->config.bios);
|
||||
else if(strcasecmp(line, FF_BOARD_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_BOARD_MODULE_NAME))
|
||||
ffPrintBoard(instance, &instance->config.board);
|
||||
else if(strcasecmp(line, FF_BRIGHTNESS_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_BRIGHTNESS_MODULE_NAME))
|
||||
ffPrintBrightness(instance, &instance->config.brightness);
|
||||
else if(strcasecmp(line, FF_CHASSIS_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_CHASSIS_MODULE_NAME))
|
||||
ffPrintChassis(instance, &instance->config.chassis);
|
||||
else if(strcasecmp(line, FF_KERNEL_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_KERNEL_MODULE_NAME))
|
||||
ffPrintKernel(instance, &instance->config.kernel);
|
||||
else if(strcasecmp(line, FF_PROCESSES_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_PROCESSES_MODULE_NAME))
|
||||
ffPrintProcesses(instance, &instance->config.processes);
|
||||
else if(strcasecmp(line, FF_UPTIME_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_UPTIME_MODULE_NAME))
|
||||
ffPrintUptime(instance, &instance->config.uptime);
|
||||
else if(strcasecmp(line, FF_PACKAGES_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_PACKAGES_MODULE_NAME))
|
||||
ffPrintPackages(instance, &instance->config.packages);
|
||||
else if(strcasecmp(line, FF_SHELL_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_SHELL_MODULE_NAME))
|
||||
ffPrintShell(instance, &instance->config.shell);
|
||||
else if(strcasecmp(line, FF_DISPLAY_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_DISPLAY_MODULE_NAME))
|
||||
ffPrintDisplay(instance, &instance->config.display);
|
||||
else if(strcasecmp(line, FF_DE_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_DE_MODULE_NAME))
|
||||
ffPrintDE(instance, &instance->config.de);
|
||||
else if(strcasecmp(line, FF_WM_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_WM_MODULE_NAME))
|
||||
ffPrintWM(instance, &instance->config.wm);
|
||||
else if(strcasecmp(line, FF_THEME_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_THEME_MODULE_NAME))
|
||||
ffPrintTheme(instance, &instance->config.theme);
|
||||
else if(strcasecmp(line, FF_WMTHEME_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_WMTHEME_MODULE_NAME))
|
||||
ffPrintWMTheme(instance, &instance->config.wmTheme);
|
||||
else if(strcasecmp(line, FF_ICONS_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_ICONS_MODULE_NAME))
|
||||
ffPrintIcons(instance, &instance->config.icons);
|
||||
else if(strcasecmp(line, FF_WALLPAPER_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_WALLPAPER_MODULE_NAME))
|
||||
ffPrintWallpaper(instance, &instance->config.wallpaper);
|
||||
else if(strcasecmp(line, FF_FONT_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_FONT_MODULE_NAME))
|
||||
ffPrintFont(instance, &instance->config.font);
|
||||
else if(strcasecmp(line, FF_CURSOR_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_CURSOR_MODULE_NAME))
|
||||
ffPrintCursor(instance, &instance->config.cursor);
|
||||
else if(strcasecmp(line, FF_TERMINAL_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_TERMINAL_MODULE_NAME))
|
||||
ffPrintTerminal(instance, &instance->config.terminal);
|
||||
else if(strcasecmp(line, FF_TERMINALFONT_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_TERMINALFONT_MODULE_NAME))
|
||||
ffPrintTerminalFont(instance, &instance->config.terminalFont);
|
||||
else if(strcasecmp(line, FF_CPU_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_CPU_MODULE_NAME))
|
||||
ffPrintCPU(instance, &instance->config.cpu);
|
||||
else if(strcasecmp(line, FF_CPUUSAGE_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_CPUUSAGE_MODULE_NAME))
|
||||
ffPrintCPUUsage(instance, &instance->config.cpuUsage);
|
||||
else if(strcasecmp(line, FF_CUSTOM_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_CUSTOM_MODULE_NAME))
|
||||
ffPrintCustom(instance, &instance->config.custom);
|
||||
else if(strcasecmp(line, FF_GPU_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_GPU_MODULE_NAME))
|
||||
ffPrintGPU(instance, &instance->config.gpu);
|
||||
else if(strcasecmp(line, FF_MEMORY_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_MEMORY_MODULE_NAME))
|
||||
ffPrintMemory(instance, &instance->config.memory);
|
||||
else if(strcasecmp(line, FF_SWAP_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_SWAP_MODULE_NAME))
|
||||
ffPrintSwap(instance, &instance->config.swap);
|
||||
else if(strcasecmp(line, FF_DISK_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_DISK_MODULE_NAME))
|
||||
ffPrintDisk(instance, &instance->config.disk);
|
||||
else if(strcasecmp(line, FF_BATTERY_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_BATTERY_MODULE_NAME))
|
||||
ffPrintBattery(instance, &instance->config.battery);
|
||||
else if(strcasecmp(line, FF_POWERADAPTER_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_POWERADAPTER_MODULE_NAME))
|
||||
ffPrintPowerAdapter(instance, &instance->config.powerAdapter);
|
||||
else if(strcasecmp(line, FF_LOCALE_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_LOCALE_MODULE_NAME))
|
||||
ffPrintLocale(instance, &instance->config.locale);
|
||||
else if(strcasecmp(line, FF_LOCALIP_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_LOCALIP_MODULE_NAME))
|
||||
ffPrintLocalIp(instance, &instance->config.localIP);
|
||||
else if(strcasecmp(line, FF_PUBLICIP_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_PUBLICIP_MODULE_NAME))
|
||||
ffPrintPublicIp(instance, &instance->config.publicIP);
|
||||
else if(strcasecmp(line, FF_WIFI_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_WIFI_MODULE_NAME))
|
||||
ffPrintWifi(instance, &instance->config.wifi);
|
||||
else if(strcasecmp(line, FF_WEATHER_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_WEATHER_MODULE_NAME))
|
||||
ffPrintWeather(instance, &instance->config.weather);
|
||||
else if(strcasecmp(line, FF_PLAYER_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_PLAYER_MODULE_NAME))
|
||||
ffPrintPlayer(instance, &instance->config.player);
|
||||
else if(strcasecmp(line, FF_MEDIA_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_MEDIA_MODULE_NAME))
|
||||
ffPrintMedia(instance, &instance->config.media);
|
||||
else if(strcasecmp(line, FF_DATETIME_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_DATETIME_MODULE_NAME))
|
||||
ffPrintDateTime(instance, &instance->config.dateTime);
|
||||
else if(strcasecmp(line, FF_COLORS_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_COLORS_MODULE_NAME))
|
||||
ffPrintColors(instance, &instance->config.colors);
|
||||
else if(strcasecmp(line, FF_VULKAN_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_VULKAN_MODULE_NAME))
|
||||
ffPrintVulkan(instance, &instance->config.vulkan);
|
||||
else if(strcasecmp(line, FF_OPENGL_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_OPENGL_MODULE_NAME))
|
||||
ffPrintOpenGL(instance, &instance->config.openGL);
|
||||
else if(strcasecmp(line, FF_OPENCL_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_OPENCL_MODULE_NAME))
|
||||
ffPrintOpenCL(instance, &instance->config.openCL);
|
||||
else if(strcasecmp(line, FF_USERS_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_USERS_MODULE_NAME))
|
||||
ffPrintUsers(instance, &instance->config.users);
|
||||
else if(strcasecmp(line, FF_COMMAND_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_COMMAND_MODULE_NAME))
|
||||
ffPrintCommand(instance, &instance->config.command);
|
||||
else if(strcasecmp(line, FF_BLUETOOTH_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_BLUETOOTH_MODULE_NAME))
|
||||
ffPrintBluetooth(instance, &instance->config.bluetooth);
|
||||
else if(strcasecmp(line, FF_SOUND_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_SOUND_MODULE_NAME))
|
||||
ffPrintSound(instance, &instance->config.sound);
|
||||
else if(strcasecmp(line, FF_GAMEPAD_MODULE_NAME) == 0)
|
||||
else if(ffStrEqualsIgnCase(line, FF_GAMEPAD_MODULE_NAME))
|
||||
ffPrintGamepad(instance, &instance->config.gamepad);
|
||||
else
|
||||
ffPrintErrorString(instance, line, 0, NULL, NULL, "<no implementation provided>");
|
||||
|
||||
+3
-3
@@ -289,17 +289,17 @@ const char* ffParseLogoJsonConfig(FFinstance* instance)
|
||||
#undef FF_PARSE_PADDING_POSITON
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "printRemaining"))
|
||||
else if (strcasecmp(key, "printRemaining") == 0)
|
||||
{
|
||||
options->printRemaining = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "preserveAspectRadio"))
|
||||
else if (strcasecmp(key, "preserveAspectRadio") == 0)
|
||||
{
|
||||
options->preserveAspectRadio = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
else if (strcasecmp(key, "chafa"))
|
||||
else if (strcasecmp(key, "chafa") == 0)
|
||||
{
|
||||
if (!yyjson_is_obj(val))
|
||||
return "Chafa config must be an object";
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "common/bar.h"
|
||||
#include "detection/battery/battery.h"
|
||||
#include "modules/battery/battery.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_BATTERY_NUM_FORMAT_ARGS 5
|
||||
|
||||
@@ -119,14 +120,14 @@ bool ffParseBatteryCommandOptions(FFBatteryOptions* options, const char* key, co
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "temp") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "temp"))
|
||||
{
|
||||
options->temp = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
if (strcasecmp(subKey, "dir") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "dir"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->dir);
|
||||
return true;
|
||||
@@ -157,21 +158,21 @@ void ffParseBatteryJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
#ifdef __linux__
|
||||
if (strcasecmp(key, "dir") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "dir"))
|
||||
{
|
||||
ffStrbufSetS(&options.dir, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcasecmp(key, "temp") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options.temp = yyjson_get_bool(val);
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/bios/bios.h"
|
||||
#include "modules/bios/bios.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_BIOS_NUM_FORMAT_ARGS 4
|
||||
|
||||
@@ -82,7 +83,7 @@ void ffParseBiosJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/bluetooth/bluetooth.h"
|
||||
#include "modules/bluetooth/bluetooth.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_BLUETOOTH_NUM_FORMAT_ARGS 4
|
||||
|
||||
@@ -83,7 +84,7 @@ bool ffParseBluetoothCommandOptions(FFBluetoothOptions* options, const char* key
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "show-disconnected") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-disconnected"))
|
||||
options->showDisconnected = ffOptionParseBoolean(value);
|
||||
return false;
|
||||
}
|
||||
@@ -105,13 +106,13 @@ void ffParseBluetoothJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "showDisconnected") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showDisconnected"))
|
||||
{
|
||||
options.showDisconnected = yyjson_get_bool(val);
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/board/board.h"
|
||||
#include "modules/board/board.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_BOARD_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -76,7 +77,7 @@ void ffParseBoardJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/brightness/brightness.h"
|
||||
#include "modules/brightness/brightness.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_BRIGHTNESS_NUM_FORMAT_ARGS 2
|
||||
|
||||
@@ -89,7 +90,7 @@ void ffParseBrightnessJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/chassis/chassis.h"
|
||||
#include "modules/chassis/chassis.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_CHASSIS_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -85,7 +86,7 @@ void ffParseChassisJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "modules/colors/colors.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPrintColors(FFinstance* instance, FFColorsOptions* options)
|
||||
{
|
||||
@@ -59,7 +60,7 @@ bool ffParseColorsCommandOptions(FFColorsOptions* options, const char* key, cons
|
||||
const char* subKey = ffOptionTestPrefix(key, FF_COLORS_MODULE_NAME);
|
||||
if (!subKey) return false;
|
||||
|
||||
if (strcasecmp(subKey, "symbol") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "symbol"))
|
||||
{
|
||||
options->symbol = (FFColorssymbol) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "block", FF_COLORS_SYMBOL_BLOCK },
|
||||
@@ -92,10 +93,10 @@ void ffParseColorsJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "symbol") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "symbol"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "common/processing.h"
|
||||
#include "modules/command/command.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPrintCommand(FFinstance* instance, FFCommandOptions* options)
|
||||
{
|
||||
@@ -58,13 +59,13 @@ bool ffParseCommandCommandOptions(FFCommandOptions* options, const char* key, co
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if(strcasecmp(subKey, "shell") == 0)
|
||||
if(ffStrEqualsIgnCase(subKey, "shell"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->shell);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(strcasecmp(subKey, "text") == 0)
|
||||
if(ffStrEqualsIgnCase(subKey, "text"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->text);
|
||||
return true;
|
||||
@@ -92,19 +93,19 @@ void ffParseCommandJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "shell") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "shell"))
|
||||
{
|
||||
ffStrbufSetS(&options.shell, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "text") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "text"))
|
||||
{
|
||||
ffStrbufSetS(&options.text, yyjson_get_str(val));
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/cpu/cpu.h"
|
||||
#include "modules/cpu/cpu.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_CPU_NUM_FORMAT_ARGS 8
|
||||
|
||||
@@ -84,7 +85,7 @@ bool ffParseCPUCommandOptions(FFCPUOptions* options, const char* key, const char
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "temp") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "temp"))
|
||||
{
|
||||
options->temp = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
@@ -110,13 +111,13 @@ void ffParseCPUJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "temp") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options.temp = yyjson_get_bool(val);
|
||||
continue;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "common/bar.h"
|
||||
#include "detection/cpuusage/cpuusage.h"
|
||||
#include "modules/cpuusage/cpuusage.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_CPUUSAGE_DISPLAY_NAME "CPU Usage"
|
||||
#define FF_CPUUSAGE_NUM_FORMAT_ARGS 1
|
||||
@@ -74,7 +75,7 @@ void ffParseCPUUsageJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/cursor/cursor.h"
|
||||
#include "modules/cursor/cursor.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_CURSOR_NUM_FORMAT_ARGS 2
|
||||
|
||||
@@ -82,7 +83,7 @@ void ffParseCursorJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "modules/custom/custom.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPrintCustom(FFinstance* instance, FFCustomOptions* options)
|
||||
{
|
||||
@@ -49,7 +50,7 @@ void ffParseCustomJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/datetime/datetime.h"
|
||||
#include "modules/datetime/datetime.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_DATETIME_DISPLAY_NAME "Date & Time"
|
||||
#define FF_DATETIME_NUM_FORMAT_ARGS 20
|
||||
@@ -81,7 +82,7 @@ void ffParseDateTimeJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "modules/de/de.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_DE_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -72,7 +73,7 @@ void ffParseDEJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
+13
-12
@@ -4,6 +4,7 @@
|
||||
#include "common/bar.h"
|
||||
#include "detection/disk/disk.h"
|
||||
#include "modules/disk/disk.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_DISK_NUM_FORMAT_ARGS 10
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
@@ -184,13 +185,13 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "folders") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "folders"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->folders);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-regular") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-regular"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_REGULAR_BIT;
|
||||
@@ -199,7 +200,7 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-external") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-external"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
@@ -208,7 +209,7 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-hidden") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-hidden"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
|
||||
@@ -217,7 +218,7 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-subvolumes") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-subvolumes"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
@@ -226,7 +227,7 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-unknown") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-unknown"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
@@ -255,19 +256,19 @@ void ffParseDiskJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "folders") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "folders"))
|
||||
{
|
||||
ffStrbufSetS(&options.folders, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "showExternal") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showExternal"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
@@ -276,7 +277,7 @@ void ffParseDiskJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "showHidden") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showHidden"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
|
||||
@@ -285,7 +286,7 @@ void ffParseDiskJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "showSubvolumes") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showSubvolumes"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
@@ -294,7 +295,7 @@ void ffParseDiskJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "showUnknown") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showUnknown"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "modules/display/display.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_DISPLAY_NUM_FORMAT_ARGS 8
|
||||
|
||||
@@ -127,7 +128,7 @@ bool ffParseDisplayCommandOptions(FFDisplayOptions* options, const char* key, co
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "compact-type") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "compact-type"))
|
||||
{
|
||||
options->compactType = (FFDisplayCompactType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "none", FF_DISPLAY_COMPACT_TYPE_NONE },
|
||||
@@ -138,13 +139,13 @@ bool ffParseDisplayCommandOptions(FFDisplayOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "detect-name") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "detect-name"))
|
||||
{
|
||||
options->detectName = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "precise-refresh-rate") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "precise-refresh-rate"))
|
||||
{
|
||||
options->preciseRefreshRate = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
@@ -170,13 +171,13 @@ void ffParseDisplayJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "compactType") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "compactType"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
@@ -192,13 +193,13 @@ void ffParseDisplayJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "detectName") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "detectName"))
|
||||
{
|
||||
options.detectName = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "preciseRefreshRate") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "preciseRefreshRate"))
|
||||
{
|
||||
options.preciseRefreshRate = yyjson_get_bool(val);
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/font/font.h"
|
||||
#include "modules/font/font.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_FONT_NUM_FORMAT_ARGS (FF_DETECT_FONT_NUM_FONTS + 1)
|
||||
|
||||
@@ -75,7 +76,7 @@ void ffParseFontJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/gamepad/gamepad.h"
|
||||
#include "modules/gamepad/gamepad.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_GAMEPAD_NUM_FORMAT_ARGS 2
|
||||
|
||||
@@ -81,7 +82,7 @@ void ffParseGamepadJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "detection/host/host.h"
|
||||
#include "detection/gpu/gpu.h"
|
||||
#include "modules/gpu/gpu.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -128,19 +129,19 @@ bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "force-vulkan") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "force-vulkan"))
|
||||
{
|
||||
options->forceVulkan = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "temp") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "temp"))
|
||||
{
|
||||
options->temp = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "hide-type") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "hide-type"))
|
||||
{
|
||||
options->hideType = (FFGPUType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "none", FF_GPU_TYPE_UNKNOWN },
|
||||
@@ -170,25 +171,25 @@ void ffParseGPUJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "temp") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options.temp = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "forceVulkan") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "forceVulkan"))
|
||||
{
|
||||
options.forceVulkan = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "hideType") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "hideType"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/host/host.h"
|
||||
#include "modules/host/host.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_HOST_NUM_FORMAT_ARGS 5
|
||||
|
||||
@@ -92,7 +93,7 @@ void ffParseHostJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/icons/icons.h"
|
||||
#include "modules/icons/icons.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_ICONS_NUM_FORMAT_ARGS 1
|
||||
|
||||
@@ -62,7 +63,7 @@ void ffParseIconsJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "modules/kernel/kernel.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_KERNEL_NUM_FORMAT_ARGS 4
|
||||
|
||||
@@ -62,7 +63,7 @@ void ffParseKernelJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/locale/locale.h"
|
||||
#include "modules/locale/locale.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_LOCALE_NUM_FORMAT_ARGS 1
|
||||
|
||||
@@ -62,7 +63,7 @@ void ffParseLocaleJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/localip/localip.h"
|
||||
#include "modules/localip/localip.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_LOCALIP_DISPLAY_NAME "Local IP"
|
||||
#define FF_LOCALIP_NUM_FORMAT_ARGS 2
|
||||
@@ -134,7 +135,7 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "show-ipv4") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-ipv4"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showType |= FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
@@ -143,7 +144,7 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-ipv6") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-ipv6"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showType |= FF_LOCALIP_TYPE_IPV6_BIT;
|
||||
@@ -152,7 +153,7 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-mac") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-mac"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showType |= FF_LOCALIP_TYPE_MAC_BIT;
|
||||
@@ -161,7 +162,7 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "show-loop") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "show-loop"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showType |= FF_LOCALIP_TYPE_LOOP_BIT;
|
||||
@@ -170,7 +171,7 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if(strcasecmp(subKey, "compact") == 0)
|
||||
if(ffStrEqualsIgnCase(subKey, "compact"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showType |= FF_LOCALIP_TYPE_COMPACT_BIT;
|
||||
@@ -179,7 +180,7 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "name-prefix") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "name-prefix"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->namePrefix);
|
||||
return true;
|
||||
@@ -206,13 +207,13 @@ void ffParseLocalIpJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "showIpv4") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showIpv4"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
@@ -221,7 +222,7 @@ void ffParseLocalIpJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "showIpv6") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showIpv6"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_IPV6_BIT;
|
||||
@@ -230,7 +231,7 @@ void ffParseLocalIpJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "showMac") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showMac"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_MAC_BIT;
|
||||
@@ -239,7 +240,7 @@ void ffParseLocalIpJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "showLoop") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "showLoop"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_LOOP_BIT;
|
||||
@@ -248,7 +249,7 @@ void ffParseLocalIpJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "compact") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "compact"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options.showType |= FF_LOCALIP_TYPE_COMPACT_BIT;
|
||||
@@ -257,7 +258,7 @@ void ffParseLocalIpJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "namePrefix") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "namePrefix"))
|
||||
{
|
||||
ffStrbufSetS(&options.namePrefix, yyjson_get_str(val));
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/media/media.h"
|
||||
#include "modules/media/media.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -137,7 +138,7 @@ void ffParseMediaJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "common/bar.h"
|
||||
#include "detection/memory/memory.h"
|
||||
#include "modules/memory/memory.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_MEMORY_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -96,7 +97,7 @@ void ffParseMemoryJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/opencl/opencl.h"
|
||||
#include "modules/opencl/opencl.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_OPENCL_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -71,7 +72,7 @@ void ffParseOpenCLJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/opengl/opengl.h"
|
||||
#include "modules/opengl/opengl.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_OPENGL_NUM_FORMAT_ARGS 4
|
||||
|
||||
@@ -59,7 +60,7 @@ bool ffParseOpenGLCommandOptions(FFOpenGLOptions* options, const char* key, cons
|
||||
return true;
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
if (strcasecmp(key, "library") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "library"))
|
||||
{
|
||||
options->library = (FFOpenGLLibrary) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "auto", FF_OPENGL_LIBRARY_AUTO },
|
||||
@@ -91,14 +92,14 @@ void ffParseOpenGLJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
if (strcasecmp(key, "library") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "library"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@
|
||||
#include "common/option.h"
|
||||
#include "detection/os/os.h"
|
||||
#include "modules/os/os.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -169,7 +170,7 @@ void ffParseOSJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/packages/packages.h"
|
||||
#include "modules/packages/packages.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_PACKAGES_NUM_FORMAT_ARGS 21
|
||||
|
||||
@@ -126,7 +127,7 @@ void ffParsePackagesJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/media/media.h"
|
||||
#include "modules/player/player.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -105,7 +106,7 @@ void ffParsePlayerJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/poweradapter/poweradapter.h"
|
||||
#include "modules/poweradapter/poweradapter.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_POWERADAPTER_DISPLAY_NAME "Power Adapter"
|
||||
#define FF_POWERADAPTER_MODULE_ARGS 5
|
||||
@@ -95,7 +96,7 @@ void ffParsePowerAdapterJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/processes/processes.h"
|
||||
#include "modules/processes/processes.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_PROCESSES_NUM_FORMAT_ARGS 1
|
||||
|
||||
@@ -63,7 +64,7 @@ void ffParseProcessesJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "common/networking.h"
|
||||
#include "modules/publicip/publicip.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_PUBLICIP_DISPLAY_NAME "Public IP"
|
||||
#define FF_PUBLICIP_NUM_FORMAT_ARGS 1
|
||||
@@ -81,13 +82,13 @@ bool ffParsePublicIpCommandOptions(FFPublicIpOptions* options, const char* key,
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "url") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "url"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->url);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "timeout") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "timeout"))
|
||||
{
|
||||
options->timeout = ffOptionParseUInt32(key, value);
|
||||
return true;
|
||||
@@ -115,19 +116,19 @@ void ffParsePublicIpJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "url") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "url"))
|
||||
{
|
||||
ffStrbufSetS(&options.url, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "timeout") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "timeout"))
|
||||
{
|
||||
options.timeout = (uint32_t) yyjson_get_uint(val);
|
||||
continue;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "modules/separator/separator.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPrintSeparator(FFinstance* instance, FFSeparatorOptions* options)
|
||||
{
|
||||
@@ -44,7 +45,7 @@ bool ffParseSeparatorCommandOptions(FFSeparatorOptions* options, const char* key
|
||||
const char* subKey = ffOptionTestPrefix(key, FF_SEPARATOR_MODULE_NAME);
|
||||
if (!subKey) return false;
|
||||
|
||||
if (strcasecmp(subKey, "string") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "string"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->string);
|
||||
return true;
|
||||
@@ -70,10 +71,10 @@ void ffParseSeparatorJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "string") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "string"))
|
||||
{
|
||||
ffStrbufSetS(&options.string, yyjson_get_str(val));
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/terminalshell/terminalshell.h"
|
||||
#include "modules/shell/shell.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_SHELL_NUM_FORMAT_ARGS 7
|
||||
|
||||
@@ -75,7 +76,7 @@ void ffParseShellJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/sound/sound.h"
|
||||
#include "modules/sound/sound.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_SOUND_NUM_FORMAT_ARGS 4
|
||||
|
||||
@@ -97,7 +98,7 @@ bool ffParseSoundCommandOptions(FFSoundOptions* options, const char* key, const
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "sound-type") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "sound-type"))
|
||||
{
|
||||
options->soundType = (FFSoundType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "main", FF_SOUND_TYPE_MAIN },
|
||||
@@ -128,13 +129,13 @@ void ffParseSoundJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "soundType") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "soundType"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "common/bar.h"
|
||||
#include "detection/swap/swap.h"
|
||||
#include "modules/swap/swap.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_SWAP_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -96,7 +97,7 @@ void ffParseSwapJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/terminalshell/terminalshell.h"
|
||||
#include "modules/terminal/terminal.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -76,7 +77,7 @@ void ffParseTerminalJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/terminalfont/terminalfont.h"
|
||||
#include "modules/terminalfont/terminalfont.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_TERMINALFONT_DISPLAY_NAME "Terminal Font"
|
||||
#define FF_TERMINALFONT_NUM_FORMAT_ARGS 4
|
||||
@@ -71,7 +72,7 @@ void ffParseTerminalFontJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/theme/theme.h"
|
||||
#include "modules/theme/theme.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_THEME_NUM_FORMAT_ARGS 1
|
||||
|
||||
@@ -62,7 +63,7 @@ void ffParseThemeJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "common/printing.h"
|
||||
#include "common/jsonconfig.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "modules/title/title.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
static inline void printTitlePart(FFinstance* instance, const FFstrbuf* content)
|
||||
{
|
||||
@@ -44,7 +45,7 @@ bool ffParseTitleCommandOptions(FFTitleOptions* options, const char* key, const
|
||||
const char* subKey = ffOptionTestPrefix(key, FF_TITLE_MODULE_NAME);
|
||||
if (!subKey) return false;
|
||||
|
||||
if (strcasecmp(subKey, "fdqn") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "fdqn"))
|
||||
{
|
||||
options->fdqn = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
@@ -70,10 +71,10 @@ void ffParseTitleJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "fdqn") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "fdqn"))
|
||||
{
|
||||
options.fdqn = yyjson_get_bool(val);
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/uptime/uptime.h"
|
||||
#include "modules/uptime/uptime.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_UPTIME_NUM_FORMAT_ARGS 4
|
||||
|
||||
@@ -111,6 +112,9 @@ void ffParseUptimeJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/users/users.h"
|
||||
#include "modules/users/users.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_USERS_NUM_FORMAT_ARGS 1
|
||||
|
||||
@@ -75,7 +76,7 @@ void ffParseUsersJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/vulkan/vulkan.h"
|
||||
#include "modules/vulkan/vulkan.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_VULKAN_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -75,7 +76,7 @@ void ffParseVulkanJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/wallpaper/wallpaper.h"
|
||||
#include "modules/wallpaper/wallpaper.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_WALLPAPER_NUM_FORMAT_ARGS 1
|
||||
|
||||
@@ -62,7 +63,7 @@ void ffParseWallpaperJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "common/networking.h"
|
||||
#include "modules/weather/weather.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_WEATHER_NUM_FORMAT_ARGS 1
|
||||
|
||||
@@ -65,13 +66,13 @@ bool ffParseWeatherCommandOptions(FFWeatherOptions* options, const char* key, co
|
||||
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
|
||||
return true;
|
||||
|
||||
if (strcasecmp(subKey, "output-format") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "output-format"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->outputFormat);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strcasecmp(subKey, "timeout") == 0)
|
||||
if (ffStrEqualsIgnCase(subKey, "timeout"))
|
||||
{
|
||||
options->timeout = ffOptionParseUInt32(key, value);
|
||||
return true;
|
||||
@@ -99,19 +100,19 @@ void ffParseWeatherJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
if (strcasecmp(key, "outputFormat") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "outputFormat"))
|
||||
{
|
||||
ffStrbufSetS(&options.outputFormat, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcasecmp(key, "timeout") == 0)
|
||||
if (ffStrEqualsIgnCase(key, "timeout"))
|
||||
{
|
||||
options.timeout = (uint32_t) yyjson_get_uint(val);
|
||||
continue;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/wifi/wifi.h"
|
||||
#include "modules/wifi/wifi.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_WIFI_NUM_FORMAT_ARGS 10
|
||||
|
||||
@@ -102,7 +103,7 @@ void ffParseWifiJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "modules/wm/wm.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_WM_NUM_FORMAT_ARGS 3
|
||||
|
||||
@@ -73,7 +74,7 @@ void ffParseWMJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "detection/wmtheme/wmtheme.h"
|
||||
#include "modules/wmtheme/wmtheme.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_WMTHEME_DISPLAY_NAME "WM Theme"
|
||||
#define FF_WMTHEME_NUM_FORMAT_ARGS 1
|
||||
@@ -62,7 +63,7 @@ void ffParseWMThemeJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
yyjson_obj_foreach(module, idx, max, key_, val)
|
||||
{
|
||||
const char* key = yyjson_get_str(key_);
|
||||
if(strcasecmp(key, "type") == 0)
|
||||
if(ffStrEqualsIgnCase(key, "type"))
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "stringUtils.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
bool ffStrSet(const char* str)
|
||||
|
||||
@@ -5,8 +5,29 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
bool ffStrSet(const char* str);
|
||||
bool ffStrHasNChars(const char* str, char c, uint32_t n);
|
||||
|
||||
static inline bool ffStrStartsWithIgnCase(const char* str, const char* compareTo)
|
||||
{
|
||||
return strncasecmp(str, compareTo, strlen(compareTo)) == 0;
|
||||
}
|
||||
|
||||
static inline bool ffStrEqualsIgnCase(const char* str, const char* compareTo)
|
||||
{
|
||||
return strcasecmp(str, compareTo) == 0;
|
||||
}
|
||||
|
||||
static inline bool ffStrStartsWith(const char* str, const char* compareTo)
|
||||
{
|
||||
return strncmp(str, compareTo, strlen(compareTo)) == 0;
|
||||
}
|
||||
|
||||
static inline bool ffStrEquals(const char* str, const char* compareTo)
|
||||
{
|
||||
return strcmp(str, compareTo) == 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user