Files
fastfetch/src/modules/shell.c
T

23 lines
515 B
C
Raw Normal View History

2021-02-18 22:25:36 +01:00
#include "fastfetch.h"
2021-02-27 18:30:05 +01:00
void ffPrintShell(FFinstance* instance)
2021-02-18 22:25:36 +01:00
{
2021-02-27 18:30:05 +01:00
if(ffPrintCachedValue(instance, "Shell"))
2021-02-22 16:52:51 +01:00
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-27 18:30:05 +01:00
ffPrintError(instance, "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-27 18:30:05 +01:00
ffPrintAndSaveCachedValue(instance, "Shell", shellName);
2021-02-18 22:25:36 +01:00
}