tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: humanize_number(3) for dd(1) summary?



On 03.11.2011 14:55, Izumi Tsutsui wrote:
@@ -105,6 +108,7 @@ void
 jcl(char **argv)
 {
 struct arg *ap, tmp;
+ //struct dd_msgfmt *fmt;
 char *oper, *arg;
 in.dbsz = out.dbsz = 512;
Leftover?
Yep, thanks
--- misc.c 5 Oct 2007 07:23:09 -0000 1.21
+++ misc.c 2 Nov 2011 22:21:55 -0000
 :
+static void
+posix_summary(void)
+{
+ char buf[100];
+
 /* Use snprintf(3) so that we don't reenter stdio(3). */
- (void)snprintf(buf, sizeof(buf),
- "%llu+%llu records in\n%llu+%llu records out\n",
- (unsigned long long)st.in_full, (unsigned long long)st.in_part,
- (unsigned long long)st.out_full, (unsigned long long)st.out_part);
+ (void)dd_snprintf(buf, sizeof(buf),
+ "%I+%i records in\n%O+%o records out\n");
 (void)write(STDERR_FILENO, buf, strlen(buf));
 :
+static int
+dd_snprintf(char *sbuf, size_t len, const char *fmt)
+{
 :
Can't dd_snprintf() be also optional if it occupies ~2.5KiB?
I can; there's one trade off though:
- the SMALLPROG dd(1) becomes smaller (by about 2.2kiB), which is still approx. 200 bytes bigger than the original SMALLPROG dd(1) - the normal dd(1) becomes bigger (approx. 600B), as we don't factor posix/human/quiet summary() anymore.
--
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost


Home | Main Index | Thread Index | Old Index

AltStyle によって変換されたページ (->オリジナル) /