source: MondoRescue/branches/3.2/mindi-busybox/libbb/get_shell_name.c@ 3233

Last change on this file since 3233 was 3233, checked in by Bruno Cornec, 10 years ago
  • mindi-busybox 1.21.1 is now complete and builds
  • Property svn:eol-style set to native
File size: 430 bytes
Line 
1/*
2 * Copyright 2011, Denys Vlasenko
3 *
4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */
6
7//kbuild:lib-y += get_shell_name.o
8
9#include "libbb.h"
10
11const char* FAST_FUNC get_shell_name(void)
12{
13 struct passwd *pw;
14 char *shell;
15
16 shell = getenv("SHELL");
17 if (shell && shell[0])
18 return shell;
19
20 pw = getpwuid(getuid());
21 if (pw && pw->pw_shell && pw->pw_shell[0])
22 return pw->pw_shell;
23
24 return DEFAULT_SHELL;
25}
Note: See TracBrowser for help on using the repository browser.