Date: Mon, 20 Dec 2010 11:34:47 +0300 From: Anonymous <swell.k@gmail.com> To: "David E. O'Brien" <obrien@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212770 - head/usr.bin/script Message-ID: <86wrn4ona0.fsf@gmail.com> In-Reply-To: <86sjxsq4eh.fsf__10621.3107625537$1292830823$gmane$org@gmail.com> (Anonymous's message of "Mon, 20 Dec 2010 10:39:34 %2B0300") References: <201009162231.o8GMV3Ov009118__30279.1559639902$1284676285$gmane$org@svn.freebsd.org> <86sjxsq4eh.fsf__10621.3107625537$1292830823$gmane$org@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Anonymous <swell.k@gmail.com> writes: > "David E. O'Brien" <obrien@FreeBSD.org> writes: > >> Author: obrien >> Date: Thu Sep 16 22:31:03 2010 >> New Revision: 212770 >> URL: http://svn.freebsd.org/changeset/base/212770 >> >> Log: >> + 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. > [...] >> + if (av[0]) >> + for (k = 0 ; av[k] ; ++k) >> + fprintf(fscript, "%s%s", k ? " " : "", av[k]); >> + fprintf(fscript, "\r\n"); >> + > > Can you make it opt-in? It breaks scripts that do not expect anything > other than command output in a typescript. For example, timestamps can > be disabled by `-q' option. So, how about putting it under `-q' and making it more easy to notice. %% Index: usr.bin/script/script.1 =================================================================== --- usr.bin/script/script.1 (revision 216581) +++ usr.bin/script/script.1 (working copy) @@ -75,7 +75,7 @@ .It Fl k Log keys sent to program as well as output. .It Fl q -Run in quiet mode, omit the start and stop status messages. +Run in quiet mode, omit the start, stop and command status messages. .It Fl t Ar time Specify time interval between flushing script output file. A value of 0 Index: usr.bin/script/script.c =================================================================== --- usr.bin/script/script.c (revision 216581) +++ usr.bin/script/script.c (working copy) @@ -86,6 +86,7 @@ char ibuf[BUFSIZ]; fd_set rfd; int flushtime = 30; + int k; aflg = kflg = 0; while ((ch = getopt(argc, argv, "aqkt:")) != -1) @@ -137,6 +138,11 @@ tvec = time(NULL); (void)printf("Script started, output file is %s\n", fname); (void)fprintf(fscript, "Script started on %s", ctime(&tvec)); + if (argv[0]) + fprintf(fscript, "command: "); + for (k = 0 ; argv[k] ; ++k) + fprintf(fscript, "%s%s", k ? " " : "", argv[k]); + fprintf(fscript, "\n"); fflush(fscript); } if (ttyflg) { @@ -231,17 +237,11 @@ 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); %%
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86wrn4ona0.fsf>