aboutsummaryrefslogtreecommitdiff
path: root/stdu.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdu.c')
-rw-r--r--stdu.c22
1 files changed, 13 insertions, 9 deletions
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;