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