In "dd progress=N", let the value of N control how often

to print a "." to stderr.  Previously, any non-zero
value behaved like "progress=1".

PR 24300

Approved by christos
This commit is contained in:
apb 2006-01-09 10:17:05 +00:00
parent 756481fd55
commit b7d86f5e4c
4 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: args.c,v 1.25 2004/01/17 20:48:57 dbj Exp $ */
/* $NetBSD: args.c,v 1.26 2006/01/09 10:17:05 apb Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: args.c,v 1.25 2004/01/17 20:48:57 dbj Exp $");
__RCSID("$NetBSD: args.c,v 1.26 2006/01/09 10:17:05 apb Exp $");
#endif
#endif /* not lint */
@ -275,8 +275,7 @@ static void
f_progress(char *arg)
{
if (*arg != '0')
progress = 1;
progress = strsuftoll("progress blocks", arg, 0, LLONG_MAX);
}
#ifdef NO_CONV

View File

@ -1,4 +1,4 @@
.\" $NetBSD: dd.1,v 1.18 2004/02/13 17:56:17 wiz Exp $
.\" $NetBSD: dd.1,v 1.19 2006/01/09 10:17:05 apb Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -136,11 +136,12 @@ distinguishing between a partial or complete block being read.
.It Cm progress= Ns Ar n
Switch on display of progress if
.Va n
is set to
.Dq 1 ,
i.e. a
is set to any non-zero value.
This will cause a
.Dq \&.
is printed for each block written to the output file.
to be printed (to the standard error output) for every
.Va n
full or partial blocks written to the output file.
.It Xo
.Sm off
.Cm conv=

View File

@ -1,4 +1,4 @@
/* $NetBSD: dd.c,v 1.38 2005/04/20 17:38:59 rillig Exp $ */
/* $NetBSD: dd.c,v 1.39 2006/01/09 10:17:05 apb Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: dd.c,v 1.38 2005/04/20 17:38:59 rillig Exp $");
__RCSID("$NetBSD: dd.c,v 1.39 2006/01/09 10:17:05 apb Exp $");
#endif
#endif /* not lint */
@ -82,7 +82,7 @@ static off_t pending = 0; /* pending seek if sparse */
u_int ddflags; /* conversion options */
uint64_t cbsz; /* conversion block size */
u_int files_cnt = 1; /* # of files to copy */
int progress = 0; /* display sign of life */
uint64_t progress = 0; /* display sign of life */
const u_char *ctab; /* conversion table */
sigset_t infoset; /* a set blocking SIGINFO */
@ -533,7 +533,7 @@ dd_out(int force)
(void)memmove(out.db, out.dbp - out.dbcnt, out.dbcnt);
out.dbp = out.db + out.dbcnt;
if (progress)
if (progress && (st.out_full + st.out_part) % progress == 0)
(void)write(STDERR_FILENO, ".", 1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.16 2003/09/14 19:20:19 jschauma Exp $ */
/* $NetBSD: extern.h,v 1.17 2006/01/09 10:17:05 apb Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -59,7 +59,7 @@ extern uint64_t cpy_cnt;
extern uint64_t cbsz;
extern u_int ddflags;
extern u_int files_cnt;
extern int progress;
extern uint64_t progress;
extern const u_char *ctab;
extern const u_char a2e_32V[], a2e_POSIX[];
extern const u_char e2a_32V[], e2a_POSIX[];