From owner-svn-src-head@FreeBSD.ORG Thu Dec 5 01:44:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C3F7340; Thu, 5 Dec 2013 01:44:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2E625124A; Thu, 5 Dec 2013 01:44:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB51iPLG088215; Thu, 5 Dec 2013 01:44:25 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB51iOXZ088213; Thu, 5 Dec 2013 01:44:24 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <201312050144.rB51iOXZ088213@svn.freebsd.org> From: Tom Rhodes Date: Thu, 5 Dec 2013 01:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258955 - head/usr.bin/script X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2013 01:44:25 -0000 Author: trhodes Date: Thu Dec 5 01:44:24 2013 New Revision: 258955 URL: http://svnweb.freebsd.org/changeset/base/258955 Log: Add -F to flush output after each write. With this, I can set up a pipe and allow a jr user to watch what I'm doing by running 'script -F pipefile' on it. While here, spell out the month in the .Dd tag like other manual pages. Modified: head/usr.bin/script/script.1 head/usr.bin/script/script.c Modified: head/usr.bin/script/script.1 ============================================================================== --- head/usr.bin/script/script.1 Thu Dec 5 01:21:45 2013 (r258954) +++ head/usr.bin/script/script.1 Thu Dec 5 01:44:24 2013 (r258955) @@ -28,7 +28,7 @@ .\" @(#)script.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd Oct 27, 2012 +.Dd December 4, 2013 .Dt SCRIPT 1 .Os .Sh NAME @@ -37,6 +37,7 @@ .Sh SYNOPSIS .Nm .Op Fl adfkpqr +.Op Fl F Ar pipe .Op Fl t Ar time .Op Ar file Op Ar command ... .Sh DESCRIPTION @@ -76,6 +77,12 @@ retaining the prior contents. When playing back a session with the .Fl p flag, do not sleep between records when playing back a timestamped session. +.It Fl F Ar pipe +Immediately flush output after each write. +This will allow a user to create a named pipe using +.Xr mkfifo 1 +and another user may watch the live session using a utility like +.Xr cat 1 . .It Fl f Create .Ar file.filemon Modified: head/usr.bin/script/script.c ============================================================================== --- head/usr.bin/script/script.c Thu Dec 5 01:21:45 2013 (r258954) +++ head/usr.bin/script/script.c Thu Dec 5 01:44:24 2013 (r258955) @@ -98,18 +98,18 @@ main(int argc, char *argv[]) char obuf[BUFSIZ]; char ibuf[BUFSIZ]; fd_set rfd; - int aflg, kflg, pflg, ch, k, n; + int aflg, Fflg, kflg, pflg, ch, k, n; int flushtime, readstdin; int fm_fd, fm_log; - aflg = kflg = pflg = 0; + aflg = Fflg = kflg = pflg = 0; usesleep = 1; rawout = 0; flushtime = 30; fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC warning. (not needed w/clang) */ - while ((ch = getopt(argc, argv, "adfkpqrt:")) != -1) + while ((ch = getopt(argc, argv, "adFfkpqrt:")) != -1) switch(ch) { case 'a': aflg = 1; @@ -117,6 +117,9 @@ main(int argc, char *argv[]) case 'd': usesleep = 0; break; + case 'F': + Fflg = 1; + break; case 'f': fflg = 1; break; @@ -283,6 +286,8 @@ main(int argc, char *argv[]) fflush(fscript); start = tvec; } + if (Fflg) + fflush(fscript); } finish(); done(0);