From owner-svn-src-all@FreeBSD.ORG Mon Dec 20 08:34:55 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A32F1065696; Mon, 20 Dec 2010 08:34:55 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id CE27F8FC1E; Mon, 20 Dec 2010 08:34:54 +0000 (UTC) Received: by qwj9 with SMTP id 9so2367044qwj.13 for ; Mon, 20 Dec 2010 00:34:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=TNnKXU33OdTnMAS85BHqOPTR3S1mshSzIgH/O31tIWk=; b=RbrkN88XY/yhI7XGhCV9o05mqQmR5YmTt/0zzbqJnHxBlYu4OjzoU/vET/rN0Zugkx OzdBYkBLrEZBoDzYd4O25lzTkiBfgZX4l2XKD4636A0hOMBEnJyNO7z+cdlfsTC8mMqd fof6RVTxKWQDlq8r7nS5oy9ukIqdJE0Hik9Nc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=EOaQZ5864JRlu8uCHHj9Ui+QNU+qYWBAeX4fs/tGap9rkvxoG2g45JMsYguZGQQz1v JggdsP1zOSUyJ0MlhVHVI40KNLPDrDMu3WGmKXD1i31UPgTWZmxIPhekS9PfYE+8RU7H EWIcgdbQwKdF6zbZ1tOC609kbBatAZLuSKrKw= Received: by 10.224.6.67 with SMTP id 3mr3791593qay.80.1292834093742; Mon, 20 Dec 2010 00:34:53 -0800 (PST) Received: from localhost (anonymizer6.torservers.net [174.36.199.203]) by mx.google.com with ESMTPS id l12sm2041632qcu.43.2010.12.20.00.34.51 (version=SSLv3 cipher=RC4-MD5); Mon, 20 Dec 2010 00:34:53 -0800 (PST) From: Anonymous To: "David E. O'Brien" References: <201009162231.o8GMV3Ov009118__30279.1559639902$1284676285$gmane$org@svn.freebsd.org> <86sjxsq4eh.fsf__10621.3107625537$1292830823$gmane$org@gmail.com> Date: Mon, 20 Dec 2010 11:34:47 +0300 In-Reply-To: <86sjxsq4eh.fsf__10621.3107625537$1292830823$gmane$org@gmail.com> (Anonymous's message of "Mon, 20 Dec 2010 10:39:34 +0300") Message-ID: <86wrn4ona0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212770 - head/usr.bin/script X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Dec 2010 08:34:55 -0000 Anonymous writes: > "David E. O'Brien" 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); %%