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