forgot to add libbb/get_shell_name.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
681efe20d3
commit
f8416dc6f6
25
libbb/get_shell_name.c
Normal file
25
libbb/get_shell_name.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Denys Vlasenko
|
||||||
|
*
|
||||||
|
* Licensed under GPLv2, see file LICENSE in this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//kbuild:lib-y += get_shell_name.o
|
||||||
|
|
||||||
|
#include "libbb.h"
|
||||||
|
|
||||||
|
const char *get_shell_name(void)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user