2021-02-18 22:25:36 +01:00
|
|
|
#include "fastfetch.h"
|
|
|
|
|
|
|
|
|
|
void ffPrintOS(FFstate* state)
|
|
|
|
|
{
|
2021-02-22 16:52:51 +01:00
|
|
|
if(ffPrintCachedValue(state, "OS"))
|
|
|
|
|
return;
|
|
|
|
|
|
2021-02-18 22:25:36 +01:00
|
|
|
char name[256];
|
2021-02-19 16:23:41 +01:00
|
|
|
ffParsePropFile("/etc/os-release", "NAME=\"%[^\"]+", name);
|
|
|
|
|
if(name[0] == '\0')
|
2021-02-18 22:25:36 +01:00
|
|
|
{
|
2021-02-20 19:08:23 +01:00
|
|
|
ffPrintError(state, "OS", "\"NAME=\\\"%[^\\\"]+\" not found in \"/etc/os-release\"");
|
2021-02-19 16:23:41 +01:00
|
|
|
return;
|
2021-02-18 22:25:36 +01:00
|
|
|
}
|
|
|
|
|
|
2021-02-22 16:52:51 +01:00
|
|
|
char os[1024];
|
|
|
|
|
sprintf(os, "%s %s", name, state->utsname.machine);
|
|
|
|
|
|
2021-02-22 20:53:12 +01:00
|
|
|
ffPrintAndSaveCachedValue(state, "OS", os);
|
2021-02-18 22:25:36 +01:00
|
|
|
}
|