aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--stdu.c22
2 files changed, 14 insertions, 10 deletions
diff --git a/README b/README
index de272e3..21caa6c 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-stdu 1.1.0 README
+stdu 1.1.1 README
=================
`stdu` is a program for monitoring the amount of
diff --git a/stdu.c b/stdu.c
index e549440..24833a0 100644
--- a/stdu.c
+++ b/stdu.c
@@ -83,7 +83,7 @@ Print amount of data piped to stdin.\n\
int previous_line_strlen = 0;
while (1) {
- /* output */
+ /* output to the user */
if (conf->human_readable && base == 10) {
int res = ull_floored_with_prefix(
&stdout_buffer,
@@ -166,9 +166,9 @@ Print amount of data piped to stdin.\n\
}
bytes_read += new_read_bytes;
- /* writing */
+ /* writing forwarded data */
if (conf->forward) {
- printf("%s", buf);
+ fwrite(buf, 1, new_read_bytes, stdout);
}
/* resizing buffer and blocksize to read as much as possible
@@ -176,11 +176,15 @@ Print amount of data piped to stdin.\n\
*/
if (bufsize_tries <= 0) continue;
if (conf->precision == 0) continue;
- blocksize = exp_notated_to_ull(ull_ceiled_exponent_notation_base(
- bytes_read + 1,
- conf->precision,
- base))
- - bytes_read;
+
+ blocksize = exp_notated_to_ull(
+ ull_ceiled_exponent_notation_base(
+ bytes_read + 1,
+ conf->precision,
+ base
+ )
+ ) - bytes_read;
+
if (blocksize > bufsize) {
tmpbuf = malloc(bufsize * 2);
if (tmpbuf == NULL) {
@@ -193,7 +197,7 @@ Print amount of data piped to stdin.\n\
}
}
}
- printf("\n");
+ fprintf(progress_destination, "\n");
free(stdout_buffer);
return 0;