aboutsummaryrefslogtreecommitdiff
path: root/miscutils/time.c
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-09-27 10:20:47 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-09-27 10:20:47 +0000
commit4daad9004d8f07991516970a1cbd77756fae7041 (patch)
treef1a17e4b168ef8fdf8af92ac5ce8deba89d38db2 /miscutils/time.c
parent1acdc89e992eb3f0548ff48ba586b31c9a0ae232 (diff)
downloadbusybox-4daad9004d8f07991516970a1cbd77756fae7041.tar.gz
busybox-4daad9004d8f07991516970a1cbd77756fae7041.tar.bz2
introduce bb_putchar(). saves ~1800 on uclibc (less on glibc).
Diffstat (limited to 'miscutils/time.c')
-rw-r--r--miscutils/time.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/miscutils/time.c b/miscutils/time.c
index e8473f702..8f79a51ec 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -188,8 +188,6 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
#endif
if (!cpu_ticks) cpu_ticks = 1; /* we divide by it, must be nonzero */
- /* putchar() != putc(stdout) in glibc! */
-
while (*fmt) {
/* Handle leading literal part */
int n = strcspn(fmt, "%\\");
@@ -205,7 +203,7 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
/* Usually we optimize for size, but there is a limit
* for everything. With this we do a lot of 1-byte writes */
default:
- putc(*fmt, stdout);
+ bb_putchar(*fmt);
break;
#endif
@@ -215,11 +213,11 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
/* Our format strings do not have these */
/* and we do not take format str from user */
default:
- putc('%', stdout);
+ bb_putchar('%');
/*FALLTHROUGH*/
case '%':
if (!*fmt) goto ret;
- putc(*fmt, stdout);
+ bb_putchar(*fmt);
break;
#endif
case 'C': /* The command that got timed. */
@@ -351,17 +349,17 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
case '\\': /* Format escape. */
switch (*++fmt) {
default:
- putc('\\', stdout);
+ bb_putchar('\\');
/*FALLTHROUGH*/
case '\\':
if (!*fmt) goto ret;
- putc(*fmt, stdout);
+ bb_putchar(*fmt);
break;
case 't':
- putc('\t', stdout);
+ bb_putchar('\t');
break;
case 'n':
- putc('\n', stdout);
+ bb_putchar('\n');
break;
}
break;
@@ -370,7 +368,7 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
++fmt;
}
/* ret: */
- putc('\n', stdout);
+ bb_putchar('\n');
}
/* Run command CMD and return statistics on it.
@@ -437,6 +435,7 @@ int time_main(int argc, char **argv)
run_command(argv, &res);
/* Cheat. printf's are shorter :) */
+ /* (but see bb_putchar() body for additional wrinkle!) */
stdout = stderr;
dup2(2, 1); /* just in case libc does something silly :( */
summarize(output_format, argv, &res);