home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
rcs567s.zip
/
diff16
/
patches.diff3
< prev
next >
Wrap
Text File
|
1994-06-25
|
6KB
|
226 lines
diff -cbBw orig/diff3.c new/diff3.c
*** orig/diff3.c Sat Jun 25 13:25:06 1994
--- new/diff3.c Sat Jun 25 13:23:38 1994
***************
*** 1,5 ****
--- 1,7 ----
/* Three way file comparison program (diff3) for Project GNU.
Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
+ Modified for DOS and OS/2 on 1994/06/25 by Kai Uwe Rommel
+ <rommel@ars.muc.de>.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 17,28 ****
/* Written by Randy Smith */
! #include "system.h"
#include <stdio.h>
#include <ctype.h>
#include "getopt.h"
! extern char const version_string[];
/*
* Internal data structures and macros for the diff3 program; includes
--- 19,46 ----
/* Written by Randy Smith */
! #include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
+ #define PARAMS(args) args
+
+ #ifdef MSDOS
+ extern FILE *popen(char *, char *);
+ extern int pclose(FILE *);
+ #define WEXITSTATUS(stat_val) (stat_val & 255)
+ #define WIFEXITED(stat_val) (((unsigned)stat_val >> 8) == 0)
+ /* pclose() returns status in inverse byte order than wait() does */
+ #define bzero(s,n) memset((s),0,(n))
+ #define VOID void
+ #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+ #endif
+
#include "getopt.h"
! extern char *version_string;
/*
* Internal data structures and macros for the diff3 program; includes
***************
*** 179,185 ****
static VOID *xrealloc PARAMS((VOID *, size_t));
static char *read_diff PARAMS((char const *, char const *, char **));
! static char *scan_diff_line PARAMS((char *, char **, size_t *, char *, int));
static enum diff_type process_diff_control PARAMS((char **, struct diff_block *));
static int compare_line_list PARAMS((char * const[], size_t const[], char * const[], size_t const[], int));
static int copy_stringlist PARAMS((char * const[], size_t const[], char *[], size_t[], int));
--- 197,203 ----
static VOID *xrealloc PARAMS((VOID *, size_t));
static char *read_diff PARAMS((char const *, char const *, char **));
! static char *scan_diff_line PARAMS((char *, char **, size_t *, char *, char));
static enum diff_type process_diff_control PARAMS((char **, struct diff_block *));
static int compare_line_list PARAMS((char * const[], size_t const[], char * const[], size_t const[], int));
static int copy_stringlist PARAMS((char * const[], size_t const[], char *[], size_t[], int));
***************
*** 397,403 ****
usage (status)
int status;
{
! fflush (stderr);
printf ("\
Usage: %s [options] my-file older-file your-file\n\
Options:\n\
--- 415,422 ----
usage (status)
int status;
{
! fflush(stderr);
! printf ("\nGNU diff3, version %s\n\n", version_string);
printf ("\
Usage: %s [options] my-file older-file your-file\n\
Options:\n\
***************
*** 877,884 ****
int nl;
{
char
! * const *l1 = list1,
! * const *l2 = list2;
size_t const
*lgths1 = lengths1,
*lgths2 = lengths2;
--- 896,903 ----
int nl;
{
char
! **l1 = list1,
! **l2 = list2;
size_t const
*lgths1 = lengths1,
*lgths2 = lengths2;
***************
*** 894,901 ****
* Routines to input and parse two way diffs.
*/
- extern char **environ;
-
#define DIFF_CHUNK_SIZE 10000
static struct diff_block *
--- 913,918 ----
***************
*** 1096,1108 ****
{
char *diff_result;
size_t bytes, current_chunk_size, total;
char const *argv[7];
char horizon_arg[256];
char const **ap;
- int fds[2];
pid_t pid;
int wstatus;
ap = argv;
*ap++ = diff_program;
if (always_text)
--- 1113,1135 ----
{
char *diff_result;
size_t bytes, current_chunk_size, total;
+ int fds[2];
+ #ifdef MSDOS
+ FILE *pipe;
+ char buffer[512];
+ #else
char const *argv[7];
char horizon_arg[256];
char const **ap;
pid_t pid;
+ #endif
int wstatus;
+ #ifdef MSDOS
+ sprintf (buffer, "%s -a -- %s %s", diff_program, filea, fileb);
+ pipe = popen (buffer, "r");
+ fds[0] = fileno (pipe);
+ #else
ap = argv;
*ap++ = diff_program;
if (always_text)
***************
*** 1138,1143 ****
--- 1165,1172 ----
perror_with_exit ("fork failed");
close (fds[1]); /* Prevent erroneous lack of EOF */
+ #endif
+
current_chunk_size = DIFF_CHUNK_SIZE;
diff_result = xmalloc (current_chunk_size);
total = 0;
***************
*** 1154,1160 ****
--- 1183,1194 ----
current_chunk_size = (size_t) -1;
else
fatal ("files are too large to fit into memory");
+ #ifdef MSDOS
+ diff_result = (char *) xrealloc (diff_result,
+ (current_chunk_size += DIFF_CHUNK_SIZE));
+ #else
diff_result = xrealloc (diff_result, (current_chunk_size *= 2));
+ #endif
}
} while (bytes);
***************
*** 1163,1168 ****
--- 1197,1205 ----
*output_placement = diff_result;
+ #ifdef MSDOS
+ wstatus = pclose(pipe);
+ #else
#if HAVE_WAITPID
if (waitpid (pid, &wstatus, 0) < 0)
perror_with_exit ("waitpid failed");
***************
*** 1175,1180 ****
--- 1212,1218 ----
break;
}
#endif
+ #endif
if (! (WIFEXITED (wstatus) && WEXITSTATUS (wstatus) < 2))
fatal ("subsidiary diff failed");
***************
*** 1274,1280 ****
case DIFF_3RD:
oddoneout = rev_mapping[(int) ptr->correspond - (int) DIFF_1ST];
! x[0] = oddoneout + '1';
x[1] = '\0';
dontprint = oddoneout==0;
break;
--- 1312,1318 ----
case DIFF_3RD:
oddoneout = rev_mapping[(int) ptr->correspond - (int) DIFF_1ST];
! x[0] = (char) (oddoneout + '1');
x[1] = '\0';
dontprint = oddoneout==0;
break;