--- /patch/alloca.c Sun Jul 26 04:40:32 1992 +++ alloca.c Wed Feb 17 01:46:06 1993 @@ -55,8 +55,15 @@ #define NULL 0 /* null pointer constant */ +#ifdef KULTUR +pointer alloca (unsigned size); +extern void free (pointer); +extern pointer xmalloc (unsigned); +static void find_stack_direction (void); +#else extern void free(); extern pointer xmalloc(); +#endif /* Define STACK_DIRECTION if you know the direction of stack --- /patch/backupfile.c Sun Nov 22 05:12:06 1992 +++ backupfile.c Tue Feb 16 21:01:37 1993 @@ -92,6 +92,21 @@ char *simple_backup_suffix = "!"; #endif /* AMIGA */ +#ifdef KULTUR +#ifdef _STRICT_ANSI +#define rindex(a,b) strrchr(a,b) +#endif +char *find_backup_file_name (char *); +static int max_backup_version(char *, char *); +static char *make_version_name (char *, int); +static int version_number (char *, char *, int); +static char *concat (char *, char *); +char *basename (char *); +char *dirname (char *); +int argmatch (char *, char **); +void invalid_arg (char *, char *, int); +enum backup_type get_version (char *); +#else char *basename (); char *dirname (); static char *concat (); @@ -99,6 +114,7 @@ static char *make_version_name (); static int max_backup_version (); static int version_number (); +#endif #ifndef NODIR /* Return the name of the new backup file for file FILE, --- /patch/getopt.c Tue Aug 25 00:00:50 1992 +++ getopt.c Wed Feb 17 01:20:02 1993 @@ -146,6 +146,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__ #include #define my_index strchr @@ -181,6 +191,7 @@ to[i] = from[i]; } #endif /* GNU C library. */ +#endif /* Handle permutation of arguments. */ @@ -205,7 +216,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. */ @@ -220,6 +235,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 --- /patch/inp.c Sat Jan 09 01:38:08 1993 +++ inp.c Wed Feb 17 01:36:46 1993 @@ -247,7 +247,7 @@ char *filename; { Reg3 FILE *ifp; - Reg1 int i = 0; + Reg1 int i; Reg2 int maxlen = 1; Reg4 bool found_revision = (revision == Nullch); --- /patch/inp.h Wed Aug 15 12:13:38 1990 +++ inp.h Wed Feb 17 01:35:18 1993 @@ -10,9 +10,17 @@ EXT LINENUM last_frozen_line INIT(0); /* how many input lines have been */ /* irretractibly output */ +#ifdef KULTUR +bool rev_in_string (char *); +void scan_input (char *); +bool plan_a (char *); +void plan_b (char *); +char *ifetch (LINENUM, int); +void re_input (void); +#else bool rev_in_string(); void scan_input(); bool plan_a(); /* returns false if insufficient memory */ void plan_b(); char *ifetch(); - +#endif --- /patch/patch.c Tue Nov 24 16:11:46 1992 +++ patch.c Wed Feb 17 00:44:54 1993 @@ -92,7 +92,13 @@ #ifdef AMIGA #include +#ifdef KULTUR +#pragma msg 149 ignore push +#include +#pragma msg 149 pop +#else #include +#endif #endif /* AMIGA */ #include "INTERN.h" #include "common.h" @@ -106,6 +112,28 @@ /* procedures */ +#ifdef KULTUR +static char curpath[256]; +#ifdef _STRICT_ANSI +extern int onexit (void (*)(void)); +extern int chmod (const char *, int); +#endif +int main (int, char **); +void reinitialize_almost_everything (void); +void get_some_switches (void); +LINENUM locate_hunk (LINENUM); +void abort_hunk (void); +void apply_hunk (LINENUM); +void init_output (char *); +void init_reject (char *); +void copy_till (LINENUM); +void spew_output (void); +void dump_line (LINENUM); +bool patch_match (LINENUM, LINENUM, LINENUM); +bool similar (char *, char *, int); +void my_exit (int); +void amiga_exit (void); +#else void reinitialize_almost_everything(); void get_some_switches(); LINENUM locate_hunk(); @@ -124,6 +152,7 @@ void amiga_exit(); static char curpath[256]; #endif /* AMIGA */ +#endif /* TRUE if -E was specified on command line. */ static int remove_empty_files = FALSE; @@ -142,8 +171,8 @@ LINENUM newwhere; LINENUM fuzz; LINENUM mymaxfuzz; - int hunk = 0; - int failed = 0; + int hunk; + int failed; int failtotal = 0; int i; @@ -967,7 +996,7 @@ while (isspace(*a) && *a != '\n') a++; /* skip target whitespace */ if (*a == '\n' || *b == '\n') - return (*a == *b); /* should end in sync */ + return ((bool)(*a == *b)); /* should end in sync */ } else if (*a++ != *b++) /* match non-whitespace chars */ return FALSE; --- /patch/pch.c Sun Nov 22 16:58:10 1992 +++ pch.c Wed Feb 17 00:57:30 1993 @@ -209,10 +209,10 @@ Reg4 long this_line = 0; Reg5 long previous_line; Reg6 long first_command_line = -1; - long fcl_line; - Reg7 bool last_line_was_command = FALSE; + long fcl_line = 0; + Reg7 bool last_line_was_command; Reg8 bool this_is_a_command = FALSE; - Reg9 bool stars_last_line = FALSE; + Reg9 bool stars_last_line; Reg10 bool stars_this_line = FALSE; Reg3 int indent; Reg1 char *s; @@ -423,7 +423,7 @@ } /* Make this a function for better debugging. */ -static void +void malformed () { fatal3("malformed patch at line %ld: %s", p_input_line, buf); @@ -476,7 +476,7 @@ p_context = 100; p_hunk_beg = p_input_line + 1; while (p_end < p_max) { - line_beginning = ftell(pfp); +/* line_beginning = ftell(pfp); */ ret = pgets(buf, sizeof buf, pfp); p_input_line++; if (ret == Nullch) { @@ -827,7 +827,7 @@ context = 0; p_hunk_beg = p_input_line + 1; while (fillsrc <= p_ptrn_lines || filldst <= p_end) { - line_beginning = ftell(pfp); +/* line_beginning = ftell(pfp); */ ret = pgets(buf, sizeof buf, pfp); p_input_line++; if (ret == Nullch) { --- /patch/pch.h Wed Aug 15 12:13:38 1990 +++ pch.h Wed Feb 17 00:28:18 1993 @@ -11,6 +11,31 @@ EXT FILE *pfp INIT(Nullfp); /* patch file pointer */ +#ifdef KULTUR +void re_patch (void); +void open_patch_file (char *); +void set_hunkmax (void); +void grow_hunkmax (void); +bool there_is_another_patch (void); +int intuit_diff_type (void); +void next_intuit_at (long, long); +void skip_to (long, long); +void malformed (void); +bool another_hunk (void); +char *pgets (char *, int, FILE *); +bool pch_swap (void); +LINENUM pch_first (void); +LINENUM pch_ptrn_lines (void); +LINENUM pch_newfirst (void); +LINENUM pch_repl_lines (void); +LINENUM pch_end (void); +LINENUM pch_context (void); +short pch_line_len (LINENUM); +char pch_char (LINENUM); +char *pfetch (LINENUM); +LINENUM pch_hunk_beg (void); +void do_ed_script (void); +#else void re_patch(); void open_patch_file(); void set_hunkmax(); @@ -34,3 +59,4 @@ char *pfetch(); char *pgets(); void do_ed_script(); +#endif --- /patch/util.c Tue Nov 24 14:59:24 1992 +++ util.c Wed Feb 17 01:18:30 1993 @@ -28,7 +28,9 @@ char *from, *to; { char bakname[512]; +#ifndef KULTUR Reg1 char *s; +#endif Reg2 int i; Reg3 int fromfd; @@ -76,12 +78,14 @@ simplename = s+1; } #else /* AMIGA */ +#ifndef KULTUR char *simplename = bakname; for (s=bakname; *s; s++) { if (*s == '/' || *s == ':') simplename = s+1; } +#endif #endif /* AMIGA */ #ifndef AMIGA @@ -377,10 +381,15 @@ /* Make sure we'll have the directories to create a file. If `striplast' is TRUE, ignore the last element of `filename'. */ +#ifdef KULTUR void +makedirs (Reg1 char *filename, bool striplast) +#else +void makedirs(filename,striplast) Reg1 char *filename; bool striplast; +#endif { char tmpbuf[256]; Reg2 char *s = tmpbuf; --- /patch/util.h Tue Jul 21 01:27:08 1992 +++ util.h Tue Feb 16 21:14:03 1993 @@ -74,6 +74,23 @@ EXT char serrbuf[BUFSIZ]; /* buffer for stderr */ +#ifdef KULTUR +#ifdef _STRICT_ANSI +extern int fileno(FILE *); +#endif +extern void my_exit (int); +int move_file (char *, char *); +void copy_file (char *, char *); +char *savestr (char *); +void say (char *, ...); +void fatal (char *, ...); +void pfatal (char *, ...); +void ask (char *, ...); +void set_signals (int); +void ignore_signals (void); +void makedirs (char *, bool); +char *fetchname (char *, int, int); +#else char *fetchname(); int move_file(); void copy_file(); @@ -86,3 +103,4 @@ void ignore_signals(); void makedirs(); char *basename(); +#endif --- /patch/version.h Wed Aug 15 12:13:40 1990 +++ version.h Wed Feb 17 00:36:15 1993 @@ -5,5 +5,8 @@ * Baseline for netwide release. * */ - +#ifdef KULTUR +void version (void); +#else void version(); +#endif --- /patch/xmalloc.c Sun Nov 22 03:24:20 1992 +++ xmalloc.c Wed Feb 17 01:27:35 1993 @@ -24,11 +24,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; { @@ -46,10 +56,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);