From owner-freebsd-bugs@FreeBSD.ORG Mon Dec 20 15:20:12 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB744106564A for ; Mon, 20 Dec 2010 15:20:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0408FC25 for ; Mon, 20 Dec 2010 15:20:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oBKFKCu1097617 for ; Mon, 20 Dec 2010 15:20:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oBKFKCHb097616; Mon, 20 Dec 2010 15:20:12 GMT (envelope-from gnats) Date: Mon, 20 Dec 2010 15:20:12 GMT Message-Id: <201012201520.oBKFKCHb097616@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Anonymous Cc: Subject: Re: bin/114465: [patch] [request] script(1): add really cool -d, -p & -r options from NetBSD X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Anonymous List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Dec 2010 15:20:12 -0000 The following reply was made to PR bin/114465; it has been noted by GNATS. From: Anonymous To: Ighighi Cc: bug-followup@FreeBSD.org Subject: Re: bin/114465: [patch] [request] script(1): add really cool -d, -p & -r options from NetBSD Date: Mon, 20 Dec 2010 18:11:37 +0300 Anonymous writes: > Here's a regen'd diff against script.c@r1.17 with the *argv[] spamming > change commented out atm. And here's a fix that works with r212770. --- script_replay.1.diff begins here --- --- usr.bin/script/script.1~ +++ usr.bin/script/script.1 @@ -79,7 +79,7 @@ Log keys sent to program as well as outp .It Fl p Play back a recorded session in real time. .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 r Record a session with input, output, and timestamping. .It Fl t Ar time --- usr.bin/script/script.c~ +++ usr.bin/script/script.c @@ -64,7 +64,7 @@ static const char sccsid[] = "@(#)script #define DEF_BUF 65536 -static struct stamp { +struct stamp { uint64_t scr_len; /* amount of data */ uint64_t scr_sec; /* time it arrived in seconds... */ uint32_t scr_usec; /* ...and microseconds */ @@ -102,6 +102,7 @@ main(int argc, char *argv[]) char ibuf[BUFSIZ]; fd_set rfd; int flushtime = 30; + int k; aflg = kflg = pflg = 0; usesleep = 1; @@ -170,8 +171,14 @@ main(int argc, char *argv[]) if (!qflg) { tvec = time(NULL); (void)printf("Script started, output file is %s\n", fname); - if (!rawout) + if (!rawout) { (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) { @@ -271,19 +278,11 @@ static void doshell(char **av) { const char *shell; - int k; shell = getenv("SHELL"); if (shell == NULL) shell = _PATH_BSHELL; -#if 0 - if (av[0]) - for (k = 0 ; av[k] ; ++k) - fprintf(fscript, "%s%s", k ? " " : "", av[k]); - fprintf(fscript, "\r\n"); -#endif - (void)close(master); (void)fclose(fscript); login_tty(slave); @@ -346,7 +345,7 @@ record(FILE *fp, char *buf, size_t cc, i err(1, "writev"); } -void +static void consume(FILE *fp, off_t len, char *buf, int reg) { size_t l; @@ -412,11 +411,13 @@ playback(FILE *fp) switch (stamp.scr_direction) { case 's': + if (!qflg) (void)printf("Script started on %s", ctime(&tclock)); tsi = tso; (void)consume(fp, stamp.scr_len, buf, reg); break; case 'e': + if (!qflg) (void)printf("\nScript done on %s", ctime(&tclock)); (void)consume(fp, stamp.scr_len, buf, reg); break; --- script_replay.1.diff ends here ---