mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-31 10:02:49 +01:00
Fastfetch: make it compile on SunOS
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
#include "bios.h"
|
||||
|
||||
const char* ffDetectBios(FFBiosResult* bios)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "camera.h"
|
||||
|
||||
const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
|
||||
{
|
||||
return "Not support on this platform";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "cpu.h"
|
||||
|
||||
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "cpucache.h"
|
||||
#include "common/sysctl.h"
|
||||
|
||||
const char* ffDetectCPUCache(FF_MAYBE_UNUSED FFCPUCacheResult* result)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "fastfetch.h"
|
||||
#include "detection/cpuusage/cpuusage.h"
|
||||
|
||||
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
|
||||
{
|
||||
return "Not support on this platform";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "disk.h"
|
||||
|
||||
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "diskio.h"
|
||||
|
||||
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -302,7 +302,7 @@ static const char* getFromProcesses(FFDisplayServerResult* result)
|
||||
if(result->dePrettyName.length > 0 && result->wmPrettyName.length > 0)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
#elif !defined(__sun)
|
||||
FF_AUTO_CLOSE_DIR DIR* procdir = opendir("/proc");
|
||||
if(procdir == NULL)
|
||||
return "opendir(\"/proc\") failed";
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "host.h"
|
||||
|
||||
const char* ffDetectHost(FFHostResult* host)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "libc.h"
|
||||
|
||||
const char* ffDetectLibc(FFLibcResult* result)
|
||||
{
|
||||
result->name = "Unknown";
|
||||
result->version = NULL;
|
||||
return NULL;
|
||||
}
|
||||
@@ -162,6 +162,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
|
||||
if (ifAddrStruct) freeifaddrs(ifAddrStruct);
|
||||
|
||||
#ifdef SIOCGIFMTU
|
||||
FF_AUTO_CLOSE_FD int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sockfd > 0)
|
||||
{
|
||||
@@ -173,6 +174,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
iface->mtu = ifr.ifr_mtu;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "memory.h"
|
||||
|
||||
const char* ffDetectMemory(FFMemoryResult* ram)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "netio.h"
|
||||
|
||||
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "os.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
if (!ffReadFileBuffer("/etc/release", &os->prettyName))
|
||||
return;
|
||||
|
||||
ffStrbufSubstrBeforeFirstC(&os->prettyName, '\n');
|
||||
ffStrbufSubstrBeforeLastC(&os->prettyName, '(');
|
||||
ffStrbufTrim(&os->prettyName, ' ');
|
||||
|
||||
// OpenIndiana Hipster 2024.04
|
||||
uint32_t idx = ffStrbufFirstIndexC(&os->prettyName, ' ');
|
||||
ffStrbufSetNS(&os->name, idx, os->prettyName.chars);
|
||||
uint32_t idx2 = ffStrbufNextIndexC(&os->prettyName, idx + 1, ' ');
|
||||
ffStrbufSetNS(&os->codename, idx2 - idx - 1, os->prettyName.chars + idx + 1);
|
||||
ffStrbufSetNS(&os->version, idx2 - idx - 1, os->prettyName.chars + idx2 + 1);
|
||||
ffStrbufSetStatic(&os->idLike, "sunos");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "packages.h"
|
||||
|
||||
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "physicaldisk.h"
|
||||
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -14,7 +14,11 @@ const char* ffDetectProcesses(uint32_t* result)
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
if (entry->d_type == DT_DIR && ffCharIsDigit(entry->d_name[0]))
|
||||
if (
|
||||
#ifdef _DIRENT_HAVE_D_TYPE
|
||||
entry->d_type == DT_DIR &&
|
||||
#endif
|
||||
ffCharIsDigit(entry->d_name[0]))
|
||||
++num;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "swap.h"
|
||||
|
||||
const char* ffDetectSwap(FFSwapResult* swap)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "terminalsize.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <sys/termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "uptime.h"
|
||||
#include "common/time.h"
|
||||
#include <utmpx.h>
|
||||
|
||||
const char* ffDetectUptime(FFUptimeResult* result)
|
||||
{
|
||||
struct utmpx* ut;
|
||||
|
||||
setutxent();
|
||||
while (NULL != (ut = getutxent()))
|
||||
{
|
||||
if (ut->ut_type == BOOT_TIME)
|
||||
{
|
||||
result->bootTime = (uint64_t) ut->ut_tv.tv_sec * 1000 + (uint64_t) ut->ut_tv.tv_usec / 10000000;
|
||||
result->uptime = ffTimeGetNow() - result->bootTime;
|
||||
break;
|
||||
}
|
||||
}
|
||||
endutxent();
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "wifi.h"
|
||||
|
||||
const char* ffDetectWifi(FFlist* result)
|
||||
{
|
||||
return "Not support on this platform";
|
||||
}
|
||||
Reference in New Issue
Block a user