Date: Thu, 14 Oct 2010 03:13:20 +0000 (UTC) From: "David E. O'Brien" <obrien@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r213828 - stable/7/usr.bin/script Message-ID: <201010140313.o9E3DKE9010970@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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]);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010140313.o9E3DKE9010970>