Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-03-08 23:02:42 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2011-03-08 23:02:42 +0300
commitf8416dc6f64244223fbcb20fe504b7a9a764e698 (patch)
tree44c483d9a52a0b1126b4df97b68ec2307967fc86
parent681efe20d327e9e6774b174a617d66bbb9d21f48 (diff)
forgot to add libbb/get_shell_name.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/get_shell_name.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libbb/get_shell_name.c b/libbb/get_shell_name.c
new file mode 100644
index 000000000..c930afd94
--- /dev/null
+++ b/libbb/get_shell_name.c
@@ -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;
+}