1c665ca9cSbostic /*- 2*232a0cefSbostic * Copyright (c) 1991, 1993 3*232a0cefSbostic * The Regents of the University of California. All rights reserved. 4c665ca9cSbostic * 5c665ca9cSbostic * %sccs.include.proprietary.c% 6c665ca9cSbostic * 7*232a0cefSbostic * @(#)diff.h 8.1 (Berkeley) 06/06/93 8c665ca9cSbostic */ 9a1e97be6Sbill 10a1e97be6Sbill /* 11a1e97be6Sbill * diff - common declarations 12a1e97be6Sbill */ 13a1e97be6Sbill 14a1e97be6Sbill #include <stdio.h> 15a1e97be6Sbill #include <ctype.h> 161fb337d9Smckusick #include <sys/param.h> 17a1e97be6Sbill #include <sys/stat.h> 182d468af0Ssam #include <sys/dir.h> 19a1e97be6Sbill #include <signal.h> 20a1e97be6Sbill 21a1e97be6Sbill /* 22a1e97be6Sbill * Output format options 23a1e97be6Sbill */ 24a1e97be6Sbill int opt; 25a1e97be6Sbill 26a1e97be6Sbill #define D_NORMAL 0 /* Normal output */ 27a1e97be6Sbill #define D_EDIT -1 /* Editor script out */ 28a1e97be6Sbill #define D_REVERSE 1 /* Reverse editor script */ 29a1e97be6Sbill #define D_CONTEXT 2 /* Diff with context */ 30a1e97be6Sbill #define D_IFDEF 3 /* Diff with merged #ifdef's */ 31d25498bcSvan #define D_NREVERSE 4 /* Reverse ed script with numbered 32d25498bcSvan lines and no trailing . */ 33a1e97be6Sbill 3459cde04bSvan int tflag; /* expand tabs on output */ 3559cde04bSvan 36a1e97be6Sbill /* 37a1e97be6Sbill * Algorithm related options 38a1e97be6Sbill */ 39a1e97be6Sbill int hflag; /* -h, use halfhearted DIFFH */ 4059cde04bSvan int bflag; /* ignore blanks in comparisons */ 4159cde04bSvan int wflag; /* totally ignore blanks in comparisons */ 4259cde04bSvan int iflag; /* ignore case in comparisons */ 43a1e97be6Sbill 44a1e97be6Sbill /* 45a1e97be6Sbill * Options on hierarchical diffs. 46a1e97be6Sbill */ 47a1e97be6Sbill int lflag; /* long output format with header */ 48a1e97be6Sbill int rflag; /* recursively trace directories */ 49a1e97be6Sbill int sflag; /* announce files which are same */ 50a787a4ecSralph char *Start; /* do file only if name >= this */ 51a1e97be6Sbill 52a1e97be6Sbill /* 53a1e97be6Sbill * Variables for -I D_IFDEF option. 54a1e97be6Sbill */ 55a1e97be6Sbill int wantelses; /* -E */ 56a1e97be6Sbill char *ifdef1; /* String for -1 */ 57a1e97be6Sbill char *ifdef2; /* String for -2 */ 58a1e97be6Sbill char *endifname; /* What we will print on next #endif */ 59a1e97be6Sbill int inifdef; 60a1e97be6Sbill 61a1e97be6Sbill /* 62a1e97be6Sbill * Variables for -c context option. 63a1e97be6Sbill */ 64a1e97be6Sbill int context; /* lines of context to be printed */ 65a1e97be6Sbill 66a1e97be6Sbill /* 67a1e97be6Sbill * State for exit status. 68a1e97be6Sbill */ 69a1e97be6Sbill int status; 70a1e97be6Sbill int anychange; 71acd758a5Sbostic char tempfile[]; /* used when comparing against std input */ 72a1e97be6Sbill 73a1e97be6Sbill /* 74a1e97be6Sbill * Variables for diffdir. 75a1e97be6Sbill */ 76a1e97be6Sbill char **diffargv; /* option list to pass to recursive diffs */ 77a1e97be6Sbill 78a1e97be6Sbill /* 79a1e97be6Sbill * Input file names. 80a1e97be6Sbill * With diffdir, file1 and file2 are allocated BUFSIZ space, 81a1e97be6Sbill * and padded with a '/', and then efile0 and efile1 point after 82a1e97be6Sbill * the '/'. 83a1e97be6Sbill */ 84a1e97be6Sbill char *file1, *file2, *efile1, *efile2; 85a1e97be6Sbill struct stat stb1, stb2; 86a1e97be6Sbill 87a1e97be6Sbill char *malloc(), *talloc(), *ralloc(); 88a1e97be6Sbill char *savestr(), *splice(), *splicen(); 89a1e97be6Sbill char *mktemp(), *copytemp(), *rindex(); 90b74df421Sbostic void done(); 91a1e97be6Sbill 92a1e97be6Sbill extern char diffh[], diff[], pr[]; 93