1*2dd076b8SGabor Kovesdan /* $FreeBSD$ */ 2*2dd076b8SGabor Kovesdan /*- 3*2dd076b8SGabor Kovesdan * 4*2dd076b8SGabor Kovesdan * Copyright 1986, Larry Wall 5*2dd076b8SGabor Kovesdan * 6*2dd076b8SGabor Kovesdan * Redistribution and use in source and binary forms, with or without 7*2dd076b8SGabor Kovesdan * modification, are permitted provided that the following condition is met: 8*2dd076b8SGabor Kovesdan * 1. Redistributions of source code must retain the above copyright notice, 9*2dd076b8SGabor Kovesdan * this condition and the following disclaimer. 10*2dd076b8SGabor Kovesdan * 11*2dd076b8SGabor Kovesdan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 12*2dd076b8SGabor Kovesdan * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 13*2dd076b8SGabor Kovesdan * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14*2dd076b8SGabor Kovesdan * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 15*2dd076b8SGabor Kovesdan * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16*2dd076b8SGabor Kovesdan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17*2dd076b8SGabor Kovesdan * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18*2dd076b8SGabor Kovesdan * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 19*2dd076b8SGabor Kovesdan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 20*2dd076b8SGabor Kovesdan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 21*2dd076b8SGabor Kovesdan * SUCH DAMAGE. 22*2dd076b8SGabor Kovesdan * 23*2dd076b8SGabor Kovesdan * patch - a program to apply diffs to original files 24*2dd076b8SGabor Kovesdan * 25*2dd076b8SGabor Kovesdan * -C option added in 1998, original code by Marc Espie, based on FreeBSD 26*2dd076b8SGabor Kovesdan * behaviour 27*2dd076b8SGabor Kovesdan * 28*2dd076b8SGabor Kovesdan * $OpenBSD: pch.h,v 1.9 2003/10/31 20:20:45 millert Exp $ 29*2dd076b8SGabor Kovesdan * $DragonFly: src/usr.bin/patch/pch.h,v 1.1 2004/09/24 18:44:28 joerg Exp $ 30*2dd076b8SGabor Kovesdan */ 31*2dd076b8SGabor Kovesdan 32*2dd076b8SGabor Kovesdan #define OLD_FILE 0 33*2dd076b8SGabor Kovesdan #define NEW_FILE 1 34*2dd076b8SGabor Kovesdan #define INDEX_FILE 2 35*2dd076b8SGabor Kovesdan #define MAX_FILE 3 36*2dd076b8SGabor Kovesdan 37*2dd076b8SGabor Kovesdan struct file_name { 38*2dd076b8SGabor Kovesdan char *path; 39*2dd076b8SGabor Kovesdan bool exists; 40*2dd076b8SGabor Kovesdan }; 41*2dd076b8SGabor Kovesdan 42*2dd076b8SGabor Kovesdan void re_patch(void); 43*2dd076b8SGabor Kovesdan void open_patch_file(const char *); 44*2dd076b8SGabor Kovesdan void set_hunkmax(void); 45*2dd076b8SGabor Kovesdan bool there_is_another_patch(void); 46*2dd076b8SGabor Kovesdan bool another_hunk(void); 47*2dd076b8SGabor Kovesdan bool pch_swap(void); 48*2dd076b8SGabor Kovesdan char *pfetch(LINENUM); 49*2dd076b8SGabor Kovesdan short pch_line_len(LINENUM); 50*2dd076b8SGabor Kovesdan LINENUM pch_first(void); 51*2dd076b8SGabor Kovesdan LINENUM pch_ptrn_lines(void); 52*2dd076b8SGabor Kovesdan LINENUM pch_newfirst(void); 53*2dd076b8SGabor Kovesdan LINENUM pch_repl_lines(void); 54*2dd076b8SGabor Kovesdan LINENUM pch_end(void); 55*2dd076b8SGabor Kovesdan LINENUM pch_context(void); 56*2dd076b8SGabor Kovesdan LINENUM pch_hunk_beg(void); 57*2dd076b8SGabor Kovesdan char pch_char(LINENUM); 58*2dd076b8SGabor Kovesdan void do_ed_script(void); 59