mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
e0eba8ce21
```bash find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i ```
26 lines
586 B
C
26 lines
586 B
C
#include "common/kmod.h"
|
|
#include "common/io.h"
|
|
|
|
bool ffKmodLoaded(const char* modName) {
|
|
static FFstrbuf modules;
|
|
if (modules.chars == NULL) {
|
|
ffStrbufInitS(&modules, "\n");
|
|
ffAppendFileBuffer("/proc/modules", &modules);
|
|
}
|
|
|
|
if (modules.length == 0) {
|
|
return false;
|
|
}
|
|
|
|
uint32_t len = (uint32_t) strlen(modName);
|
|
if (len > 250) {
|
|
return false;
|
|
}
|
|
|
|
char temp[256];
|
|
temp[0] = '\n';
|
|
memcpy(temp + 1, modName, len);
|
|
temp[1 + len] = ' ';
|
|
return memmem(modules.chars, modules.length, temp, len + 2) != NULL;
|
|
}
|