mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 00:03:58 +01:00
26 lines
555 B
C
26 lines
555 B
C
#include "fastfetch.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
void* ffLibraryLoad(const FFstrbuf* userProvidedName, ...)
|
|
{
|
|
if(userProvidedName->length > 0)
|
|
return dlopen(userProvidedName->chars, RTLD_LAZY);
|
|
|
|
va_list defaultNames;
|
|
va_start(defaultNames, userProvidedName);
|
|
|
|
void* result = NULL;
|
|
const char* name = va_arg(defaultNames, const char*);
|
|
|
|
while(result == NULL && name != NULL)
|
|
{
|
|
result = dlopen(name, RTLD_LAZY);
|
|
name = va_arg(defaultNames, const char*);
|
|
}
|
|
|
|
va_end(defaultNames);
|
|
|
|
return result;
|
|
}
|