diff options
author | obrien <obrien@FreeBSD.org> | 2010-09-16 22:31:03 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2010-09-16 22:31:03 +0000 |
commit | 4fc5f4cac951233fae6388ea43b3a1dceac82ac8 (patch) | |
tree | b08e7a6cf36a91af27e1012d13c79487e54130ff /usr.bin/script/script.c | |
parent | 9bbf98ec1e321950c92d48752d6cd1446e57470b (diff) | |
download | FreeBSD-src-4fc5f4cac951233fae6388ea43b3a1dceac82ac8.zip FreeBSD-src-4fc5f4cac951233fae6388ea43b3a1dceac82ac8.tar.gz |
+ 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.
Diffstat (limited to 'usr.bin/script/script.c')
-rw-r--r-- | usr.bin/script/script.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 64ca486..e8fa922 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -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]); |