mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
@@ -307,6 +307,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/util/FFstrbuf.c
|
||||
src/util/FFvaluestore.c
|
||||
src/util/platform/FFPlatform.c
|
||||
src/util/stringUtils.c
|
||||
)
|
||||
|
||||
if(LINUX)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#ifdef FF_HAVE_DBUS
|
||||
|
||||
#include "common/thread.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
static bool loadLibSymbols(const FFinstance* instance, FFDBusLibrary* lib)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "common/format.h"
|
||||
#include "common/parsing.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "common/settings.h"
|
||||
#include "detection/gtk.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "disk.h"
|
||||
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
@@ -19,6 +21,10 @@ static bool isPhysicalDevice(const char* device)
|
||||
if(strcmp(device, "drvfs") == 0)
|
||||
return true;
|
||||
|
||||
//ZFS root pool. The format is rpool/<POOL_NAME>/<VOLUME_NAME>/<SUBVOLUME_NAME>
|
||||
if(strncmp(device, "rpool/", 6) == 0)
|
||||
return true;
|
||||
|
||||
//Pseudo filesystems don't have a device in /dev
|
||||
const char* devPrefix = "/dev/";
|
||||
if(strncmp(device, devPrefix, strlen(devPrefix)) != 0)
|
||||
@@ -141,6 +147,7 @@ static bool isSubvolume(const FFlist* devices)
|
||||
{
|
||||
const FFstrbuf* currentDevie = ffListGet(devices, devices->length - 1);
|
||||
|
||||
//Filter all disks which device was already found. This catches BTRFS subvolumes.
|
||||
for(uint32_t i = 0; i < devices->length - 1; i++)
|
||||
{
|
||||
const FFstrbuf* otherDevice = ffListGet(devices, i);
|
||||
@@ -149,6 +156,11 @@ static bool isSubvolume(const FFlist* devices)
|
||||
return true;
|
||||
}
|
||||
|
||||
//ZFS subvolumes: rpool/<POOL_NAME>/<VOLUME_NAME>/<SUBVOLUME_NAME>.
|
||||
//Test if the third slash is present.
|
||||
if(strncmp(currentDevie->chars, "rpool/", 6) == 0 && ffStrHasNChars(currentDevie->chars, '/', 3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "common/properties.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/processing.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#ifdef FF_HAVE_X11
|
||||
#include "common/library.h"
|
||||
#include "common/parsing.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
typedef struct X11PropertyData
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "common/properties.h"
|
||||
#include "common/parsing.h"
|
||||
#include "detection/temps/temps_linux.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <pci/pci.h>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "os.h"
|
||||
#include "common/properties.h"
|
||||
#include "common/parsing.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "common/parsing.h"
|
||||
#include "detection/terminalshell/terminalshell.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
static const char* getSystemMonospaceFont(const FFinstance* instance)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "fastfetch.h"
|
||||
#include "terminalshell.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/processing.h"
|
||||
#include "common/thread.h"
|
||||
#include "terminalshell.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "common/library.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/parsing.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include <stdlib.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#ifndef FASTFETCH_INCLUDED_detection_wmtheme
|
||||
#define FASTFETCH_INCLUDED_detection_wmtheme
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
bool ffDetectWmTheme(FFinstance* instance, FFstrbuf* themeOrError);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "fastfetch.h"
|
||||
#include "wmtheme.h"
|
||||
#include "common/properties.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/settings.h"
|
||||
#include "detection/gtk.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "wmtheme.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
static bool detectWMThemeFromConfigFile(FFinstance* instance, const char* configFile, const char* themeRegex, const char* defaultValue, FFstrbuf* themeOrError)
|
||||
{
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
#include "fastfetch.h"
|
||||
#include "util/FFvaluestore.h"
|
||||
#include "common/printing.h"
|
||||
#include "common/parsing.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/time.h"
|
||||
#include "util/FFvaluestore.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#if defined(FF_HAVE_OPENCL) || defined(__APPLE__)
|
||||
#include "common/library.h"
|
||||
#include "common/parsing.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include <string.h>
|
||||
|
||||
#define CL_TARGET_OPENCL_VERSION 100
|
||||
|
||||
@@ -3,17 +3,6 @@
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
bool ffStrSet(const char* str)
|
||||
{
|
||||
if(str == NULL)
|
||||
return false;
|
||||
|
||||
while(isspace(*str))
|
||||
str++;
|
||||
|
||||
return *str != '\0';
|
||||
}
|
||||
|
||||
static char* CHAR_NULL_PTR = "";
|
||||
|
||||
void ffStrbufInitA(FFstrbuf* strbuf, uint32_t allocate)
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#define strcasestr StrStrIA
|
||||
#endif
|
||||
|
||||
bool ffStrSet(const char* str);
|
||||
|
||||
#define FASTFETCH_STRBUF_DEFAULT_ALLOC 32
|
||||
|
||||
typedef struct FFstrbuf
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "FFPlatform_private.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPlatformInit(FFPlatform* platform)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "FFPlatform_private.h"
|
||||
|
||||
#include "util/stringUtils.h"
|
||||
#include "fastfetch_config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "stringUtils.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
bool ffStrSet(const char* str)
|
||||
{
|
||||
if(str == NULL)
|
||||
return false;
|
||||
|
||||
while(isspace(*str))
|
||||
str++;
|
||||
|
||||
return *str != '\0';
|
||||
}
|
||||
|
||||
bool ffStrHasNChars(const char* str, char c, uint32_t n)
|
||||
{
|
||||
for(uint32_t i = 0; i < n; i++)
|
||||
{
|
||||
char* current = strchr(str, c);
|
||||
if(current == NULL)
|
||||
return false;
|
||||
|
||||
str = current + 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef FF_INCLUDED_util_stringUtils_h
|
||||
#define FF_INCLUDED_util_stringUtils_h
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
bool ffStrSet(const char* str);
|
||||
bool ffStrHasNChars(const char* str, char c, uint32_t n);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user