Date: Thu, 4 Nov 2010 19:07:52 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r214801 - user/delphij/patch Message-ID: <201011041907.oA4J7qMK070073@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Thu Nov 4 19:07:52 2010 New Revision: 214801 URL: http://svn.freebsd.org/changeset/base/214801 Log: Sync with OpenBSD as of today. Changes: - Manual page improvement (add EXIT STATUS section) - Output normal messages to stdout to match GNU behavior. Modified: user/delphij/patch/patch.1 user/delphij/patch/patch.c user/delphij/patch/util.c Modified: user/delphij/patch/patch.1 ============================================================================== --- user/delphij/patch/patch.1 Thu Nov 4 19:05:35 2010 (r214800) +++ user/delphij/patch/patch.1 Thu Nov 4 19:07:52 2010 (r214801) @@ -1,4 +1,4 @@ -.\" $OpenBSD: patch.1,v 1.25 2009/02/08 17:33:01 jmc Exp $ +.\" $OpenBSD: patch.1,v 1.26 2010/09/03 11:09:29 jmc Exp $ .\" Copyright 1986, Larry Wall .\" .\" Redistribution and use in source and binary forms, with or without @@ -20,7 +20,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd February 20, 2009 +.Dd September 3, 2010 .Dt PATCH 1 .Os .Sh NAME @@ -604,33 +604,33 @@ used to read input when .Nm prompts the user .El -.Sh DIAGNOSTICS -Too many to list here, but generally indicative that -.Nm -couldn't parse your patch file. -.Pp -The message -.Qq Hmm... -indicates that there is unprocessed text in the patch file and that -.Nm -is attempting to intuit whether there is a patch in that text and, if so, -what kind of patch it is. -.Pp +.Sh EXIT STATUS The .Nm utility exits with one of the following values: .Pp -.Bl -tag -width Ds -compact -offset indent -.It \&0 +.Bl -tag -width Ds -offset indent -compact +.It 0 Successful completion. -.It \&1 +.It 1 One or more lines were written to a reject file. -.It \*[Gt]\&1 +.It \*(Gt1 An error occurred. .El .Pp When applying a set of patches in a loop it behooves you to check this exit status so you don't apply a later patch to a partially patched file. +.Sh DIAGNOSTICS +Too many to list here, but generally indicative that +.Nm +couldn't parse your patch file. +.Pp +The message +.Qq Hmm... +indicates that there is unprocessed text in the patch file and that +.Nm +is attempting to intuit whether there is a patch in that text and, if so, +what kind of patch it is. .Sh SEE ALSO .Xr diff 1 .Sh STANDARDS Modified: user/delphij/patch/patch.c ============================================================================== --- user/delphij/patch/patch.c Thu Nov 4 19:05:35 2010 (r214800) +++ user/delphij/patch/patch.c Thu Nov 4 19:07:52 2010 (r214801) @@ -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 @@ -112,9 +112,6 @@ static bool reverse_flag_specified = fal /* 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; @@ -153,7 +150,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; Modified: user/delphij/patch/util.c ============================================================================== --- user/delphij/patch/util.c Thu Nov 4 19:05:35 2010 (r214800) +++ user/delphij/patch/util.c Thu Nov 4 19:07:52 2010 (r214801) @@ -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 @@ -203,9 +203,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); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011041907.oA4J7qMK070073>