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.
This commit is contained in:
parent
96632c1b9c
commit
8d105abc4f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258955
@ -28,7 +28,7 @@
|
|||||||
.\" @(#)script.1 8.1 (Berkeley) 6/6/93
|
.\" @(#)script.1 8.1 (Berkeley) 6/6/93
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd Oct 27, 2012
|
.Dd December 4, 2013
|
||||||
.Dt SCRIPT 1
|
.Dt SCRIPT 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -37,6 +37,7 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl adfkpqr
|
.Op Fl adfkpqr
|
||||||
|
.Op Fl F Ar pipe
|
||||||
.Op Fl t Ar time
|
.Op Fl t Ar time
|
||||||
.Op Ar file Op Ar command ...
|
.Op Ar file Op Ar command ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@ -76,6 +77,12 @@ retaining the prior contents.
|
|||||||
When playing back a session with the
|
When playing back a session with the
|
||||||
.Fl p
|
.Fl p
|
||||||
flag, do not sleep between records when playing back a timestamped session.
|
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
|
.It Fl f
|
||||||
Create
|
Create
|
||||||
.Ar file.filemon
|
.Ar file.filemon
|
||||||
|
@ -98,18 +98,18 @@ main(int argc, char *argv[])
|
|||||||
char obuf[BUFSIZ];
|
char obuf[BUFSIZ];
|
||||||
char ibuf[BUFSIZ];
|
char ibuf[BUFSIZ];
|
||||||
fd_set rfd;
|
fd_set rfd;
|
||||||
int aflg, kflg, pflg, ch, k, n;
|
int aflg, Fflg, kflg, pflg, ch, k, n;
|
||||||
int flushtime, readstdin;
|
int flushtime, readstdin;
|
||||||
int fm_fd, fm_log;
|
int fm_fd, fm_log;
|
||||||
|
|
||||||
aflg = kflg = pflg = 0;
|
aflg = Fflg = kflg = pflg = 0;
|
||||||
usesleep = 1;
|
usesleep = 1;
|
||||||
rawout = 0;
|
rawout = 0;
|
||||||
flushtime = 30;
|
flushtime = 30;
|
||||||
fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC
|
fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC
|
||||||
warning. (not needed w/clang) */
|
warning. (not needed w/clang) */
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "adfkpqrt:")) != -1)
|
while ((ch = getopt(argc, argv, "adFfkpqrt:")) != -1)
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case 'a':
|
case 'a':
|
||||||
aflg = 1;
|
aflg = 1;
|
||||||
@ -117,6 +117,9 @@ main(int argc, char *argv[])
|
|||||||
case 'd':
|
case 'd':
|
||||||
usesleep = 0;
|
usesleep = 0;
|
||||||
break;
|
break;
|
||||||
|
case 'F':
|
||||||
|
Fflg = 1;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
fflg = 1;
|
fflg = 1;
|
||||||
break;
|
break;
|
||||||
@ -283,6 +286,8 @@ main(int argc, char *argv[])
|
|||||||
fflush(fscript);
|
fflush(fscript);
|
||||||
start = tvec;
|
start = tvec;
|
||||||
}
|
}
|
||||||
|
if (Fflg)
|
||||||
|
fflush(fscript);
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
done(0);
|
done(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user