/* $Header: common.h,v 2.0 86/09/17 15:36:39 lwall Exp $
* Revision 2.0 86/09/17 15:36:39 lwall
* Baseline for netwide release.
/* shut lint up about the following when return value ignored */
#define Signal (void)signal
#define Unlink (void)unlink
#define Lseek (void)lseek
#define Fseek (void)fseek
#define Fstat (void)fstat
#define Pclose (void)pclose
#define Close (void)close
#define Fclose (void)fclose
#define Fflush (void)fflush
#define Sprintf (void)sprintf
#define Mktemp (void)mktemp
#define Strcpy (void)strcpy
#define Strcat (void)strcat
#define MAXHUNKSIZE 100000 /* is this enough lines? */
#define INITHUNKMAX 125 /* initial dynamic allocation size */
#define CHECKOUT "co -l %s"
#define Nullch Null(char *)
#define Nullfp Null(FILE *)
#define Nulline Null(LINENUM)
#define Ctl(ch) ((ch) & 037)
#define strNE(s1,s2) (strcmp(s1, s2))
#define strEQ(s1,s2) (!strcmp(s1, s2))
#define strnNE(s1,s2,l) (strncmp(s1, s2, l))
#define strnEQ(s1,s2,l) (!strncmp(s1, s2, l))
typedef long LINENUM
; /* must be signed */
typedef unsigned MEM
; /* what to feed malloc */
EXT
int Argc
; /* guess */
EXT
int Argc_last
; /* for restarting plan_b */
EXT
struct stat filestat
; /* file statistics area */
EXT
int filemode
INIT(0644);
EXT
char buf
[MAXLINELEN
]; /* general purpose buffer */
EXT
FILE *ofp
INIT(Nullfp
); /* output file pointer */
EXT
FILE *rejfp
INIT(Nullfp
); /* reject file pointer */
EXT
bool using_plan_a
INIT(TRUE
); /* try to keep everything in memory */
EXT
bool out_of_mem
INIT(FALSE
); /* ran out of memory in plan a */
EXT
int filec
INIT(0); /* how many file arguments? */
EXT
char *filearg
[MAXFILEC
];
EXT
bool ok_to_create_file
INIT(FALSE
);
EXT
char *bestguess
INIT(Nullch
); /* guess at correct filename */
EXT
char *outname
INIT(Nullch
);
EXT
char *origext
INIT(Nullch
);
EXT
char TMPOUTNAME
[] INIT("/tmp/patchoXXXXXX");
EXT
char TMPINNAME
[] INIT("/tmp/patchiXXXXXX"); /* might want /usr/tmp here */
EXT
char TMPREJNAME
[] INIT("/tmp/patchrXXXXXX");
EXT
char TMPPATNAME
[] INIT("/tmp/patchpXXXXXX");
EXT
bool toutkeep
INIT(FALSE
);
EXT
bool trejkeep
INIT(FALSE
);
EXT LINENUM last_offset
INIT(0);
EXT LINENUM maxfuzz
INIT(2);
EXT
bool force
INIT(FALSE
);
EXT
bool verbose
INIT(TRUE
);
EXT
bool reverse
INIT(FALSE
);
EXT
bool noreverse
INIT(FALSE
);
EXT
bool skip_rest_of_patch
INIT(FALSE
);
EXT
int strippath
INIT(957);
EXT
bool canonicalize
INIT(FALSE
);
#define NEW_CONTEXT_DIFF 4
EXT
int diff_type
INIT(0);
EXT
bool do_defines
INIT(FALSE
); /* patch using ifdef, ifndef, etc. */
EXT
char if_defined
[128]; /* #ifdef xyzzy */
EXT
char not_defined
[128]; /* #ifndef xyzzy */
EXT
char else_defined
[] INIT("#else\n");/* #else */
EXT
char end_defined
[128]; /* #endif xyzzy */
EXT
char *revision
INIT(Nullch
); /* prerequisite revision, if any */
char *sprintf(); /* usually */