coreutils

General Software Utilities
git clone http://git.omkov.net/coreutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2020-07-02 03:10:57
Commit09b607069aebbe75c9ccd96cf560cc7efdfef9fc
Parentf5515d97d04d53ed70e903fcf58bceb9e013929f

tee: Move buffer onto stack

Diffstat

M src/tee.c | 7 ++++---

1 files changed, 4 insertions, 3 deletions

diff --git a/src/tee.c b/src/tee.c
index 66e100a..7758ad8 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -1,4 +1,4 @@
-// tee.c, version 1.0.1
+// tee.c, version 1.0.2
 // OMKOV coreutils implementation of POSIX tee
 // Copyright (C) 2020, Jakob Wakeling
 // All rights reserved.
@@ -42,7 +42,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #include <stdio.h>
 #include <string.h>
 
-static char stdbuf[BUFSIZ * 16];
+#define VERSION "1.0.2"
 
 static bool aflag;
 
@@ -77,6 +77,7 @@ int main(int argc, char *argv[]) {
 		if (!*f) { warn("%s: %s: %s", argv[0], *p, serrno); --f; }
 	} *f = NULL;
 
+	char stdbuf[BUFSIZ * 16];
 	for (size_t c; (c = fread(stdbuf, 1, sizeof (stdbuf), stdin)) != 0;) {
 		for (f = files; *f; ++f) { fwrite(stdbuf, 1, c, *f); }
 		fwrite(stdbuf, 1, c, stdout);
@@ -101,7 +102,7 @@ static void help(void) {
 }
 
 static void version(void) {
-	puts("OMKOV coreutils tee, version 1.0.1");
+	puts("OMKOV coreutils tee, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
 	puts("OMKOV Permissive Licence (https://www.omkov.net/OLPE)");