Files
fastfetch/src/modules/shell.c
T
Linus Dierheimer 0c3a562ec6 minor refactoring
2021-02-27 19:22:28 +01:00

25 lines
517 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* shellName = strrchr(shellPath, '/');
if(shellName == NULL)
shellName = shellPath;
else if(shellName[0] == '/')
++shellName;
ffPrintAndSaveCachedValue(instance, "Shell", shellName);
}