Fixed shell name (openbsd)

This commit is contained in:
adri 2022-06-24 16:23:18 +02:00
parent e0d207ea08
commit 755b6b0aa9

View file

@ -936,7 +936,7 @@ struct info get_info()
#ifdef __OPENBSD__ #ifdef __OPENBSD__
FILE* os_release = popen("echo ID=openbsd", "r"); // os-release does not exist in OpenBSD FILE* os_release = popen("echo ID=openbsd", "r"); // os-release does not exist in OpenBSD
#else #else
FILE* os_release = fopen("/etc/os-release", "r"); // os name file FILE* os_release = fopen("/etc/os-release", "r"); // os name file
#endif #endif
#ifndef __BSD__ #ifndef __BSD__
FILE* cpuinfo = fopen("/proc/cpuinfo", "r"); // cpu name file for not-freebsd systems FILE* cpuinfo = fopen("/proc/cpuinfo", "r"); // cpu name file for not-freebsd systems
@ -1084,8 +1084,10 @@ struct info get_info()
sprintf(user_info.shell, "%s", ""); sprintf(user_info.shell, "%s", "");
else else
sprintf(user_info.shell, "%s", tmp_shell); sprintf(user_info.shell, "%s", tmp_shell);
if (strlen(user_info.shell) > 16) // android shell was too long, this works only for termux #ifdef __linux__
if (strlen(user_info.shell) > 16) // android shell name was too long
memmove(&user_info.shell, &user_info.shell[27], strlen(user_info.shell)); memmove(&user_info.shell, &user_info.shell[27], strlen(user_info.shell));
#endif
#else // if _WIN32 #else // if _WIN32
// cpu name // cpu name
cpuinfo = popen("wmic cpu get caption", "r"); cpuinfo = popen("wmic cpu get caption", "r");