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