-.\" $NetBSD: progress.1,v 1.2 2003/01/22 02:58:16 lukem Exp $
+.\" $NetBSD: progress.1,v 1.15 2014/04/13 01:45:34 snj Exp $
.\"
-.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2003-2007 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of The NetBSD Foundation nor the names of its
-.\" contributors may be used to endorse or promote products derived
-.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 21, 2003
+.Dd June 6, 2007
.Dt PROGRESS 1
.Os
.Sh NAME
.Nd feed input to a command, displaying a progress bar
.Sh SYNOPSIS
.Nm
-.Op Fl z
+.Op Fl ez
+.Op Fl b Ar buffersize
.Op Fl f Ar file
.Op Fl l Ar length
+.Op Fl p Ar prefix
.Ar cmd
.Op Ar args ...
.Sh DESCRIPTION
.Pp
The options are as follows:
.Bl -tag -width XlXlengthXX
+.It Fl b Ar buffersize
+Read in buffers of the specified size (default 64k).
+An optional suffix (per
+.Xr strsuftoll 3 )
+may be given.
+.It Fl e
+Display progress to standard error instead of standard output.
.It Fl f Ar file
Read from the specified
.Ar file
Use the specified length for the time estimate, rather than attempting to
.Xr fstat 2
the input.
+An optional suffix (per
+.Xr strsuftoll 3 )
+may be given.
+.It Fl p Ar prefix
+Print the given
+.Dq prefix
+text before (left of) the progress bar.
.It Fl z
Filter the input through
-.Xr gzip 1 .
+.Xr gunzip 1 .
If
.Fl f
is specified, calculate the length using
.Ic gzip -l .
.El
.Sh EXIT STATUS
-.Nm
-exits 0 on success.
-.\" .Sh ENVIRONMENT
-.\" .Sh FILES
+.Ex -std
.Sh EXAMPLES
The command
-.Ic progress -zf file.tar.gz tar xf -
+.Dl progress -zf file.tar.gz tar xf -
will extract the
.Pa file.tar.gz
displaying the progress bar as time passes:
.Bd -literal
- 0% | | 0 0.00 KB/s --:-- ETA
- 40% |********** | 273 KB 271.95 KB/s 00:01 ETA
- 81% |************************* | 553 KB 274.61 KB/s 00:00 ETA
-100% |*********************************| 680 KB 264.59 KB/s 00:00 ETA
+ 0% | | 0 0.00 KiB/s --:-- ETA
+ 40% |******** | 273 KiB 271.95 KiB/s 00:01 ETA
+ 81% |*********************** | 553 KiB 274.61 KiB/s 00:00 ETA
+100% |*******************************| 680 KiB 264.59 KiB/s 00:00 ETA
.Ed
.Pp
If it is preferred to monitor the progress of the decompression
process (unlikely), then
-.Ic progress -f file.tar.gz tar zxf -
+.Dl progress -f file.tar.gz tar zxf -
could be used.
-.\".Sh DIAGNOSTICS
+.Pp
+The command
+.Dl dd if=/dev/rwd0d ibs=64k | \e
+.Dl progress -l 120g dd of=/dev/rwd1d obs=64k
+will copy the 120 GiB disk
+.Sy wd0
+.Pa ( /dev/rwd0d )
+to
+.Sy wd1
+.Pa ( /dev/rwd1d ) ,
+displaying a progress bar during the operation.
.Sh SEE ALSO
-.Xr ftp 1
-.\" .Sh STANDARDS
+.Xr ftp 1 ,
+.Xr strsuftoll 3
.Sh HISTORY
.Nm
first appeared in
.Sh AUTHORS
.Nm
was written by
-.An John Hawkinson Aq jhawk@NetBSD.ORG .
+.An John Hawkinson
+.Aq jhawk@NetBSD.org .
.Xr ftp 1 Ns 's
dynamic progress bar was written by Luke Mewburn.
.Sh BUGS
pipeline, as well as those produced by
.Nm
itself.
-.Pp
-Under special circumstances,
-.Nm
-may have its output pipe prematurely closed.
-For example:
-.Bd -literal
-# < /dev/zero progress dd of=/dev/null
- 26923 KB 26.19 MB/s progress: wrote -1 of 512 bytes to output pipe: Bad address
-# 53847+0 records in
-53847+0 records out
-27569664 bytes transferred in 0.997 secs (27652621 bytes/sec)
-.Ed
-.\" .Sh SECURITY CONSIDERATIONS