+ Add the SCRIPT environmental variable to the sub-shell. Its value is
the name of the typescript file. + Add the 'command' argument (if supplied on the command line) to the typescript file. This creates a more complete typescript when invoked this way - more equal to invoking script without supplying the 'command' argument.
This commit is contained in:
parent
d8b03e05a9
commit
9b91846ce4
@ -117,6 +117,19 @@ The results are meant to emulate a hardcopy terminal, not an addressable one.
|
||||
The following environment variable is utilized by
|
||||
.Nm :
|
||||
.Bl -tag -width SHELL
|
||||
.It Ev SCRIPT
|
||||
The
|
||||
.Ev SCRIPT
|
||||
environment variable is added to the sub-shell.
|
||||
If
|
||||
.Ev SCRIPT
|
||||
already existed in the users environment,
|
||||
its value is overwritten within the sub-shell.
|
||||
The value of
|
||||
.Ev SCRIPT
|
||||
is the name of the
|
||||
.Ar typescript
|
||||
file.
|
||||
.It Ev SHELL
|
||||
If the variable
|
||||
.Ev SHELL
|
||||
|
@ -235,14 +235,21 @@ static void
|
||||
doshell(char **av)
|
||||
{
|
||||
const char *shell;
|
||||
int k;
|
||||
|
||||
shell = getenv("SHELL");
|
||||
if (shell == NULL)
|
||||
shell = _PATH_BSHELL;
|
||||
|
||||
if (av[0])
|
||||
for (k = 0 ; av[k] ; ++k)
|
||||
fprintf(fscript, "%s%s", k ? " " : "", av[k]);
|
||||
fprintf(fscript, "\r\n");
|
||||
|
||||
(void)close(master);
|
||||
(void)fclose(fscript);
|
||||
login_tty(slave);
|
||||
setenv("SCRIPT", fname, 1);
|
||||
if (av[0]) {
|
||||
execvp(av[0], av);
|
||||
warn("%s", av[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user