Fastfetch: make it compile on SunOS

This commit is contained in:
Carter Li
2024-06-16 01:02:48 +08:00
parent 5539fecb99
commit d35490aeef
26 changed files with 241 additions and 8 deletions
+6
View File
@@ -0,0 +1,6 @@
#include "bios.h"
const char* ffDetectBios(FFBiosResult* bios)
{
return "Not supported on this platform";
}
+6
View File
@@ -0,0 +1,6 @@
#include "camera.h"
const char* ffDetectCamera(FF_MAYBE_UNUSED FFlist* result)
{
return "Not support on this platform";
}
+6
View File
@@ -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";
}
+6
View File
@@ -0,0 +1,6 @@
#include "disk.h"
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
return "Not supported on this platform";
}
+6
View File
@@ -0,0 +1,6 @@
#include "diskio.h"
const char* ffDiskIOGetIoCounters(FFlist* result, FFDiskIOOptions* options)
{
return "Not supported on this platform";
}
+1 -1
View File
@@ -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";
+6
View File
@@ -0,0 +1,6 @@
#include "host.h"
const char* ffDetectHost(FFHostResult* host)
{
return "Not supported on this platform";
}
+8
View File
@@ -0,0 +1,8 @@
#include "libc.h"
const char* ffDetectLibc(FFLibcResult* result)
{
result->name = "Unknown";
result->version = NULL;
return NULL;
}
+2
View File
@@ -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;
}
+6
View File
@@ -0,0 +1,6 @@
#include "memory.h"
const char* ffDetectMemory(FFMemoryResult* ram)
{
return "Not supported on this platform";
}
+6
View File
@@ -0,0 +1,6 @@
#include "netio.h"
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
{
return "Not supported on this platform";
}
+20
View File
@@ -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";
}
+5 -1
View File
@@ -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;
}
+6
View File
@@ -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>
+21
View File
@@ -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;
}
+6
View File
@@ -0,0 +1,6 @@
#include "wifi.h"
const char* ffDetectWifi(FFlist* result)
{
return "Not support on this platform";
}