Files
fastfetch/src/modules/shell.c
T

25 lines
521 B
C
Raw Normal View History

2021-02-18 22:25:36 +01:00
#include "fastfetch.h"
#include <string.h>
void ffPrintShell(FFstate* state)
{
2021-02-22 16:52:51 +01:00
if(ffPrintCachedValue(state, "Shell"))
return;
2021-02-18 22:25:36 +01:00
char* shellPath = getenv("SHELL");
2021-02-19 16:23:41 +01:00
if(shellPath == NULL)
{
2021-02-20 19:08:23 +01:00
ffPrintError(state, "Shell", "getenv(\"SHELL\") == NULL");
2021-02-19 16:23:41 +01:00
return;
}
2021-02-18 22:25:36 +01:00
char* shellName = strrchr(shellPath, '/');
if(shellName == NULL)
shellName = shellPath;
else if(shellName[0] == '/')
++shellName;
2021-02-22 20:53:12 +01:00
ffPrintAndSaveCachedValue(state, "Shell", shellName);
2021-02-18 22:25:36 +01:00
}