--- /diff-2.1/alloca.c Thu Feb 04 01:32:24 1993 +++ alloca.c Sun Feb 14 03:04:06 1993 @@ -58,8 +58,14 @@ #define NULL 0 /* null pointer constant */ +#ifdef KULTUR +pointer alloca (unsigned size); +extern void free (pointer); +extern pointer xmalloc (unsigned); +#else extern void free(); extern pointer xmalloc(); +#endif /* Define STACK_DIRECTION if you know the direction of stack --- /diff-2.1/analyze.c Wed Sep 30 15:21:58 1992 +++ analyze.c Sun Feb 14 01:30:16 1993 @@ -23,6 +23,15 @@ #include "diff.h" +#ifdef KULTUR +static int diag (int, int, int, int, int *); +static struct change *add_change (int, int, int, int, struct change *); +static struct change *build_reverse_script (struct file_data []); +static struct change *build_script (struct file_data []); +static void compareseq (int, int, int, int); +static void discard_confusing_lines (struct file_data []); +static void shift_boundaries (struct file_data []); +#else int read_files (); void finish_output (); void print_context_script (); @@ -33,6 +42,7 @@ void print_rcs_script (); void pr_forward_ed_script (); void setup_output (); +#endif extern int no_discards; @@ -259,12 +269,18 @@ files[0].changed_flag[files[0].realindexes[xoff++]] = 1; else { +#ifdef KULTUR + int c, d, b; +#else int c, d, f, b; +#endif /* Find a point of correspondence in the middle of the files. */ d = diag (xoff, xlim, yoff, ylim, &c); +#ifndef KULTUR f = fdiag[d]; +#endif b = bdiag[d]; if (c == 1) @@ -308,7 +324,7 @@ When we discard a line, we also mark it as a deletion or insertion so that it will be printed in the output. */ -void +static void discard_confusing_lines (filevec) struct file_data filevec[]; { @@ -919,7 +935,11 @@ free (filevec[i].equivs); for (i = 0; i < 2; ++i) +#ifdef KULTUR + free ((VOID *) (filevec[i].linbuf + filevec[i].linbuf_base)); +#else free (filevec[i].linbuf + filevec[i].linbuf_base); +#endif for (e = script; e; e = p) { --- /diff-2.1/cmp.c Thu Feb 04 01:00:04 1993 +++ cmp.c Sun Feb 14 02:45:11 1993 @@ -21,6 +21,19 @@ #include "system.h" #include "getopt.h" +#ifdef KULTUR +extern void *xmalloc (unsigned); +extern void error (int, int, char *, ...); +static int block_compare_and_count (int *count, char *p1, char *p2, unsigned char c); +static int block_compare (char *p1, char *p2); +static int block_read (int fd, char *buf, int nchars); +static void printc (FILE *fs, int width, unsigned c); +static void usage (char *reason); +static int cmp (void); +#ifdef AMIGA +static void fake_stat_result (struct stat *sbuf); +#endif +#else char *xmalloc (); int block_compare (); int block_compare_and_count (); @@ -31,6 +44,7 @@ #ifdef AMIGA void fake_stat_result (); #endif /* AMIGA */ +#endif /* Name under which this program was invoked. */ char *program_name; @@ -74,7 +88,7 @@ {NULL, 0, NULL, 0} }; -void +static void usage (reason) char *reason; { @@ -253,7 +267,7 @@ using `buf1' and `buf2'. Return 0 if identical, 1 if different, >1 if error. */ -int +static int cmp () { long line_number = 1; /* Line number (1...) of first difference. */ @@ -386,11 +400,15 @@ Return the offset of the first byte that differs. Place the count at the address pointed to by COUNT. */ -int +static int +#ifdef KULTUR +block_compare_and_count (int *count, char *p1, char *p2, unsigned char c) +#else block_compare_and_count (count, p1, p2, c) int *count; char *p1, *p2; unsigned char c; +#endif { long w; /* Word for counting C. */ long i1, i2; /* One word from each buffer to compare. */ @@ -448,7 +466,7 @@ Return the offset of the first byte that differs. */ -int +static int block_compare (p1, p2) char *p1, *p2; { @@ -472,7 +490,7 @@ /* Read NCHARS bytes from descriptor FD into BUF. Return the number of characters successfully read. */ -int +static int block_read (fd, buf, nchars) int fd; char *buf; @@ -498,7 +516,7 @@ visible by quoting like cat -t does. Pad with spaces on the right to WIDTH characters. */ -void +static void printc (fs, width, c) FILE *fs; int width; @@ -530,7 +548,7 @@ } #ifdef AMIGA -void fake_stat_result (sbuf) +static void fake_stat_result (sbuf) struct stat *sbuf; { time_t cur_time; --- /diff-2.1/context.c Mon Oct 19 10:33:04 1992 +++ context.c Sun Feb 14 01:18:18 1993 @@ -19,11 +19,22 @@ #include "diff.h" +#ifdef KULTUR +static struct change *find_hunk (struct change *); +static void find_function (struct file_data *, int, const char **, int *); +static void mark_ignorable (struct change *); +static void print_context_label (const char *, struct file_data *, const char *); +static void print_context_number_range (struct file_data *, int, int); +static void print_unidiff_number_range (struct file_data *, int, int); +static void pr_context_hunk (struct change *); +static void pr_unidiff_hunk (struct change *); +#else static void pr_context_hunk (); static void pr_unidiff_hunk (); static struct change *find_hunk (); static void mark_ignorable (); static void find_function (); +#endif /* Last place find_function started searching from. */ static int find_function_last_search; --- /diff-2.1/diff.c Thu Feb 04 16:38:14 1993 +++ diff.c Sun Feb 14 06:11:06 1993 @@ -33,6 +33,18 @@ #define GUTTER_WIDTH_MINIMUM 3 #endif +#ifdef KULTUR +static char *option_list (char **, int); +static int add_exclude_file (void); +static int ck_atoi (char *, int *); +static int compare_files (char *, char *, char *, char *, int); +static int fake_stat_result (struct stat *); +static int specify_format (const char **, const char *); +static void add_exclude (const char *); +static void add_regexp (struct regexp_list **, char *); +static void specify_style (enum output_style); +static void usage (void); +#else int diff_dirs (); int diff_2_files (); @@ -44,6 +56,7 @@ #ifdef AMIGA static int fake_stat_result (); #endif /* AMIGA */ +#endif /* Nonzero for -r: if comparing two directories, compare their common subdirectories recursively. */ @@ -126,14 +139,18 @@ exclude = (const char **) (exclude_alloc == 0 ? xmalloc ((exclude_alloc = 64) * sizeof (*exclude)) - : xrealloc (exclude, (exclude_alloc *= 2) * sizeof (*exclude))); + : xrealloc ((VOID *)exclude, (exclude_alloc *= 2) * sizeof (*exclude))); exclude[exclude_count++] = pattern; } static int +#ifdef KULTUR +add_exclude_file (void) +#else add_exclude_file (name) const char *name; +#endif { struct file_data f; char *p, *q, *lim; @@ -480,7 +497,11 @@ break; case 'X': +#ifdef KULTUR + if (add_exclude_file () != 0) +#else if (add_exclude_file (optarg) != 0) +#endif pfatal_with_name (optarg); break; @@ -582,8 +603,8 @@ if (!group_format[UNCHANGED]) group_format[UNCHANGED] = "%="; if (!group_format[CHANGED]) - group_format[CHANGED] = concat (group_format[OLD], - group_format[NEW], ""); + group_format[CHANGED] = concat ((char *) group_format[OLD], + (char *) group_format[NEW], ""); } no_diff_means_no_output = @@ -621,7 +642,7 @@ r->buf.fastmap = (char *) xmalloc (256); m = re_compile_pattern (pattern, strlen (pattern), &r->buf); if (m != 0) - error ("%s: %s", pattern, m); + error ("%s: %s", pattern, (char *) m); /* Add to the start of the list, since it's easier than the end. */ r->next = *reglist; --- /diff-2.1/diff.h Wed Sep 30 15:21:58 1992 +++ diff.h Sun Feb 14 00:34:47 1993 @@ -306,6 +306,10 @@ #else #define VOID char #endif + +#ifdef KULTUR +#include "Diff_Protos.h" +#else VOID *xmalloc (); VOID *xrealloc (); char *concat (); @@ -330,3 +334,4 @@ void print_script (); void slurp (); void translate_range (); +#endif --- /diff-2.1/diff3.c Thu Feb 04 16:47:00 1993 +++ diff3.c Sun Feb 14 03:30:24 1993 @@ -30,10 +30,16 @@ #ifdef AMIGA #include +#ifdef KULTUR +#pragma msg 149 ignore push +#endif #include #include #include #include +#ifdef KULTUR +#pragma msg 149 pop +#endif extern struct DosLibrary *DOSBase; #endif /* AMIGA */ @@ -186,6 +192,33 @@ /* * Forward function declarations. */ +#ifdef KULTUR +#define bcmp(a,b,c) memcmp(a,b,c) +#define bcopy(a,b,c) memmove(b,a,c) +#define bzero(a,b) memset(a,0,b) +static void usage (void); +static struct diff3_block *make_3way_diff (struct diff_block *, struct diff_block *); +static struct diff3_block *using_to_diff3_block (struct diff_block *[2], struct diff_block *[2], int, int, struct diff3_block *); +static int copy_stringlist (char *[], int *, char *[], int *, int); +static struct diff3_block *create_diff3_block (int, int, int, int, int, int); +static int compare_line_list (char *[], int *, char *[], int *, int); +static struct diff_block *process_diff (char *, char *); +static enum diff_type process_diff_control (char **, struct diff_block *); +static char *read_diff (char *, char *, char **); +static char *scan_diff_line (char *, char **, int *, char *, char); +static void output_diff3 (FILE *, struct diff3_block *, int [3], int [3]); +static int dotlines (FILE *, struct diff3_block *b, int); +static void undotlines (FILE *, int, int, int); +static int output_diff3_edscript (FILE *, struct diff3_block *, int [3], int [3], char *, char *, char *); +static int output_diff3_merge (FILE *, FILE *, struct diff3_block *, int [3], int [3], char *, char *, char *); +static struct diff3_block *reverse_diff3_blocklist (struct diff3_block *); +static int myread (int fd, char *ptr, int size); +static void fatal (char *); +static void perror_with_exit (char *); +VOID *xmalloc (unsigned); +static VOID *xrealloc (VOID *, unsigned); +#define DIFF_PROGRAM "diff" +#else static int myread (); static void fatal (); static void perror_with_exit (); @@ -214,6 +247,8 @@ #endif /* !AMIGA */ static VOID *xrealloc (); +#endif + static char diff_program[] = DIFF_PROGRAM; static struct option longopts[] = @@ -1201,6 +1236,17 @@ perror_with_exit ("pipe failed"); /* Child process runs asynchronously with pipe as stdout */ +#ifdef KULTUR + STags[0].ti_Tag = (Tag) SYS_Input; + STags[0].ti_Data = NULL; + STags[1].ti_Tag = (Tag) SYS_Output; + STags[1].ti_Data = StdOutDiff; + STags[2].ti_Tag = (Tag) SYS_Asynch; + STags[2].ti_Data = TRUE; + STags[3].ti_Tag = (Tag) SYS_UserShell; + STags[3].ti_Data = TRUE; + STags[4].ti_Tag = TAG_DONE; +#else STags[0].ti_Tag = SYS_Input; STags[0].ti_Data = NULL; STags[1].ti_Tag = SYS_Output; @@ -1210,6 +1256,9 @@ STags[3].ti_Tag = SYS_UserShell; STags[3].ti_Data = TRUE; STags[4].ti_Tag = TAG_DONE; +#endif + STags[3].ti_Data = TRUE; + STags[4].ti_Tag = TAG_DONE; /* Start child process */ if ((System (diff_command_line, STags)) != 0) { Close (StdOutDiff); @@ -1268,12 +1317,16 @@ * This next routine began life as a macro and many parameters in it * are used as call-by-reference values. */ +#ifdef KULTUR +static char *scan_diff_line (char *scan_ptr, char **set_start, int *set_length, char *limit, char firstchar) +#else static char * scan_diff_line (scan_ptr, set_start, set_length, limit, firstchar) char *scan_ptr, **set_start; int *set_length; char *limit; char firstchar; +#endif { char *line_ptr; --- /diff-2.1/dir.c Thu Feb 04 01:26:24 1993 +++ dir.c Sun Feb 14 02:23:56 1993 @@ -19,8 +19,6 @@ #include "diff.h" -static int compare_names (); - /* Read the directory named by DIR and store into DIRDATA a sorted vector of filenames for its contents. DIR->desc == -1 means this directory is known to be nonexistent, so set DIRDATA to an empty vector. @@ -32,6 +30,13 @@ char *data; /* Allocated storage for file names. */ }; +#ifdef KULTUR +static int compare_names (char **file1, char **file2); +static int dir_sort (struct file_data *dir, struct dirdata *dirdata); +#else +static int compare_names (); +#endif + static int dir_sort (dir, dirdata) struct file_data *dir; @@ -152,7 +157,11 @@ int diff_dirs (filevec, handle_file, depth) struct file_data filevec[]; +#ifdef KULTUR + int (*handle_file) (char *, char *, char *, char *, int); +#else int (*handle_file) (); +#endif int depth; { struct dirdata dirdata[2]; --- /diff-2.1/ed.c Sun Sep 06 11:35:52 1992 +++ ed.c Sun Feb 14 01:04:06 1993 @@ -19,6 +19,11 @@ #include "diff.h" +#ifdef KULTUR +static void print_ed_hunk (struct change *); +static void print_rcs_hunk (struct change *); +static void pr_forward_ed_hunk (struct change *); +#else int change_letter (); int translate_line_number (); static void print_rcs_hunk (); @@ -27,6 +32,7 @@ void translate_range (); struct change *find_change (); struct change *find_reverse_change (); +#endif /* Print our script as ed commands. */ --- /diff-2.1/error.c Sun Jul 19 01:23:10 1992 +++ error.c Sun Feb 14 02:57:48 1993 @@ -19,6 +19,10 @@ #include +#ifdef KULTUR +void error (int status, int errnum, char *message, ...); +#endif + #ifdef HAVE_VPRINTF #if __STDC__ --- /diff-2.1/getopt.c Thu Feb 04 01:30:10 1993 +++ getopt.c Sun Feb 14 04:06:48 1993 @@ -152,6 +152,16 @@ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; +#ifdef KULTUR +#include +#include +#define my_index strchr +#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) + +static void exchange (char **); +int getopt (int, char *const *, const char *); +#else + #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. @@ -191,6 +201,7 @@ to[i] = from[i]; } #endif /* GNU C library. */ +#endif /* Handle permutation of arguments. */ @@ -215,7 +226,11 @@ char **argv; { int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); +#ifdef KULTUR + char **temp = (char **) malloc (nonopts_size); +#else char **temp = (char **) __alloca (nonopts_size); +#endif /* Interchange the two blocks of data in ARGV. */ @@ -230,6 +245,9 @@ first_nonopt += (optind - last_nonopt); last_nonopt = optind; +#ifdef KULTUR + free (temp); +#endif } /* Scan elements of ARGV (whose length is ARGC) for option characters --- /diff-2.1/ifdef.c Wed Sep 30 15:21:58 1992 +++ ifdef.c Sun Feb 14 02:55:08 1993 @@ -21,10 +21,16 @@ #include "diff.h" +#ifdef KULTUR +static void print_ifdef_hunk (struct change *hunk); +static void format_ifdef (const char *format, int beg0, int end0, int beg1, int end1); +static void print_ifdef_lines (const char *format, const struct file_data *current, int from, int upto); +#else static void format_ifdef (); static void print_ifdef_hunk (); static void print_ifdef_lines (); struct change *find_change (); +#endif static int next_line; --- /diff-2.1/io.c Tue Nov 24 00:44:32 1992 +++ io.c Sun Feb 14 01:08:30 1993 @@ -26,7 +26,13 @@ /* Given a hash value and a new character, return a new hash value. */ #define HASH(h, c) ((c) + ROL (h, 7)) +#ifdef KULTUR +static void find_and_hash_each_line (struct file_data *); +static void find_identical_ends (struct file_data []); +static void prepare_text_end (struct file_data *); +#else int line_cmp (); +#endif /* Guess remaining number of lines from number N of lines so far, size S so far, and total size T. */ @@ -326,7 +332,7 @@ /* Double (alloc_lines - linbuf_base) by adding to alloc_lines. */ alloc_lines = 2 * alloc_lines - linbuf_base; cureqs = (int *) xrealloc (cureqs, alloc_lines * sizeof (*cureqs)); - linbuf = (const char **) xrealloc (linbuf + linbuf_base, + linbuf = (const char **) xrealloc ((VOID *) (linbuf + linbuf_base), (alloc_lines - linbuf_base) * sizeof (*linbuf)) - linbuf_base; @@ -347,7 +353,7 @@ { /* Double (alloc_lines - linbuf_base) by adding to alloc_lines. */ alloc_lines = 2 * alloc_lines - linbuf_base; - linbuf = (const char **) xrealloc (linbuf + linbuf_base, + linbuf = (const char **) xrealloc ((VOID *)(linbuf + linbuf_base), (alloc_lines - linbuf_base) * sizeof (*linbuf)) - linbuf_base; @@ -573,7 +579,7 @@ { int l = lines++ & prefix_mask; if (l == alloc_lines0) - linbuf0 = (const char **) xrealloc (linbuf0, (alloc_lines0 *= 2) + linbuf0 = (const char **) xrealloc ((VOID *)linbuf0, (alloc_lines0 *= 2) * sizeof(*linbuf0)); linbuf0[l] = p0; while (*p0++ != '\n') --- /diff-2.1/normal.c Tue Jul 07 14:23:06 1992 +++ normal.c Sun Feb 14 01:47:59 1993 @@ -20,10 +20,14 @@ #include "diff.h" +#ifdef KULTUR +static void print_normal_hunk (struct change *hunk); +#else int change_letter (); void print_normal_hunk (); void print_number_range (); struct change *find_change (); +#endif /* Print the edit-script SCRIPT as a normal diff. INF points to an array of descriptions of the two files. */ @@ -39,7 +43,7 @@ This is a contiguous portion of a complete edit script, describing changes in consecutive lines. */ -void +static void print_normal_hunk (hunk) struct change *hunk; { --- /diff-2.1/regex.c Thu Jan 07 07:47:10 1993 +++ regex.c Sun Feb 14 05:57:55 1993 @@ -90,6 +90,10 @@ static char re_syntax_table[CHAR_SET_SIZE]; +#ifdef KULTUR +static void init_syntax_once (void); +#endif + static void init_syntax_once () { @@ -124,6 +128,62 @@ /* Get the interface, including the syntax bits. */ #include "regex.h" +#ifdef KULTUR +#define register +void *alloca (unsigned); +#define MATCH_NULL_UNSET_VALUE 3 +typedef unsigned regnum_t; +typedef const unsigned char *fail_stack_elt_t; +typedef union { fail_stack_elt_t word; struct { unsigned match_null_string_p : +2; unsigned is_active : 1; unsigned matched_something : 1; unsigned +ever_matched_something : 1; } bits; } register_info_type; +typedef int pattern_offset_t; +typedef struct { pattern_offset_t begalt_offset; pattern_offset_t +fixup_alt_jump; pattern_offset_t inner_group_offset; pattern_offset_t +laststart_offset; regnum_t regnum; } compile_stack_elt_t; +typedef struct { compile_stack_elt_t *stack; unsigned size; unsigned avail; } +compile_stack_type; +typedef enum { no_op = 0, exactn = 1, anychar, charset, charset_not, +start_memory, stop_memory, duplicate, begline, endline, begbuf, endbuf, jump, +jump_past_alt, on_failure_jump, on_failure_keep_string_jump, pop_failure_jump, +maybe_pop_jump, dummy_failure_jump, push_dummy_failure, succeed_n, jump_n, +set_number_at, wordchar, notwordchar, wordbeg, wordend, wordbound, notwordbound +} re_opcode_t; +typedef char boolean; +static void init_syntax_once (void); +void print_fastmap (char *); +void print_partial_compiled_pattern (unsigned char *, unsigned char *); +void print_compiled_pattern (struct re_pattern_buffer *); +void print_double_string (const char *, const char *, const char *, int, int); +reg_syntax_t re_set_syntax (reg_syntax_t); +static reg_errcode_t regex_compile (const char *, int, reg_syntax_t, struct re_pattern_buffer *); +static void store_op1 (re_opcode_t, unsigned char *, int); +static void store_op2 (re_opcode_t, unsigned char *, int, int); +static void insert_op1 (re_opcode_t, unsigned char *, int, unsigned char *); +static void insert_op2 (re_opcode_t, unsigned char *, int, int, unsigned char *); +static boolean at_begline_loc_p (const char *, const char *, reg_syntax_t); +static boolean at_endline_loc_p (const char *, const char *, int); +static boolean group_in_compile_stack (compile_stack_type, regnum_t); +static reg_errcode_t compile_range (const char **, const char *, char *, reg_syntax_t, unsigned char *); +int re_compile_fastmap (struct re_pattern_buffer *); +void re_set_registers (struct re_pattern_buffer *, struct re_registers *, unsigned, regoff_t *, regoff_t *); +int re_search (struct re_pattern_buffer *, const char *, int, int, int, struct re_registers *); +int re_search_2 (struct re_pattern_buffer *, const char *, int, const char *, int, int, int, struct re_registers *, int); +int re_match (struct re_pattern_buffer *, const char *, int, int, struct re_registers *); +int re_match_2 (struct re_pattern_buffer *, const char *, int, const char *, int, int, struct re_registers *, int); +static boolean group_match_null_string_p (unsigned char **, unsigned char *, register_info_type *); +static boolean alt_match_null_string_p (unsigned char *, unsigned char *, register_info_type *); +static boolean common_op_match_null_string_p (unsigned char **, unsigned char *, register_info_type *); +static int bcmp_translate (unsigned char *, unsigned char *, int, char *); +const char *re_compile_pattern (const char *, int, struct re_pattern_buffer *); +char *re_comp (const char *); +int re_exec (const char *); +int regcomp (regex_t *, const char *, int); +int regexec (const regex_t *, const char *, size_t, regmatch_t [], int); +/* size_t regerror (int, const regex_t *, char *, size_t); */ +void regfree (regex_t *); +#endif + /* isalpha etc. are used for the character classes. */ #include @@ -197,7 +257,11 @@ #include #else /* not __GNUC__ or HAVE_ALLOCA_H */ #ifndef _AIX /* Already did AIX, up at the top. */ +#ifdef KULTUR +void *alloca (unsigned); +#else char *alloca (); +#endif #endif /* not _AIX */ #endif /* not HAVE_ALLOCA_H */ #endif /* not __GNUC__ */ @@ -207,10 +271,17 @@ #define REGEX_ALLOCATE alloca /* Assumes a `char *destination' variable. */ +#ifdef KULTUR +#define REGEX_REALLOCATE(source, osize, nsize) \ + (destination = (char *) alloca (nsize), \ + bcopy ((const void *)source, (void *)destination, (size_t) osize), \ + destination) +#else #define REGEX_REALLOCATE(source, osize, nsize) \ (destination = (char *) alloca (nsize), \ bcopy (source, destination, osize), \ destination) +#endif #endif /* not REGEX_MALLOC */ @@ -233,7 +304,9 @@ #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) +#ifndef KULTUR typedef char boolean; +#endif #define false 0 #define true 1 @@ -246,6 +319,7 @@ So regex.h defines a symbol `RE_EXACTN_VALUE' to be 1; the value of `exactn' we use here must also be 1. */ +#ifndef KULTUR typedef enum { no_op = 0, @@ -376,6 +450,7 @@ notsyntaxspec #endif /* emacs */ } re_opcode_t; +#endif /* Common operations on the compiled pattern. */ @@ -839,11 +914,13 @@ /* Subroutine declarations and macros for regex_compile. */ +#ifndef KULTUR static void store_op1 (), store_op2 (); static void insert_op1 (), insert_op2 (); static boolean at_begline_loc_p (), at_endline_loc_p (); static boolean group_in_compile_stack (); static reg_errcode_t compile_range (); +#endif /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant @@ -946,7 +1023,7 @@ bufp->allocated <<= 1; \ if (bufp->allocated > MAX_BUF_SIZE) \ bufp->allocated = MAX_BUF_SIZE; \ - bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\ + bufp->buffer = (unsigned char *) realloc (bufp->buffer, (size_t) bufp->allocated);\ if (bufp->buffer == NULL) \ return REG_ESPACE; \ /* If the buffer moved, move all the pointers into it. */ \ @@ -971,13 +1048,16 @@ /* But patterns can have more than `MAX_REGNUM' registers. We just ignore the excess. */ +#ifndef KULTUR typedef unsigned regnum_t; +#endif /* Macros for the compile stack. */ /* Since offsets can go either forwards or backwards, this type needs to be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ +#ifndef KULTUR typedef int pattern_offset_t; typedef struct @@ -996,7 +1076,7 @@ unsigned size; unsigned avail; /* Offset of next open position. */ } compile_stack_type; - +#endif #define INIT_COMPILE_STACK_SIZE 32 @@ -2126,11 +2206,11 @@ const char *prev = p - 2; boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; - return + return (boolean)( /* After a subexpression? */ (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) /* After an alternative? */ - || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)); + || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash))); } @@ -2146,13 +2226,13 @@ boolean next_backslash = *next == '\\'; const char *next_next = p + 1 < pend ? p + 1 : NULL; - return + return (boolean)( /* Before a subexpression? */ (syntax & RE_NO_BK_PARENS ? *next == ')' : next_backslash && next_next && *next_next == ')') /* Before an alternative? */ || (syntax & RE_NO_BK_VBAR ? *next == '|' - : next_backslash && next_next && *next_next == '|'); + : next_backslash && next_next && *next_next == '|')); } @@ -2250,7 +2330,9 @@ change it ourselves. */ int re_max_failures = 2000; +#ifndef KULTUR typedef const unsigned char *fail_stack_elt_t; +#endif typedef struct { @@ -2449,7 +2531,7 @@ Also assumes the variables `fail_stack' and (if debugging), `bufp', `pend', `string1', `size1', `string2', and `size2'. */ -#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ +#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info) \ { \ DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \ int this_reg; \ @@ -2981,6 +3063,7 @@ /* Declarations and macros for re_match_2. */ +#ifndef KULTUR static int bcmp_translate (); static boolean alt_match_null_string_p (), common_op_match_null_string_p (), @@ -3011,6 +3094,7 @@ unsigned ever_matched_something : 1; } bits; } register_info_type; +#endif #define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p) #define IS_ACTIVE(R) ((R).bits.is_active) @@ -3822,7 +3906,11 @@ /* Compare that many; failure if mismatch, else move past them. */ if (translate +#ifdef KULTUR + ? bcmp_translate ((unsigned char *) d, (unsigned char *) d2, mcnt, translate) +#else ? bcmp_translate (d, d2, mcnt, translate) +#endif : bcmp (d, d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; @@ -4862,6 +4950,7 @@ /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ +#ifdef INCLUDE_ALL_STUPID_FUNCTIONS size_t regerror (errcode, preg, errbuf, errbuf_size) int errcode; @@ -4895,7 +4984,7 @@ return msg_size; } - +#endif /* Free dynamically allocated space used by PREG. */ --- /diff-2.1/sdiff.c Thu Feb 04 03:18:16 1993 +++ sdiff.c Sun Feb 14 04:44:07 1993 @@ -26,10 +26,16 @@ #include "getopt.h" #ifdef AMIGA +#ifdef KULTUR +#pragma msg 149 ignore push +#endif #include #include #include #include +#ifdef KULTUR +#pragma msg 149 pop +#endif extern struct DosLibrary *DOSBase; #endif /* AMIGA */ @@ -38,6 +44,11 @@ #define SEEK_SET 0 #endif +#ifdef KULTUR +#define DIFF_PROGRAM "diff" +#define DEFAULT_EDITOR "ed -sticky" +#endif + /* Size of chunks read from files which must be parsed into lines. */ #define SDIFF_BUFSIZE 65536 @@ -62,6 +73,55 @@ static pid_t volatile diffpid; #endif /* !AMIGA */ +#ifdef KULTUR +#include +extern int onbreak(int (*)(void)); +extern FILE *fdopen(int, const char *); +#define bcopy(a,b,c) memmove(b,a,c) +#define index(a,b) strchr(a,b) +#define rindex(a,b) strrchr(a,b) +struct line_filter { + FILE *infile; + char *bufpos; + char *buffer; + char *buflim; +}; +char *xmalloc (unsigned); +static char command_line[512]; +static FILE *diff_file = NULL; +static int user_quit = 0; + +static char const *expand_name (char *, int, char const *); +static FILE *ck_fdopen (int, char *); +static FILE *ck_fopen (char *, char *); +static int amiga_break (void); +static int diraccess (const char *); +static int edit (struct line_filter *, int, struct line_filter *, int, FILE *); +static int exists (const char *); +static int interact (struct line_filter *, struct line_filter *, struct line_filter *, FILE *); +static int lf_snarf (struct line_filter *, char *, size_t); +static int skip_white (void); +static size_t ck_fread (char *, size_t, FILE *); +static size_t lf_refill (struct line_filter *); +static void amiga_exit (void); +static void ck_fclose (FILE *); +static void ck_fflush (FILE *); +static void ck_fwrite (char *, size_t, FILE *); +static void cleanup (void); +static void construct_command_line (char *, char **, char *); +static void construct_pipe_name (char *); +static void diffarg (char *); +static void execdiff (int, char *, char *, char *, long, BPTR); +static void exiterr (void); +static void fatal (char *); +static void flush_line (void); +static void give_help (void); +static void lf_copy (struct line_filter *, int, FILE *); +static void lf_init (struct line_filter *, FILE *); +static void lf_skip (struct line_filter *, int); +static void perror_fatal (char *); +static void usage (void); +#else struct line_filter; static void diffarg (); /* (char *); */ static void execdiff (); /* (int, char const *, char const *, char const *); */ @@ -89,6 +149,7 @@ #endif /* !AMIGA */ static int diraccess (); +#endif /* Options: */ @@ -381,12 +442,14 @@ +#ifndef KULTUR struct line_filter { FILE *infile; char *bufpos; char *buffer; char *buflim; }; +#endif static void lf_init (lf, infile) @@ -624,9 +687,9 @@ if (leftdir && rightdir) fatal ("both files to be compared are directories"); - left = ck_fopen (expand_name (argv[optind], leftdir, argv[optind + 1]), "r"); + left = ck_fopen ((char *) expand_name (argv[optind], leftdir, argv[optind + 1]), "r"); ; - right = ck_fopen (expand_name (argv[optind + 1], rightdir, argv[optind]), "r"); + right = ck_fopen ((char *) expand_name (argv[optind + 1], rightdir, argv[optind]), "r"); out = ck_fopen (out_file, "w"); #ifndef AMIGA @@ -805,9 +868,20 @@ diffarg (file2); diffarg (0); - construct_command_line (diffbin, diffargv, command_line); + construct_command_line ((char *) diffbin, diffargv, command_line); if (asynch) { +#ifdef KULTUR + STags[0].ti_Tag = (Tag) SYS_Input; + STags[0].ti_Data = NULL; + STags[1].ti_Tag = (Tag) SYS_Output; + STags[1].ti_Data = handle; + STags[2].ti_Tag = (Tag) SYS_Asynch; + STags[2].ti_Data = TRUE; + STags[3].ti_Tag = (Tag) SYS_UserShell; + STags[3].ti_Data = TRUE; + STags[4].ti_Tag = TAG_DONE; +#else STags[0].ti_Tag = SYS_Input; STags[0].ti_Data = NULL; STags[1].ti_Tag = SYS_Output; @@ -817,16 +891,25 @@ STags[3].ti_Tag = SYS_UserShell; STags[3].ti_Data = TRUE; STags[4].ti_Tag = TAG_DONE; +#endif if (System (command_line, STags) != 0) perror_fatal ("diff not found"); } else { +#ifdef KULTUR + STags[0].ti_Tag = (Tag) SYS_Asynch; + STags[0].ti_Data = FALSE; + STags[1].ti_Tag = (Tag) SYS_UserShell; + STags[1].ti_Data = TRUE; + STags[2].ti_Tag = TAG_DONE; +#else STags[0].ti_Tag = SYS_Asynch; STags[0].ti_Data = FALSE; STags[1].ti_Tag = SYS_UserShell; STags[1].ti_Data = TRUE; STags[2].ti_Tag = TAG_DONE; +#endif if (System (command_line, STags) != 0) perror_fatal ("diff not found"); exit (0); @@ -1137,11 +1220,19 @@ struct TagItem STags[3]; sprintf (command_line, "%s \"%s\"", edbin, tmpname); +#ifdef KULTUR + STags[0].ti_Tag = (Tag) SYS_Asynch; + STags[0].ti_Data = FALSE; + STags[1].ti_Tag = (Tag) SYS_UserShell; + STags[1].ti_Data = TRUE; + STags[2].ti_Tag = TAG_DONE; +#else STags[0].ti_Tag = SYS_Asynch; STags[0].ti_Data = FALSE; STags[1].ti_Tag = SYS_UserShell; STags[1].ti_Data = TRUE; STags[2].ti_Tag = TAG_DONE; +#endif if (System (command_line, STags) != 0) perror_fatal ("Subsidiary editor failed"); } @@ -1241,7 +1332,7 @@ const char *dir; { struct stat buf; - return stat (dir, &buf) == 0 && S_ISDIR (buf.st_mode); + return stat ((char *) dir, &buf) == 0 && S_ISDIR (buf.st_mode); } /* Return nonzero if FILE exists. */ @@ -1250,7 +1341,7 @@ const char *file; { struct stat buf; - return stat (file, &buf) == 0; + return stat ((char *) file, &buf) == 0; } #ifndef AMIGA --- /diff-2.1/side.c Sun Jan 31 08:49:14 1993 +++ side.c Sun Feb 14 02:29:52 1993 @@ -18,13 +18,19 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ - #include "diff.h" - +#ifdef KULTUR +static unsigned tab_from_to (unsigned from, unsigned to); +static unsigned print_half_line (const char * const *line, unsigned indent, unsigned out_bound); +static void print_1sdiff_line (const char * const *left, int sep, const char * const *right); +static void print_sdiff_common_lines (int limit0, int limit1); +static void print_sdiff_hunk (struct change *hunk); +#else static void print_sdiff_hunk (); static void print_sdiff_common_lines (); static void print_1sdiff_line (); +#endif /* Next line number to be printed in the two input files. */ static int next0, next1; --- /diff-2.1/util.c Thu Feb 04 16:53:18 1993 +++ util.c Sun Feb 14 02:53:06 1993 @@ -19,12 +19,22 @@ #include "diff.h" +#ifdef KULTUR +static void debug_script (struct change *sp); +#endif + #ifdef AMIGA #include +#ifdef KULTUR +#pragma msg 149 ignore push +#endif #include #include #include #include +#ifdef KULTUR +#pragma msg 149 pop +#endif extern struct DosLibrary *DOSBase; static char tmpfilename[L_tmpnam]; @@ -284,6 +294,17 @@ StdInPr = Open (tmpfilename, MODE_OLDFILE); if (StdInPr == NULL) pfatal_with_name ("pipe"); +#ifdef KULTUR + STags[0].ti_Tag = (Tag) SYS_Input; + STags[0].ti_Data = StdInPr; + STags[1].ti_Tag = (Tag) SYS_Output; + STags[1].ti_Data = Output (); + STags[2].ti_Tag = (Tag) SYS_Asynch; + STags[2].ti_Data = FALSE; + STags[3].ti_Tag = (Tag) SYS_UserShell; + STags[3].ti_Data = TRUE; + STags[4].ti_Tag = TAG_DONE; +#else STags[0].ti_Tag = SYS_Input; STags[0].ti_Data = StdInPr; STags[1].ti_Tag = SYS_Output; @@ -293,6 +314,7 @@ STags[3].ti_Tag = SYS_UserShell; STags[3].ti_Data = TRUE; STags[4].ti_Tag = TAG_DONE; +#endif if (System (command_line, STags) != 0) { Close (StdInPr); @@ -438,8 +460,13 @@ void print_script (script, hunkfun, printfun) struct change *script; +#ifdef KULTUR + struct change * (*hunkfun) (struct change *); + void (*printfun) (struct change *); +#else struct change * (*hunkfun) (); void (*printfun) (); +#endif { struct change *next = script; @@ -554,7 +581,11 @@ } } +#ifdef KULTUR +char +#else int +#endif change_letter (inserts, deletes) int inserts, deletes; { @@ -597,11 +628,16 @@ Args A and B are internal line numbers. We print the translated (real) line numbers. */ +#ifdef KULTUR +void +print_number_range (char sepchar, struct file_data *file, int a, int b) +#else void print_number_range (sepchar, file, a, b) char sepchar; struct file_data *file; int a, b; +#endif { int trans_a, trans_b; translate_range (file, a, b, &trans_a, &trans_b); @@ -750,7 +786,7 @@ return new; } -void +static void debug_script (sp) struct change *sp; { --- /diff-2.1/xmalloc.c Sun Jul 19 01:27:22 1992 +++ xmalloc.c Sun Feb 14 03:01:03 1993 @@ -23,11 +23,21 @@ void free (); #endif +#ifdef KULTUR +void error (int, int, char *, ...); +void *xmalloc (unsigned n); +void *xrealloc (void *p, unsigned n); +#else void error (); +#endif /* Allocate N bytes of memory dynamically, with error checking. */ +#ifdef KULTUR +void * +#else char * +#endif xmalloc (n) unsigned n; { @@ -45,10 +55,14 @@ If P is NULL, run xmalloc. If N is 0, run free and return NULL. */ +#ifdef KULTUR +void *xrealloc (void *p, unsigned n) +#else char * xrealloc (p, n) char *p; unsigned n; +#endif { if (p == 0) return xmalloc (n);