1315051Sbapt 2315051Sbapt 3315051Sbapt/*ROR 4315051Sbapt * Copyright (c) 1991, 1993 5315051Sbapt * The Regents of the University of California. All rights reserved. 6315051Sbapt * 7315051Sbapt * Redistribution and use in source and binary forms, with or without 8315051Sbapt * modification, are permitted provided that the following conditions 9315051Sbapt * are met: 10315051Sbapt * 1. Redistributions of source code must retain the above copyright 11315051Sbapt * notice, this list of conditions and the following disclaimer. 12315051Sbapt * 2. Redistributions in binary form must reproduce the above copyright 13315051Sbapt * notice, this list of conditions and the following disclaimer in the 14315051Sbapt * documentation and/or other materials provided with the distribution. 15315051Sbapt * 3. Neither the name of the University nor the names of its contributors 16315051Sbapt * may be used to endorse or promote products derived from this software 17315051Sbapt * without specific prior written permission. 18315051Sbapt * 19315051Sbapt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20315051Sbapt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21315051Sbapt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22315051Sbapt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23315051Sbapt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24315051Sbapt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25315051Sbapt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26315051Sbapt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27315051Sbapt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28315051Sbapt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29315051Sbapt * SUCH DAMAGE. 30315051Sbapt * 31315051Sbapt * @(#)diff.h 8.1 (Berkeley) 6/6/93 32315051Sbapt * $FreeBSD: stable/11/usr.bin/diff/diff.h 339160 2018-10-03 17:16:18Z kevans $ 33315051Sbapt */ 34315051Sbapt 35315051Sbapt#include <sys/types.h> 36315051Sbapt#include <regex.h> 37315051Sbapt 38315051Sbapt/* 39315051Sbapt * Output format options 40315051Sbapt */ 41315051Sbapt#define D_NORMAL 0 /* Normal output */ 42315051Sbapt#define D_EDIT -1 /* Editor script out */ 43315051Sbapt#define D_REVERSE 1 /* Reverse editor script */ 44315051Sbapt#define D_CONTEXT 2 /* Diff with context */ 45315051Sbapt#define D_UNIFIED 3 /* Unified context diff */ 46315051Sbapt#define D_IFDEF 4 /* Diff with merged #ifdef's */ 47315051Sbapt#define D_NREVERSE 5 /* Reverse ed script with numbered 48315051Sbapt lines and no trailing . */ 49315051Sbapt#define D_BRIEF 6 /* Say if the files differ */ 50331465Sian#define D_GFORMAT 7 /* Diff with defined changed group format */ 51315051Sbapt 52315051Sbapt/* 53315051Sbapt * Output flags 54315051Sbapt */ 55315051Sbapt#define D_HEADER 0x001 /* Print a header/footer between files */ 56315051Sbapt#define D_EMPTY1 0x002 /* Treat first file as empty (/dev/null) */ 57315051Sbapt#define D_EMPTY2 0x004 /* Treat second file as empty (/dev/null) */ 58315051Sbapt 59315051Sbapt/* 60315051Sbapt * Command line flags 61315051Sbapt */ 62315051Sbapt#define D_FORCEASCII 0x008 /* Treat file as ascii regardless of content */ 63315051Sbapt#define D_FOLDBLANKS 0x010 /* Treat all white space as equal */ 64315051Sbapt#define D_MINIMAL 0x020 /* Make diff as small as possible */ 65315051Sbapt#define D_IGNORECASE 0x040 /* Case-insensitive matching */ 66315051Sbapt#define D_PROTOTYPE 0x080 /* Display C function prototype */ 67315051Sbapt#define D_EXPANDTABS 0x100 /* Expand tabs to spaces */ 68315051Sbapt#define D_IGNOREBLANKS 0x200 /* Ignore white space changes */ 69315051Sbapt#define D_STRIPCR 0x400 /* Strip trailing cr */ 70339160Skevans#define D_SKIPBLANKLINES 0x800 /* Skip blank lines */ 71315051Sbapt 72315051Sbapt/* 73315051Sbapt * Status values for print_status() and diffreg() return values 74315051Sbapt */ 75315051Sbapt#define D_SAME 0 /* Files are the same */ 76315051Sbapt#define D_DIFFER 1 /* Files are different */ 77315051Sbapt#define D_BINARY 2 /* Binary files are different */ 78315051Sbapt#define D_MISMATCH1 3 /* path1 was a dir, path2 a file */ 79315051Sbapt#define D_MISMATCH2 4 /* path1 was a file, path2 a dir */ 80315051Sbapt#define D_SKIPPED1 5 /* path1 was a special file */ 81315051Sbapt#define D_SKIPPED2 6 /* path2 was a special file */ 82315051Sbapt 83315051Sbaptstruct excludes { 84315051Sbapt char *pattern; 85315051Sbapt struct excludes *next; 86315051Sbapt}; 87315051Sbapt 88315051Sbaptextern int lflag, Nflag, Pflag, rflag, sflag, Tflag, cflag; 89315051Sbaptextern int diff_format, diff_context, status, ignore_file_case; 90315051Sbaptextern int tabsize; 91315051Sbaptextern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; 92331465Sianextern char *group_format; 93315051Sbaptextern struct stat stb1, stb2; 94315051Sbaptextern struct excludes *excludes_list; 95315051Sbaptextern regex_t ignore_re; 96315051Sbapt 97315051Sbaptchar *splice(char *, char *); 98315051Sbaptint diffreg(char *, char *, int, int); 99315051Sbaptint easprintf(char **, const char *, ...); 100315051Sbaptvoid *emalloc(size_t); 101315051Sbaptvoid *erealloc(void *, size_t); 102315051Sbaptvoid diffdir(char *, char *, int); 103315051Sbaptvoid print_only(const char *, size_t, const char *); 104315051Sbaptvoid print_status(int, char *, char *, const char *); 105