include/crc64.h \
include/c_strtod.h \
include/debug.h \
+ include/default_shell.h \
include/encode.h \
include/env.h \
include/exec_shell.h \
--- /dev/null
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef UTIL_LINUX_DEFAULT_SHELL_H
+#define UTIL_LINUX_DEFAULT_SHELL_H
+
+#include <pwd.h>
+
+#define UL_SHELL_NOENV (1 << 0)
+#define UL_SHELL_NOPWD (1 << 1)
+
+const char *ul_default_shell(int flags, const struct passwd *pw);
+
+#endif /* UTIL_LINUX_DEFAULT_SHELL_H */
#ifndef UTIL_LINUX_SHELLS_H
#define UTIL_LINUX_SHELLS_H
-#include <pwd.h>
+#include <stdio.h>
#if defined (HAVE_LIBECONF) && defined (USE_VENDORDIR)
# include <libeconf.h>
-#endif
-
-#define UL_SHELL_NOENV (1 << 0)
-#define UL_SHELL_NOPWD (1 << 1)
-
-#if defined (HAVE_LIBECONF) && defined (USE_VENDORDIR)
econf_file *open_etc_shells(void);
#endif
extern void print_shells(FILE *out, const char *format);
extern int is_known_shell(const char *shell_name);
-const char *ul_default_shell(int flags, const struct passwd *pw);
-
#endif /* UTIL_LINUX_SHELLS_H */
lib/crc64.c \
lib/c_strtod.c \
lib/debug.c \
+ lib/default_shell.c \
lib/encode.c \
lib/env.c \
lib/fileutils.c \
--- /dev/null
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <paths.h>
+
+#include "c.h"
+#include "default_shell.h"
+
+const char *ul_default_shell(int flags, const struct passwd *pw)
+{
+ const char *shell = NULL;
+
+ if (!(flags & UL_SHELL_NOENV)) {
+ shell = getenv("SHELL");
+ if (shell && *shell)
+ return shell;
+ }
+ if (!(flags & UL_SHELL_NOPWD)) {
+ if (!pw)
+ pw = getpwuid(getuid());
+ if (pw)
+ shell = pw->pw_shell;
+ if (shell && *shell)
+ return shell;
+ }
+
+ return _PATH_BSHELL;
+}
#include "xalloc.h"
#include "exec_shell.h"
-#include "shells.h"
+#include "default_shell.h"
void __attribute__((__noreturn__)) exec_shell(void)
{
crc64.c
c_strtod.c
debug.c
+ default_shell.c
encode.c
env.c
fileutils.c
#endif
return ret;
}
-
-const char *ul_default_shell(int flags, const struct passwd *pw)
-{
- const char *shell = NULL;
-
- if (!(flags & UL_SHELL_NOENV)) {
- shell = getenv("SHELL");
- if (shell && *shell)
- return shell;
- }
- if (!(flags & UL_SHELL_NOPWD)) {
- if (!pw)
- pw = getpwuid(getuid());
- if (pw)
- shell = pw->pw_shell;
- if (shell && *shell)
- return shell;
- }
-
- return _PATH_BSHELL;
-}
#include "closestream.h"
#include "monotonic.h"
#include "timer.h"
-#include "shells.h"
+#include "default_shell.h"
#ifndef F_OFD_GETLK
#define F_OFD_GETLK 36
#include "signames.h"
#include "pty-session.h"
#include "debug.h"
-#include "shells.h"
+#include "default_shell.h"
#include "fileutils.h"
static UL_DEBUG_DEFINE_MASK(script);
#include "pty-session.h"
#include "script-playutils.h"
#include "monotonic.h"
-#include "shells.h"
+#include "default_shell.h"
#define SCRIPT_MIN_DELAY 0.0001 /* from original scriptreplay.pl */
#include "widechar.h"
#include "closestream.h"
#include "env.h"
-#include "shells.h"
+#include "default_shell.h"
#ifdef TEST_PROGRAM
# define NON_INTERACTIVE_MORE 1