2011-03-09 01:32:42 +05:30
|
|
|
/*
|
|
|
|
* Copyright 2011, Denys Vlasenko
|
|
|
|
*
|
|
|
|
* Licensed under GPLv2, see file LICENSE in this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
//kbuild:lib-y += get_shell_name.o
|
|
|
|
|
|
|
|
#include "libbb.h"
|
|
|
|
|
2012-10-03 13:12:21 +05:30
|
|
|
const char* FAST_FUNC get_shell_name(void)
|
2011-03-09 01:32:42 +05:30
|
|
|
{
|
|
|
|
struct passwd *pw;
|
|
|
|
char *shell;
|
|
|
|
|
|
|
|
shell = getenv("SHELL");
|
|
|
|
if (shell && shell[0])
|
|
|
|
return shell;
|
|
|
|
|
|
|
|
pw = getpwuid(getuid());
|
|
|
|
if (pw && pw->pw_shell && pw->pw_shell[0])
|
|
|
|
return pw->pw_shell;
|
|
|
|
|
|
|
|
return DEFAULT_SHELL;
|
|
|
|
}
|