mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
@@ -4,11 +4,12 @@
|
|||||||
#include "util/mallocHelper.h"
|
#include "util/mallocHelper.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "util/windows/getline.h"
|
#include "util/windows/getline.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool parsePropLinePointer(const char** line, const char* start, FFstrbuf* buffer)
|
bool ffParsePropLinePointer(const char** line, const char* start, FFstrbuf* buffer)
|
||||||
{
|
{
|
||||||
if(**line == '\0')
|
if(**line == '\0')
|
||||||
return false;
|
return false;
|
||||||
@@ -32,7 +33,7 @@ static bool parsePropLinePointer(const char** line, const char* start, FFstrbuf*
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Line doesn't match start, skip it
|
//Line doesn't match start, skip it
|
||||||
if(**line != *start || **line == '\0')
|
if(tolower(**line) != tolower(*start) || **line == '\0')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Line and start match, continue testing
|
//Line and start match, continue testing
|
||||||
@@ -69,14 +70,9 @@ static bool parsePropLinePointer(const char** line, const char* start, FFstrbuf*
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer)
|
|
||||||
{
|
|
||||||
return parsePropLinePointer(&line, start, buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer)
|
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer)
|
||||||
{
|
{
|
||||||
while(!parsePropLinePointer(&lines, start, buffer))
|
while(!ffParsePropLinePointer(&lines, start, buffer))
|
||||||
{
|
{
|
||||||
while(*lines != '\0' && *lines != '\n')
|
while(*lines != '\0' && *lines != '\n')
|
||||||
++lines;
|
++lines;
|
||||||
|
|||||||
@@ -8,12 +8,18 @@ typedef struct FFpropquery
|
|||||||
FFstrbuf* buffer;
|
FFstrbuf* buffer;
|
||||||
} FFpropquery;
|
} FFpropquery;
|
||||||
|
|
||||||
bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer);
|
|
||||||
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer);
|
bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer);
|
||||||
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries);
|
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries);
|
||||||
bool ffParsePropFileHomeValues(const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
bool ffParsePropFileHomeValues(const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
||||||
bool ffParsePropFileListValues(const FFlist* list, const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
bool ffParsePropFileListValues(const FFlist* list, const char* relativeFile, uint32_t numQueries, FFpropquery* queries);
|
||||||
|
|
||||||
|
bool ffParsePropLinePointer(const char** line, const char* start, FFstrbuf* buffer);
|
||||||
|
|
||||||
|
static inline bool ffParsePropLine(const char* line, const char* start, FFstrbuf* buffer)
|
||||||
|
{
|
||||||
|
return ffParsePropLinePointer(&line, start, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool ffParsePropFile(const char* filename, const char* start, FFstrbuf* buffer)
|
static inline bool ffParsePropFile(const char* filename, const char* start, FFstrbuf* buffer)
|
||||||
{
|
{
|
||||||
return ffParsePropFileValues(filename, 1, (FFpropquery[]){{start, buffer}});
|
return ffParsePropFileValues(filename, 1, (FFpropquery[]){{start, buffer}});
|
||||||
|
|||||||
@@ -352,11 +352,15 @@ FF_MAYBE_UNUSED static bool getTerminalVersionCockpit(FFstrbuf* exe, FFstrbuf* v
|
|||||||
|
|
||||||
FF_MAYBE_UNUSED static bool getTerminalVersionXterm(FFstrbuf* exe, FFstrbuf* version)
|
FF_MAYBE_UNUSED static bool getTerminalVersionXterm(FFstrbuf* exe, FFstrbuf* version)
|
||||||
{
|
{
|
||||||
if(ffProcessAppendStdOut(version, (char* const[]){
|
ffStrbufSetS(version, getenv("XTERM_VERSION"));
|
||||||
exe->chars,
|
if (!version->length)
|
||||||
"-v",
|
{
|
||||||
NULL
|
if(ffProcessAppendStdOut(version, (char* const[]){
|
||||||
})) return false;
|
exe->chars,
|
||||||
|
"-v",
|
||||||
|
NULL
|
||||||
|
})) return false;
|
||||||
|
}
|
||||||
|
|
||||||
//xterm(273)
|
//xterm(273)
|
||||||
ffStrbufTrimRight(version, ')');
|
ffStrbufTrimRight(version, ')');
|
||||||
|
|||||||
Reference in New Issue
Block a user