From nobody Wed Nov 02 12:35:54 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N2RFQ5yD5z4h4Wv; Wed, 2 Nov 2022 12:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N2RFQ578Dz43st; Wed, 2 Nov 2022 12:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667392554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Bdxx4esgfp8iizdx5talHBN1+np8BbXdZLIPDJAyIM=; b=nlCH9MmtedLSY/Ir9ArDcoApPYWtAUZ/b3ux7hJojWsCz+8JLdVrFyMBULuyF7k26ZPs+a QIE0TGrQAnGIjleVPNvA5Umtf7GAsz0/kvFlx79r1+wvBfNGUj4IAbKUNcJXQmzjmwTh2t ivfC3Au7u2LUieWq/cPf2TQjSdG2kjG8JF4gilxKniPYgdlGTIlySdWLnWmN9kR2GI+ZQh YmP2tv9Z2pAOUM+TgdGhypHT+FuONsPWZlLtU5FfW3BbabZ2rFRRB9QNltOG88XTHz9Ov/ xZUCclSrtUVkdVghfk1yh/SIopzk4rmcLifqpolBo5w00Pv+710f773qp6vqlw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N2RFQ3m7rzwG4; Wed, 2 Nov 2022 12:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A2CZsfJ081311; Wed, 2 Nov 2022 12:35:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A2CZsPH081310; Wed, 2 Nov 2022 12:35:54 GMT (envelope-from git) Date: Wed, 2 Nov 2022 12:35:54 GMT Message-Id: <202211021235.2A2CZsPH081310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 7a254e64bf3d - stable/13 - script: Correct -F in man page and usage string. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7a254e64bf3d0d7d81f80ffa5ae00cd73deb7e6d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667392554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Bdxx4esgfp8iizdx5talHBN1+np8BbXdZLIPDJAyIM=; b=H2x9+ogFzyrdW8qO/7j8fsBJXFE4xFk9F2vyiFsyclZAEbsPfS7wTZOmrkQmW1HPWdZnTs 473lx8aX4Tfg1oWweNwX6cw0TEdyI1uh/SC4uekCzm3wcPxI4ucS0B7KUBw4IB7MyT19dY NnhqDojKVi/Rm4GkLJgS7XOtXAUcQC7de/8sqUeI/rSv52LaUOG5geAAXB4AuLpmDdk6gp C2d1mf1uY9NvEwDP2GvZRkB2ij82nalfDpF4S7tptu7hVCnkaSBg/7Us3AjOKlYi7UNR2M FXnti30yKJL872rn5Xtx38GyFxrJ2bFHt8NQZIFotp+sf+Sa3dP+fs0AxLiEoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667392554; a=rsa-sha256; cv=none; b=FXYsU5olonEwCAhgmHKTzxZFDo2FNvcMbF/05QUsmIL+jmuHSKHIW54q7NX29rzOA3gXv4 GC7T4nRiOgQ4WiXUCx5YdlsfbvS0GE3wk6BdN37YvwXXBkaIQdh43Z+1Od4EY+FWWkANRb c18ZWH89W5A/TU35wgsmUJAyHIjnsikqv5sVI7AU22BIdjpE8GARymPybRgdCJWzxx8i47 0RIofwG9fe2lOqLGRd7lJ3vmyPS5YI1U3xQnY282w3MUd+bZ0IGlc0/NRFLRTMIRJfoRzR 8wKPIHNH+W2fB4Jq63sJapc+yyW/FEP0Wsrsz+rGT6AD7PNXa+KLIjod+bjFiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=7a254e64bf3d0d7d81f80ffa5ae00cd73deb7e6d commit 7a254e64bf3d0d7d81f80ffa5ae00cd73deb7e6d Author: Dag-Erling Smørgrav AuthorDate: 2022-10-26 18:08:12 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2022-11-02 09:44:48 +0000 script: Correct -F in man page and usage string. Sponsored by: Klara, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D37138 (cherry picked from commit 8e096e24d4344b6d3d16e24d58d5d8a0fa9733c9) script: Add usage string for playback mode. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37138 (cherry picked from commit e7c13cf4383d8216149becf7f843a2e00b30d2e2) script: Use size_t / ssize_t where needed. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37177 (cherry picked from commit 3276866f40caaf3d5605d5695f460cbdf035ef45) script: Further usage string nits. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37177 (cherry picked from commit 6ac087cf8ff4de22dc0b1b7ce1248f0a1558ddc2) script: Handle a missing 's' stamp gracefully. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37182 (cherry picked from commit 473e9fcab4ea9379f53e1f7d8e41f5a5754d0007) --- usr.bin/script/script.1 | 7 +++---- usr.bin/script/script.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index 36523148fa90..350a5e791e81 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -28,7 +28,7 @@ .\" @(#)script.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 9, 2022 +.Dd October 26, 2022 .Dt SCRIPT 1 .Os .Sh NAME @@ -36,8 +36,7 @@ .Nd make typescript of terminal session .Sh SYNOPSIS .Nm -.Op Fl aefkqr -.Op Fl F Ar pipe +.Op Fl aeFfkqr .Op Fl t Ar time .Op Ar file Op Ar command ... .Nm @@ -88,7 +87,7 @@ Accepted for compatibility with .Nm . The child command exit status is always the exit status of .Nm . -.It Fl F Ar pipe +.It Fl F Immediately flush output after each write. This will allow a user to create a named pipe using .Xr mkfifo 1 diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 430f48ad63df..1d3588c26d8b 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -73,8 +73,8 @@ struct stamp { struct buf_elm { TAILQ_ENTRY(buf_elm) link; - int rpos; - int len; + size_t rpos; + size_t len; char ibuf[]; }; @@ -107,7 +107,6 @@ static void usage(void); int main(int argc, char *argv[]) { - int cc; struct termios rtt, stt; struct winsize win; struct timeval tv, *tvp; @@ -116,6 +115,7 @@ main(int argc, char *argv[]) char ibuf[BUFSIZ]; fd_set rfd, wfd; struct buf_elm *be; + ssize_t cc; int aflg, Fflg, kflg, pflg, ch, k, n, fcm; int flushtime, readstdin; int fm_fd, fm_log; @@ -366,7 +366,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: script [-adfkpqr] [-t time] [file [command ...]]\n"); + "usage: script [-aeFfkpqr] [-t time] [file [command ...]]\n"); + (void)fprintf(stderr, + " script -p [-deq] [-T fmt] [file]\n"); exit(1); } @@ -550,6 +552,8 @@ playback(FILE *fp) tclock = stamp.scr_sec; tso.tv_sec = stamp.scr_sec; tso.tv_nsec = stamp.scr_usec * 1000; + if (nread == 0) + tsi = tso; switch (stamp.scr_direction) { case 's':