#include "xalloc.h"
#include "exec_shell.h"
-
-#define DEFAULT_SHELL "/bin/sh"
+#include "shells.h"
void __attribute__((__noreturn__)) exec_shell(void)
{
- const char *shell = getenv("SHELL");
+ const char *shell = ul_default_shell(0, NULL);
char *shellc;
const char *shell_basename;
char *arg0;
- if (!shell)
- shell = DEFAULT_SHELL;
-
shellc = xstrdup(shell);
shell_basename = basename(shellc);
xasprintf(&arg0, "-%s", shell_basename);
#include "closestream.h"
#include "monotonic.h"
#include "timer.h"
+#include "shells.h"
#ifndef F_OFD_GETLK
#define F_OFD_GETLK 36
int conflict_exit_code = 1;
char **cmd_argv = NULL, *sh_c_argv[4];
const char *filename = NULL;
+
enum {
OPT_VERBOSE = CHAR_MAX + 1,
OPT_FCNTL,
_("%s requires exactly one command argument"),
argv[optind + 1]);
cmd_argv = sh_c_argv;
- cmd_argv[0] = getenv("SHELL");
- if (!cmd_argv[0] || !*cmd_argv[0])
- cmd_argv[0] = _PATH_BSHELL;
+ cmd_argv[0] = (char *)ul_default_shell(0, NULL);
cmd_argv[1] = "-c";
cmd_argv[2] = argv[optind + 2];
cmd_argv[3] = NULL;
#include "signames.h"
#include "pty-session.h"
#include "debug.h"
+#include "shells.h"
static UL_DEBUG_DEFINE_MASK(script);
UL_DEBUG_DEFINE_MASKNAMES(script) = UL_DEBUG_EMPTY_MASKNAMES;
log_associate(&ctl, &ctl.in, timingfile, format);
}
- shell = getenv("SHELL");
- if (!shell)
- shell = _PATH_BSHELL;
+ shell = ul_default_shell(0, NULL);
ctl.pty = ul_new_pty(ctl.isterm);
if (!ctl.pty)
#include "pty-session.h"
#include "script-playutils.h"
#include "monotonic.h"
+#include "shells.h"
#define SCRIPT_MIN_DELAY 0.0001 /* from original scriptreplay.pl */
replay_set_delay_max(ss.setup, &maxdelay);
replay_set_delay_min(ss.setup, &mindelay);
- shell = getenv("SHELL");
- if (shell == NULL)
- shell = _PATH_BSHELL;
+ shell = ul_default_shell(0, NULL);
fprintf(stdout, _(">>> scriptlive: Starting your typescript execution by %s.\n"),
command ? command : shell);
#include "widechar.h"
#include "closestream.h"
#include "env.h"
+#include "shells.h"
#ifdef TEST_PROGRAM
# define NON_INTERACTIVE_MORE 1
int next_jump; /* number of lines to skip ahead */
char **file_names; /* The list of file names */
int num_files; /* Number of files left to process */
- char *shell; /* name of the shell to use */
+ const char *shell; /* name of the shell to use */
int sigfd; /* signalfd() file descriptor */
sigset_t sigset; /* signal operations */
char *line_buf; /* line buffer */
if ((ctl->backspace_ch = tigetstr(TERM_BACKSPACE)) == NULL)
ctl->backspace_ch = BACKSPACE;
- if ((ctl->shell = getenv("SHELL")) == NULL)
- ctl->shell = _PATH_BSHELL;
+ ctl->shell = ul_default_shell(0, NULL);
}
int main(int argc, char **argv)