[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] status=noinfo option for dd
From: |
Pozsar Balazs |
Subject: |
Re: [PATCH] status=noinfo option for dd |
Date: |
Thu, 18 Feb 2010 03:47:50 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
New (hopefully better) version of the patch.
dd: status=noinfo operand suppresses the transfer count information
when the program exits.
diff --git a/NEWS b/NEWS
index 323845d..794f7f1 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ GNU coreutils NEWS -*-
outline -*-
using the --with-tty-group[=NAME] option, who also compares the group
of the TTY device with NAME (or "tty" if no group name is specified).
+ dd: status=noinfo operand suppresses the transfer count information
+ when the program exits.
+
** Changes in behavior
ls --color no longer emits the final 3-byte color-resetting escape
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index fcee336..dd14c73 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -7767,10 +7767,17 @@ Skip @var{blocks} @samp{obs}-byte blocks in the output
file before copying.
Copy @var{blocks} @samp{ibs}-byte blocks from the input file, instead
of everything until the end of the file.
address@hidden status=noinfo
address@hidden status
+Do not print the overall record transfer and truncate count
+that normally make up the first two status line when @command{dd} exits.
+Errors (permission denied, disk full etc) are still printed to stderr.
+
@item status=noxfer
@opindex status
Do not print the overall transfer rate and volume statistics
that normally make up the third status line when @command{dd} exits.
+Errors (permission denied, disk full etc) are still printed to stderr.
@item address@hidden,@address@hidden
@opindex conv
diff --git a/src/dd.c b/src/dd.c
index 36a5bc0..2a38aff 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -132,7 +132,8 @@ enum
/* Status bit masks. */
enum
{
- STATUS_NOXFER = 01
+ STATUS_NOXFER = 01,
+ STATUS_NOINFO = 02,
};
/* The name of the input file, or NULL for the standard input. */
@@ -320,6 +321,7 @@ static struct symbol_value const flags[] =
static struct symbol_value const statuses[] =
{
{"noxfer", STATUS_NOXFER},
+ {"noinfo", STATUS_NOINFO},
{"", 0}
};
@@ -488,6 +490,7 @@ Copy a file, converting and formatting according to the
operands.\n\
seek=BLOCKS skip BLOCKS obs-sized blocks at start of output\n\
skip=BLOCKS skip BLOCKS ibs-sized blocks at start of input\n\
status=noxfer suppress transfer statistics\n\
+ status=noinfo suppress transfer count info\n\
"), stdout);
fputs (_("\
\n\
@@ -611,17 +614,20 @@ print_stats (void)
double delta_s;
char const *bytes_per_second;
- fprintf (stderr,
- _("%"PRIuMAX"+%"PRIuMAX" records in\n"
- "%"PRIuMAX"+%"PRIuMAX" records out\n"),
- r_full, r_partial, w_full, w_partial);
-
- if (r_truncate != 0)
- fprintf (stderr,
- ngettext ("%"PRIuMAX" truncated record\n",
- "%"PRIuMAX" truncated records\n",
- select_plural (r_truncate)),
- r_truncate);
+ if (status_flags & STATUS_NOINFO)
+ {
+ fprintf (stderr,
+ _("%"PRIuMAX"+%"PRIuMAX" records in\n"
+ "%"PRIuMAX"+%"PRIuMAX" records out\n"),
+ r_full, r_partial, w_full, w_partial);
+
+ if (r_truncate != 0)
+ fprintf (stderr,
+ ngettext ("%"PRIuMAX" truncated record\n",
+ "%"PRIuMAX" truncated records\n",
+ select_plural (r_truncate)),
+ r_truncate);
+ }
if (status_flags & STATUS_NOXFER)
return;
--
Balazs Pozsar