mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
- Refresh code with latest OpenBSD revisions.
- Remove $DragonFly$ tags as they are using git nowadays and VCS tags will not help merging. - Other changes to Copyright headers to make them consistent with other source code, we intend to fork from this point. Reviewed by: pfg
This commit is contained in:
parent
e38120d46f
commit
e56ef7d358
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=246091
@ -1,6 +1,5 @@
|
||||
# $FreeBSD$
|
||||
# $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $
|
||||
# $DragonFly: src/usr.bin/patch/Makefile,v 1.8 2008/08/10 23:50:12 joerg Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
*
|
||||
* Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@ -14,8 +12,8 @@
|
||||
*
|
||||
* David MacKenzie <djm@ai.mit.edu>. Some algorithms adapted from GNU Emacs.
|
||||
*
|
||||
* $OpenBSD: backupfile.c,v 1.19 2006/03/11 19:41:30 otto Exp $
|
||||
* $DragonFly: src/usr.bin/patch/backupfile.c,v 1.5 2008/08/11 00:05:06 joerg Exp $
|
||||
* $OpenBSD: backupfile.c,v 1.20 2009/10/27 23:59:41 deraadt Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* backupfile.h -- declarations for making Emacs style backup file names
|
||||
* Copyright (C) 1990 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@ -9,9 +7,11 @@
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* backupfile.h -- declarations for making Emacs style backup file names
|
||||
*
|
||||
* $OpenBSD: backupfile.h,v 1.6 2003/07/28 18:35:36 otto Exp $
|
||||
* $DragonFly: src/usr.bin/patch/backupfile.h,v 1.3 2007/09/29 23:11:10 swildner Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/* When to make backup files. */
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
*
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,7 +24,7 @@
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: common.h,v 1.26 2006/03/11 19:41:30 otto Exp $
|
||||
* $DragonFly: src/usr.bin/patch/common.h,v 1.5 2008/08/10 23:50:12 joerg Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
*
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -25,7 +23,8 @@
|
||||
* -C option added in 1998, original code by Marc Espie, based on FreeBSD
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: inp.c,v 1.34 2006/03/11 19:41:30 otto Exp $
|
||||
* $OpenBSD: inp.c,v 1.36 2012/04/10 14:46:34 ajacoutot Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1,12 +1,4 @@
|
||||
/*
|
||||
* $FreeBSD$
|
||||
* $OpenBSD: inp.h,v 1.8 2003/08/15 08:00:51 otto Exp $
|
||||
* $DragonFly: src/usr.bin/patch/inp.h,v 1.1 2004/09/24 18:44:28 joerg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* patch - a program to apply diffs to original files
|
||||
*
|
||||
/*-
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,8 +18,13 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* patch - a program to apply diffs to original files
|
||||
*
|
||||
* -C option added in 1998, original code by Marc Espie, based on FreeBSD
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: inp.h,v 1.8 2003/08/15 08:00:51 otto Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
void re_input(void);
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 1983, 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -27,8 +26,8 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $OpenBSD: mkpath.c,v 1.2 2005/06/20 07:14:06 otto Exp $
|
||||
* $DragonFly: src/usr.bin/patch/mkpath.c,v 1.1 2007/09/29 23:11:10 swildner Exp $
|
||||
* $OpenBSD: mkpath.c,v 1.2 2005/06/20 07:14:06 otto Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $FreeBSD$
|
||||
.\"-
|
||||
.\" Copyright 1986, Larry Wall
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
@ -19,9 +19,9 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $OpenBSD: patch.1,v 1.22 2008/06/06 20:44:00 jmc Exp $
|
||||
.\" $DragonFly: src/usr.bin/patch/patch.1,v 1.10 2008/08/18 19:15:55 joerg Exp $
|
||||
.Dd August 18, 2008
|
||||
.\" $OpenBSD: patch.1,v 1.26 2010/09/03 11:09:29 jmc Exp $
|
||||
.\" $FreeBSD$
|
||||
.Dd January 29, 2013
|
||||
.Dt PATCH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -59,7 +59,7 @@ If
|
||||
is omitted, or is a hyphen, the patch will be read from the standard input.
|
||||
.Pp
|
||||
.Nm
|
||||
will attempt to determine the type of the diff listing, unless over-ruled by a
|
||||
will attempt to determine the type of the diff listing, unless overruled by a
|
||||
.Fl c ,
|
||||
.Fl e ,
|
||||
.Fl n ,
|
||||
@ -349,7 +349,7 @@ used in place of
|
||||
.Qq .orig .
|
||||
.It Fl Fl posix
|
||||
Enables strict
|
||||
.St -p1003.1-2004
|
||||
.St -p1003.1-2008
|
||||
conformance, specifically:
|
||||
.Bl -enum
|
||||
.It
|
||||
@ -463,7 +463,7 @@ match used:
|
||||
If
|
||||
.Nm
|
||||
is operating in strict
|
||||
.St -p1003.1-2004
|
||||
.St -p1003.1-2008
|
||||
mode, the first of the
|
||||
.Dq old ,
|
||||
.Dq new
|
||||
@ -605,6 +605,22 @@ used to read input when
|
||||
.Nm
|
||||
prompts the user
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
The
|
||||
.Nm
|
||||
utility exits with one of the following values:
|
||||
.Pp
|
||||
.Bl -tag -width Ds -offset indent -compact
|
||||
.It 0
|
||||
Successful completion.
|
||||
.It 1
|
||||
One or more lines were written to a reject file.
|
||||
.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
|
||||
@ -616,29 +632,13 @@ 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
|
||||
The
|
||||
.Nm
|
||||
utility exits with one of the following values:
|
||||
.Pp
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It \&0
|
||||
Successful completion.
|
||||
.It \&1
|
||||
One or more lines were written to a reject file.
|
||||
.It \*[Gt]\&1
|
||||
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 SEE ALSO
|
||||
.Xr diff 1
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm
|
||||
utility is compliant with the
|
||||
.St -p1003.1-2004
|
||||
.St -p1003.1-2008
|
||||
specification
|
||||
(except as detailed above for the
|
||||
.Fl -posix
|
||||
@ -648,7 +648,7 @@ though the presence of
|
||||
itself is optional.
|
||||
.Pp
|
||||
The flags
|
||||
.Op Fl CEfstuvBFVxz
|
||||
.Op Fl BCEFfstVvxz
|
||||
and
|
||||
.Op Fl -posix
|
||||
are extensions to that specification.
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
*
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -25,8 +23,8 @@
|
||||
* -C option added in 1998, original code by Marc Espie, based on FreeBSD
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: patch.c,v 1.45 2007/04/18 21:52:24 sobrado Exp $
|
||||
* $DragonFly: src/usr.bin/patch/patch.c,v 1.10 2008/08/10 23:39:56 joerg Exp $
|
||||
* $OpenBSD: patch.c,v 1.50 2012/05/15 19:32:02 millert Exp $
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
@ -114,9 +112,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,11 +145,13 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int error = 0, hunk, failed, i, fd;
|
||||
bool patch_seen;
|
||||
LINENUM where = 0, newwhere, fuzz, mymaxfuzz;
|
||||
const char *tmpdir;
|
||||
char *v;
|
||||
|
||||
setbuf(stderr, serrbuf);
|
||||
setlinebuf(stdout);
|
||||
setlinebuf(stderr);
|
||||
for (i = 0; i < MAXFILEC; i++)
|
||||
filearg[i] = NULL;
|
||||
|
||||
@ -214,9 +211,12 @@ main(int argc, char *argv[])
|
||||
/* make sure we clean up /tmp in case of disaster */
|
||||
set_signals(0);
|
||||
|
||||
patch_seen = false;
|
||||
for (open_patch_file(filearg[1]); there_is_another_patch();
|
||||
reinitialize_almost_everything()) {
|
||||
/* for each patch in patch file */
|
||||
|
||||
patch_seen = true;
|
||||
|
||||
warn_on_invalid_line = true;
|
||||
|
||||
@ -400,18 +400,21 @@ main(int argc, char *argv[])
|
||||
sizeof(rejname)) >= sizeof(rejname))
|
||||
fatal("filename %s is too long\n", outname);
|
||||
}
|
||||
if (skip_rest_of_patch) {
|
||||
say("%d out of %d hunks ignored--saving rejects to %s\n",
|
||||
failed, hunk, rejname);
|
||||
} else {
|
||||
say("%d out of %d hunks failed--saving rejects to %s\n",
|
||||
failed, hunk, rejname);
|
||||
}
|
||||
if (!check_only)
|
||||
say("%d out of %d hunks %s--saving rejects to %s\n",
|
||||
failed, hunk, skip_rest_of_patch ? "ignored" : "failed", rejname);
|
||||
else
|
||||
say("%d out of %d hunks %s\n",
|
||||
failed, hunk, skip_rest_of_patch ? "ignored" : "failed");
|
||||
if (!check_only && move_file(TMPREJNAME, rejname) < 0)
|
||||
trejkeep = true;
|
||||
}
|
||||
set_signals(1);
|
||||
}
|
||||
|
||||
if (!patch_seen)
|
||||
error = 2;
|
||||
|
||||
my_exit(error);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Placed in the public domain by Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* on July 29, 2003.
|
||||
*
|
||||
* $OpenBSD: pathnames.h,v 1.1 2003/07/29 20:10:17 millert Exp $
|
||||
* $DragonFly: src/usr.bin/patch/pathnames.h,v 1.2 2008/08/11 00:04:12 joerg Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*-
|
||||
*
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -25,8 +24,8 @@
|
||||
* -C option added in 1998, original code by Marc Espie, based on FreeBSD
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $
|
||||
* $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $
|
||||
* $OpenBSD: pch.c,v 1.39 2012/04/11 08:07:13 ajacoutot Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
*
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,7 +24,7 @@
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: pch.h,v 1.9 2003/10/31 20:20:45 millert Exp $
|
||||
* $DragonFly: src/usr.bin/patch/pch.h,v 1.1 2004/09/24 18:44:28 joerg Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define OLD_FILE 0
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
*
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -25,8 +23,8 @@
|
||||
* -C option added in 1998, original code by Marc Espie, based on FreeBSD
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: util.c,v 1.32 2006/03/11 19:41:30 otto Exp $
|
||||
* $DragonFly: src/usr.bin/patch/util.c,v 1.9 2007/09/29 23:11:10 swildner Exp $
|
||||
* $OpenBSD: util.c,v 1.35 2010/07/24 01:10:12 ray Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -212,9 +210,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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
*
|
||||
* Copyright 1986, Larry Wall
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,8 +24,7 @@
|
||||
* behaviour
|
||||
*
|
||||
* $OpenBSD: util.h,v 1.15 2005/06/20 07:14:06 otto Exp $
|
||||
* $DragonFly: src/usr.bin/patch/util.h,v 1.2 2007/09/29 23:11:10 swildner Exp $
|
||||
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
char *fetchname(const char *, bool *, int);
|
||||
|
Loading…
Reference in New Issue
Block a user