From f081e678dadf51a99c6a6ddfc6379af4890e29a6 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 24 Jul 2010 01:10:12 +0000 Subject: [PATCH] Send normal output to stdout instead of everything to stderr. This is currently done in the latest versions of GNU patch. Please watch out for output appearing out-of-order. Discussed with millert and deraadt. OK deraadt --- usr.bin/patch/patch.c | 8 +++----- usr.bin/patch/util.c | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index d95f5c05007..19e41c42295 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.48 2009/10/27 23:59:41 deraadt Exp $ */ +/* $OpenBSD: patch.c,v 1.49 2010/07/24 01:10:12 ray Exp $ */ /* * patch - a program to apply diffs to original files @@ -109,9 +109,6 @@ static bool reverse_flag_specified = false; /* buffer holding the name of the rejected patch file. */ static char rejname[NAME_MAX + 1]; -/* buffer for stderr */ -static char serrbuf[BUFSIZ]; - /* how many input lines have been irretractibly output */ static LINENUM last_frozen_line = 0; @@ -150,7 +147,8 @@ main(int argc, char *argv[]) const char *tmpdir; char *v; - setbuf(stderr, serrbuf); + setlinebuf(stdout); + setlinebuf(stderr); for (i = 0; i < MAXFILEC; i++) filearg[i] = NULL; diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c index b27b57b62c3..45d0d7d7d6c 100644 --- a/usr.bin/patch/util.c +++ b/usr.bin/patch/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.34 2010/01/08 13:27:59 oga Exp $ */ +/* $OpenBSD: util.c,v 1.35 2010/07/24 01:10:12 ray Exp $ */ /* * patch - a program to apply diffs to original files @@ -200,9 +200,9 @@ say(const char *fmt, ...) va_list ap; va_start(ap, fmt); - vfprintf(stderr, fmt, ap); + vfprintf(stdout, fmt, ap); va_end(ap); - fflush(stderr); + fflush(stdout); } /* -- 2.20.1