comparison toys/pending/dd.c @ 1276:d48bdc1cb017 draft

Switch human_readable() to just outputing decimal kilo/mega/gigabytes, make du use it, move it from lib/pending.c to lib.c.
author Rob Landley <rob@landley.net>
date Tue, 06 May 2014 06:31:28 -0500
parents b2a8f64a564b
children 8f59893165fa
comparison
equal deleted inserted replaced
1275:6f18a0845db3 1276:d48bdc1cb017
131 seconds = ((now.tv_sec * 1000000 + now.tv_usec) - (st.start.tv_sec * 1000000 131 seconds = ((now.tv_sec * 1000000 + now.tv_usec) - (st.start.tv_sec * 1000000
132 + st.start.tv_usec))/1000000.0; 132 + st.start.tv_usec))/1000000.0;
133 //out to STDERR 133 //out to STDERR
134 fprintf(stderr,"%llu+%llu records in\n%llu+%llu records out\n", st.in_full, st.in_part, 134 fprintf(stderr,"%llu+%llu records in\n%llu+%llu records out\n", st.in_full, st.in_part,
135 st.out_full, st.out_part); 135 st.out_full, st.out_part);
136 fprintf(stderr, "%llu bytes (%sB) copied,",st.bytes, human_readable(st.bytes)); 136 human_readable(toybuf, st.bytes);
137 fprintf(stderr, "%f seconds, %sB/s\n", seconds, human_readable(st.bytes/seconds)); 137 fprintf(stderr, "%llu bytes (%s) copied,",st.bytes, toybuf);
138 human_readable(toybuf, st.bytes/seconds);
139 fprintf(stderr, "%f seconds, %s/s\n", seconds, toybuf);
138 } 140 }
139 141
140 static void sig_handler(int sig) 142 static void sig_handler(int sig)
141 { 143 {
142 TT.sig = sig; 144 TT.sig = sig;