Files
fastfetch/src/modules/shell.c
T
2021-03-05 23:26:05 +01:00

31 lines
628 B
C

#include "fastfetch.h"
void ffPrintShell(FFinstance* instance)
{
if(ffPrintCachedValue(instance, "Shell"))
return;
char* shellPath = getenv("SHELL");
if(shellPath == NULL)
{
ffPrintError(instance, "Shell", "getenv(\"SHELL\") == NULL");
return;
}
char* value;
if(!instance->config.shellShowPath)
{
char* shellName = strrchr(shellPath, '/');
if(shellName != NULL)
value = ++shellName;
else
value = shellPath;
}
else
{
value = shellPath;
}
ffPrintAndSaveCachedValue(instance, "Shell", value);
}