pch.h revision 246074
1246074Sgabor/* $FreeBSD: head/usr.bin/patch/pch.h 246074 2013-01-29 17:03:18Z gabor $ */
2246074Sgabor/*-
3246074Sgabor *
4246074Sgabor * Copyright 1986, Larry Wall
5246074Sgabor *
6246074Sgabor * Redistribution and use in source and binary forms, with or without
7246074Sgabor * modification, are permitted provided that the following condition is met:
8246074Sgabor * 1. Redistributions of source code must retain the above copyright notice,
9246074Sgabor * this condition and the following disclaimer.
10246074Sgabor *
11246074Sgabor * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
12246074Sgabor * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
13246074Sgabor * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14246074Sgabor * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
15246074Sgabor * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
16246074Sgabor * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17246074Sgabor * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
18246074Sgabor * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
19246074Sgabor * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
20246074Sgabor * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21246074Sgabor * SUCH DAMAGE.
22246074Sgabor *
23246074Sgabor * patch - a program to apply diffs to original files
24246074Sgabor *
25246074Sgabor * -C option added in 1998, original code by Marc Espie, based on FreeBSD
26246074Sgabor * behaviour
27246074Sgabor *
28246074Sgabor * $OpenBSD: pch.h,v 1.9 2003/10/31 20:20:45 millert Exp $
29246074Sgabor * $DragonFly: src/usr.bin/patch/pch.h,v 1.1 2004/09/24 18:44:28 joerg Exp $
30246074Sgabor */
31246074Sgabor
32246074Sgabor#define OLD_FILE	0
33246074Sgabor#define NEW_FILE	1
34246074Sgabor#define INDEX_FILE	2
35246074Sgabor#define MAX_FILE	3
36246074Sgabor
37246074Sgaborstruct file_name {
38246074Sgabor	char *path;
39246074Sgabor	bool exists;
40246074Sgabor};
41246074Sgabor
42246074Sgaborvoid		re_patch(void);
43246074Sgaborvoid		open_patch_file(const char *);
44246074Sgaborvoid		set_hunkmax(void);
45246074Sgaborbool		there_is_another_patch(void);
46246074Sgaborbool		another_hunk(void);
47246074Sgaborbool		pch_swap(void);
48246074Sgaborchar		*pfetch(LINENUM);
49246074Sgaborshort		pch_line_len(LINENUM);
50246074SgaborLINENUM		pch_first(void);
51246074SgaborLINENUM		pch_ptrn_lines(void);
52246074SgaborLINENUM		pch_newfirst(void);
53246074SgaborLINENUM		pch_repl_lines(void);
54246074SgaborLINENUM		pch_end(void);
55246074SgaborLINENUM		pch_context(void);
56246074SgaborLINENUM		pch_hunk_beg(void);
57246074Sgaborchar		pch_char(LINENUM);
58246074Sgaborvoid		do_ed_script(void);
59