From 4fa949c49742c20f80cb2fcb107f0b5144b3d040 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 21 May 2015 23:37:45 +0100 Subject: [PATCH] sum: remove stdio --- Applications/util/sum.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Applications/util/sum.c b/Applications/util/sum.c index 99e32fc6..253ea381 100644 --- a/Applications/util/sum.c +++ b/Applications/util/sum.c @@ -10,13 +10,13 @@ * and is released into the public domain, on the condition * that this comment is always included without alteration. */ +/* Stdio removed Alan Cox 2015 */ #include #include #include #include #include -#include #define BUFFER_SIZE (512) @@ -89,8 +89,11 @@ void sum(int fd, const char *fname) putd(crc, 5, 1); blks = (size + (long) BUFFER_SIZE - 1L) / (long) BUFFER_SIZE; putd(blks, 6, 0); - if (fname) printf(" %s", fname); - printf("\n"); + if (fname) { + write(1, " ", 1); + write(1, fname, strlen(fname)); + } + write(1, "\n", 1); } void putd(int number, int fw, int zeros) @@ -109,6 +112,5 @@ void putd(int number, int fw, int zeros) } else buf[fw - n - 1] = zeros ? '0' : ' '; } - buf[fw] = 0; - printf("%s", buf); + write(1, buf, fw); } -- 2.34.1