svn commit: r213828 - stable/7/usr.bin/script
David E. O'Brien
obrien at FreeBSD.org
Thu Oct 14 03:13:21 UTC 2010
Author: obrien
Date: Thu Oct 14 03:13:20 2010
New Revision: 213828
URL: http://svn.freebsd.org/changeset/base/213828
Log:
MFC r212770 & r212832:
+ Add the SCRIPT environmental variable to the sub-shell.
+ Add the 'command' argument (if supplied on the command line)
to the typescript file.
Modified:
stable/7/usr.bin/script/script.1
stable/7/usr.bin/script/script.c
Directory Properties:
stable/7/usr.bin/script/ (props changed)
Modified: stable/7/usr.bin/script/script.1
==============================================================================
--- stable/7/usr.bin/script/script.1 Thu Oct 14 03:11:41 2010 (r213827)
+++ stable/7/usr.bin/script/script.1 Thu Oct 14 03:13:20 2010 (r213828)
@@ -114,9 +114,22 @@ The
utility works best with commands that do not manipulate the screen.
The results are meant to emulate a hardcopy terminal, not an addressable one.
.Sh ENVIRONMENT
-The following environment variable is utilized by
+The following environment variables are 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
Modified: stable/7/usr.bin/script/script.c
==============================================================================
--- stable/7/usr.bin/script/script.c Thu Oct 14 03:11:41 2010 (r213827)
+++ stable/7/usr.bin/script/script.c Thu Oct 14 03:13:20 2010 (r213828)
@@ -241,14 +241,21 @@ 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]);
More information about the svn-src-stable-7
mailing list