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