home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / ntcode / gd25s / ms / patches < prev    next >
Encoding:
Text File  |  1995-05-19  |  36.3 KB  |  1,195 lines

  1. diff -c diffutils-2.5-org/analyze.c diffutils-2.5-new/analyze.c
  2. *** diffutils-2.5-org/analyze.c    Mon Sep 27 00:20:24 1993
  3. --- diffutils-2.5-new/analyze.c    Mon Oct  4 11:21:05 1993
  4. ***************
  5. *** 259,270 ****
  6.         files[0].changed_flag[files[0].realindexes[xoff++]] = 1;
  7.     else
  8.       {
  9. !       int c, d, f, b;
  10.   
  11.         /* Find a point of correspondence in the middle of the files.  */
  12.   
  13.         d = diag (xoff, xlim, yoff, ylim, &c);
  14. !       f = fdiag[d];
  15.         b = bdiag[d];
  16.   
  17.         if (c == 1)
  18. --- 259,270 ----
  19.         files[0].changed_flag[files[0].realindexes[xoff++]] = 1;
  20.     else
  21.       {
  22. !       int c, d, /*f,*/ b;
  23.   
  24.         /* Find a point of correspondence in the middle of the files.  */
  25.   
  26.         d = diag (xoff, xlim, yoff, ylim, &c);
  27. !       /*f = fdiag[d];*/
  28.         b = bdiag[d];
  29.   
  30.         if (c == 1)
  31. diff -c diffutils-2.5-org/context.c diffutils-2.5-new/context.c
  32. *** diffutils-2.5-org/context.c    Fri Aug 27 10:30:26 1993
  33. --- diffutils-2.5-new/context.c    Mon Oct  4 11:21:06 1993
  34. ***************
  35. *** 20,26 ****
  36.   #include "diff.h"
  37.   
  38.   static struct change *find_hunk PARAMS((struct change *));
  39. ! static void find_function PARAMS((struct file_data const *, int, char const **, size_t *));
  40.   static void mark_ignorable PARAMS((struct change *));
  41.   static void pr_context_hunk PARAMS((struct change *));
  42.   static void pr_unidiff_hunk PARAMS((struct change *));
  43. --- 20,26 ----
  44.   #include "diff.h"
  45.   
  46.   static struct change *find_hunk PARAMS((struct change *));
  47. ! static void find_function PARAMS((struct file_data const *, int, char const HUGE **, size_t *));
  48.   static void mark_ignorable PARAMS((struct change *));
  49.   static void pr_context_hunk PARAMS((struct change *));
  50.   static void pr_unidiff_hunk PARAMS((struct change *));
  51. ***************
  52. *** 131,137 ****
  53.     int first0, last0, first1, last1, show_from, show_to, i;
  54.     struct change *next;
  55.     char const *prefix;
  56. !   char const *function;
  57.     size_t function_length;
  58.     FILE *out;
  59.   
  60. --- 131,137 ----
  61.     int first0, last0, first1, last1, show_from, show_to, i;
  62.     struct change *next;
  63.     char const *prefix;
  64. !   char const HUGE *function;
  65.     size_t function_length;
  66.     FILE *out;
  67.   
  68. ***************
  69. *** 264,270 ****
  70.   {
  71.     int first0, last0, first1, last1, show_from, show_to, i, j, k;
  72.     struct change *next;
  73. !   char const *function;
  74.     size_t function_length;
  75.     FILE *out;
  76.   
  77. --- 264,270 ----
  78.   {
  79.     int first0, last0, first1, last1, show_from, show_to, i, j, k;
  80.     struct change *next;
  81. !   char const HUGE *function;
  82.     size_t function_length;
  83.     FILE *out;
  84.   
  85. ***************
  86. *** 428,434 ****
  87.   find_function (file, linenum, linep, lenp)
  88.        struct file_data const *file;
  89.        int linenum;
  90. !      char const **linep;
  91.        size_t *lenp;
  92.   {
  93.     int i = linenum;
  94. --- 428,434 ----
  95.   find_function (file, linenum, linep, lenp)
  96.        struct file_data const *file;
  97.        int linenum;
  98. !      char const HUGE **linep;
  99.        size_t *lenp;
  100.   {
  101.     int i = linenum;
  102. ***************
  103. *** 439,445 ****
  104.       {
  105.         /* See if this line is what we want.  */
  106.         struct regexp_list *r;
  107. !       char const *line = file->linbuf[i];
  108.         size_t len = file->linbuf[i + 1] - line;
  109.   
  110.         for (r = function_regexp_list; r; r = r->next)
  111. --- 439,445 ----
  112.       {
  113.         /* See if this line is what we want.  */
  114.         struct regexp_list *r;
  115. !       char const HUGE *line = file->linbuf[i];
  116.         size_t len = file->linbuf[i + 1] - line;
  117.   
  118.         for (r = function_regexp_list; r; r = r->next)
  119. diff -c diffutils-2.5-org/diff.c diffutils-2.5-new/diff.c
  120. *** diffutils-2.5-org/diff.c    Mon Sep 27 00:20:24 1993
  121. --- diffutils-2.5-new/diff.c    Mon Oct  4 11:21:06 1993
  122. ***************
  123. *** 147,153 ****
  124.     sip (&f, 1);
  125.     slurp (&f);
  126.   
  127. !   for (p = f.buffer, lim = p + f.buffered_chars;  p < lim;  p = q)
  128.       {
  129.         q = (char *) memchr (p, '\n', lim - p);
  130.         if (!q)
  131. --- 147,153 ----
  132.     sip (&f, 1);
  133.     slurp (&f);
  134.   
  135. !   for (p = (char *)f.buffer, lim = p + f.buffered_chars;  p < lim;  p = q)
  136.       {
  137.         q = (char *) memchr (p, '\n', lim - p);
  138.         if (!q)
  139. ***************
  140. *** 852,857 ****
  141. --- 852,861 ----
  142.         val = 2;
  143.   
  144.       }
  145. + #if defined(__MSDOS__) || defined(__NT__)
  146. +   else if (same_files = 0) /* yes, only ONE equal sign intended! hmo11apr93 */
  147. +     ;
  148. + #else
  149.     else if ((same_files =    inf[0].stat.st_ino == inf[1].stat.st_ino
  150.                && inf[0].stat.st_dev == inf[1].stat.st_dev
  151.                && inf[0].stat.st_size == inf[1].stat.st_size
  152. ***************
  153. *** 864,869 ****
  154. --- 868,874 ----
  155.   
  156.         val = 0;
  157.       }
  158. + #endif /*__MSDOS__||__NT__*/
  159.     else if (inf[0].dir_p & inf[1].dir_p)
  160.       {
  161.         if (output_style == OUTPUT_IFDEF)
  162. diff -c diffutils-2.5-org/diff.h diffutils-2.5-new/diff.h
  163. *** diffutils-2.5-org/diff.h    Thu Sep 16 23:29:10 1993
  164. --- diffutils-2.5-new/diff.h    Fri Oct  8 18:30:35 1993
  165. ***************
  166. *** 218,231 ****
  167.       int             dir_p;    /* nonzero if file is a directory  */
  168.   
  169.       /* Buffer in which text of file is read.  */
  170. !     char *        buffer;
  171.       /* Allocated size of buffer.  */
  172. !     size_t        bufsize;
  173.       /* Number of valid characters now in the buffer. */
  174. !     size_t        buffered_chars;
  175.   
  176.       /* Array of pointers to lines in the file.  */
  177. !     char const **linbuf;
  178.   
  179.       /* linbuf_base <= buffered_lines <= valid_lines <= alloc_lines.
  180.          linebuf[linbuf_base ... buffered_lines - 1] are possibly differing.
  181. --- 218,231 ----
  182.       int             dir_p;    /* nonzero if file is a directory  */
  183.   
  184.       /* Buffer in which text of file is read.  */
  185. !     char HUGE *        buffer;
  186.       /* Allocated size of buffer.  */
  187. !     FSIZE        bufsize;
  188.       /* Number of valid characters now in the buffer. */
  189. !     FSIZE        buffered_chars;
  190.   
  191.       /* Array of pointers to lines in the file.  */
  192. !     char const HUGE **linbuf;
  193.   
  194.       /* linbuf_base <= buffered_lines <= valid_lines <= alloc_lines.
  195.          linebuf[linbuf_base ... buffered_lines - 1] are possibly differing.
  196. ***************
  197. *** 234,240 ****
  198.       int linbuf_base, buffered_lines, valid_lines, alloc_lines;
  199.   
  200.       /* Pointer to end of prefix of this file to ignore when hashing. */
  201. !     char const *prefix_end;
  202.   
  203.       /* Count of lines in the prefix.
  204.          There are this many lines in the file before linbuf[0].  */
  205. --- 234,240 ----
  206.       int linbuf_base, buffered_lines, valid_lines, alloc_lines;
  207.   
  208.       /* Pointer to end of prefix of this file to ignore when hashing. */
  209. !     char const HUGE *prefix_end;
  210.   
  211.       /* Count of lines in the prefix.
  212.          There are this many lines in the file before linbuf[0].  */
  213. ***************
  214. *** 241,247 ****
  215.       int prefix_lines;
  216.   
  217.       /* Pointer to start of suffix of this file to ignore when hashing. */
  218. !     char const *suffix_begin;
  219.   
  220.       /* Vector, indexed by line number, containing an equivalence code for
  221.          each line.  It is this vector that is actually compared with that
  222. --- 241,247 ----
  223.       int prefix_lines;
  224.   
  225.       /* Pointer to start of suffix of this file to ignore when hashing. */
  226. !     char const HUGE *suffix_begin;
  227.   
  228.       /* Vector, indexed by line number, containing an equivalence code for
  229.          each line.  It is this vector that is actually compared with that
  230. ***************
  231. *** 322,328 ****
  232.   char *concat PARAMS((char const *, char const *, char const *));
  233.   char *dir_file_pathname PARAMS((char const *, char const *));
  234.   int change_letter PARAMS((int, int));
  235. ! int line_cmp PARAMS((char const *, size_t, char const *, size_t));
  236.   int translate_line_number PARAMS((struct file_data const *, int));
  237.   struct change *find_change PARAMS((struct change *));
  238.   struct change *find_reverse_change PARAMS((struct change *));
  239. --- 322,328 ----
  240.   char *concat PARAMS((char const *, char const *, char const *));
  241.   char *dir_file_pathname PARAMS((char const *, char const *));
  242.   int change_letter PARAMS((int, int));
  243. ! int line_cmp PARAMS((char const HUGE *, size_t, char const HUGE *, size_t));
  244.   int translate_line_number PARAMS((struct file_data const *, int));
  245.   struct change *find_change PARAMS((struct change *));
  246.   struct change *find_reverse_change PARAMS((struct change *));
  247. ***************
  248. *** 334,343 ****
  249.   void finish_output PARAMS((void));
  250.   void message PARAMS((char const *, char const *, char const *));
  251.   void message5 PARAMS((char const *, char const *, char const *, char const *, char const *));
  252. ! void output_1_line PARAMS((char const *, char const *, char const *, char const *));
  253.   void perror_with_name PARAMS((char const *));
  254.   void pfatal_with_name PARAMS((char const *));
  255. ! void print_1_line PARAMS((char const *, char const * const *));
  256.   void print_message_queue PARAMS((void));
  257.   void print_number_range PARAMS((int, struct file_data *, int, int));
  258.   void print_script PARAMS((struct change *, struct change * (*) PARAMS((struct change *)), void (*) PARAMS((struct change *))));
  259. --- 334,343 ----
  260.   void finish_output PARAMS((void));
  261.   void message PARAMS((char const *, char const *, char const *));
  262.   void message5 PARAMS((char const *, char const *, char const *, char const *, char const *));
  263. ! void output_1_line PARAMS((char const HUGE *, char const HUGE *, char const *, char const *));
  264.   void perror_with_name PARAMS((char const *));
  265.   void pfatal_with_name PARAMS((char const *));
  266. ! void print_1_line PARAMS((char const *, char const HUGE * const *));
  267.   void print_message_queue PARAMS((void));
  268.   void print_number_range PARAMS((int, struct file_data *, int, int));
  269.   void print_script PARAMS((struct change *, struct change * (*) PARAMS((struct change *)), void (*) PARAMS((struct change *))));
  270. diff -c diffutils-2.5-org/diff3.c diffutils-2.5-new/diff3.c
  271. *** diffutils-2.5-org/diff3.c    Mon Sep 27 00:20:24 1993
  272. --- diffutils-2.5-new/diff3.c    Fri Oct  8 18:26:33 1993
  273. ***************
  274. *** 1090,1104 ****
  275.        char const *filea, *fileb;
  276.        char **output_placement;
  277.   {
  278.     char const *argv[7];
  279.     char horizon_arg[256];
  280.     char const **ap;
  281.     int fds[2];
  282. -   char *diff_result;
  283. -   size_t bytes, current_chunk_size, total;
  284.     pid_t pid;
  285.     int wstatus;
  286.   
  287.     ap = argv;
  288.     *ap++ = diff_program;
  289.     if (always_text)
  290. --- 1090,1118 ----
  291.        char const *filea, *fileb;
  292.        char **output_placement;
  293.   {
  294. + #if defined(__MSDOS__) || defined(__NT__)
  295. +   char command[600];
  296. +   FILE *pipe;
  297. + #else
  298.     char const *argv[7];
  299.     char horizon_arg[256];
  300.     char const **ap;
  301.     int fds[2];
  302.     pid_t pid;
  303.     int wstatus;
  304. + #endif /*__MSDOS__||__NT__*/
  305. +   char *diff_result;
  306. +   size_t bytes, current_chunk_size, total;
  307. + #if defined(__MSDOS__) || defined(__NT__)
  308. +   sprintf(command, "%s%s --horizon-lines=%d -- %s %s",
  309. +     diff_program, always_text ? " -a" : "", horizon_lines, filea, fileb);
  310.   
  311. +   if ((pipe = popen(command, "r")) == NULL) {
  312. +     fprintf(stderr, "%s: not found\n", diff_program);
  313. +     _exit (2);
  314. +   }
  315. + #else
  316.     ap = argv;
  317.     *ap++ = diff_program;
  318.     if (always_text)
  319. ***************
  320. *** 1134,1149 ****
  321. --- 1148,1184 ----
  322.       perror_with_exit ("fork failed");
  323.   
  324.     close (fds[1]);        /* Prevent erroneous lack of EOF */
  325. + #endif /*__MSDOS__||__NT__*/
  326.     current_chunk_size = DIFF_CHUNK_SIZE;
  327.     diff_result = xmalloc (current_chunk_size);
  328.     total = 0;
  329.     do {
  330. + #if defined(__MSDOS__) || defined(__NT__)
  331. + #ifdef __TURBOC__
  332. +     bytes = myread (pipe->fd,
  333. + #else
  334. +     bytes = myread (_fileno(pipe),
  335. + #endif /*__TURBOC__*/
  336. + #else
  337.       bytes = myread (fds[0],
  338. + #endif /*__MSDOS__||__NT__*/
  339.               diff_result + total,
  340.               current_chunk_size - total);
  341.       total += bytes;
  342.       if (total == current_chunk_size)
  343. + #if defined(__MSDOS__) || defined(__NT__)
  344. +       {
  345. +       if (2L * (long) current_chunk_size < UINT_MAX)
  346. +         current_chunk_size *= 2;
  347. +       else if (current_chunk_size < UINT_MAX)
  348. +         current_chunk_size = UINT_MAX;
  349. +       else
  350. +         fatal("file too large!");
  351. +       diff_result = (char *) xrealloc (diff_result, current_chunk_size);
  352. +       }
  353. + #else
  354.         diff_result = xrealloc (diff_result, (current_chunk_size *= 2));
  355. + #endif /*__MSDOS__||__NT__*/
  356.     } while (bytes);
  357.   
  358.     if (total != 0 && diff_result[total-1] != '\n')
  359. ***************
  360. *** 1151,1156 ****
  361. --- 1186,1195 ----
  362.   
  363.     *output_placement = diff_result;
  364.   
  365. + #if defined(__MSDOS__) || defined(__NT__)
  366. +   if (pclose (pipe))
  367. +     perror_with_exit ("pipe failed");
  368. + #else
  369.   #if HAVE_WAITPID
  370.     if (waitpid (pid, &wstatus, 0) < 0)
  371.       perror_with_exit ("waitpid failed");
  372. ***************
  373. *** 1166,1171 ****
  374. --- 1205,1211 ----
  375.   
  376.     if (! (WIFEXITED (wstatus) && WEXITSTATUS (wstatus) < 2))
  377.       fatal ("subsidiary diff failed");
  378. + #endif /*__MSDOS__||__NT__*/
  379.   
  380.     return diff_result + total;
  381.   }
  382. diff -c diffutils-2.5-org/ifdef.c diffutils-2.5-new/ifdef.c
  383. *** diffutils-2.5-org/ifdef.c    Fri Sep 17 12:27:09 1993
  384. --- diffutils-2.5-new/ifdef.c    Mon Oct  4 11:21:08 1993
  385. ***************
  386. *** 266,272 ****
  387.        struct group const *group;
  388.   {
  389.     struct file_data const *file = group->file;
  390. !   char const * const *linbuf = file->linbuf;
  391.     int from = group->from, upto = group->upto;
  392.   
  393.     if (!out)
  394. --- 266,272 ----
  395.        struct group const *group;
  396.   {
  397.     struct file_data const *file = group->file;
  398. !   char const HUGE * const *linbuf = file->linbuf;
  399.     int from = group->from, upto = group->upto;
  400.   
  401.     if (!out)
  402. diff -c diffutils-2.5-org/io.c diffutils-2.5-new/io.c
  403. *** diffutils-2.5-org/io.c    Fri Aug 27 10:30:26 1993
  404. --- diffutils-2.5-new/io.c    Thu Oct 28 15:12:17 1993
  405. ***************
  406. *** 31,37 ****
  407.   #define GUESS_LINES(n,s,t) (((t) - (s)) / ((n) < 10 ? 32 : (s) / ((n)-1)) + 5)
  408.   
  409.   /* Type used for fast prefix comparison in find_identical_ends.  */
  410. ! typedef long word;
  411.   
  412.   /* Lines are put into equivalence classes (of lines that match in line_cmp).
  413.      Each equivalence class is represented by one of these structures,
  414. --- 31,37 ----
  415.   #define GUESS_LINES(n,s,t) (((t) - (s)) / ((n) < 10 ? 32 : (s) / ((n)-1)) + 5)
  416.   
  417.   /* Type used for fast prefix comparison in find_identical_ends.  */
  418. ! typedef unsigned word;
  419.   
  420.   /* Lines are put into equivalence classes (of lines that match in line_cmp).
  421.      Each equivalence class is represented by one of these structures,
  422. ***************
  423. *** 41,47 ****
  424.   {
  425.     int next;    /* Next item in this bucket. */
  426.     unsigned hash;    /* Hash of lines in this class.  */
  427. !   char const *line;    /* A line that fits this class. */
  428.     size_t length;    /* The length of that line.  */
  429.   };
  430.   
  431. --- 41,47 ----
  432.   {
  433.     int next;    /* Next item in this bucket. */
  434.     unsigned hash;    /* Hash of lines in this class.  */
  435. !   char const HUGE *line;    /* A line that fits this class. */
  436.     size_t length;    /* The length of that line.  */
  437.   };
  438.   
  439. ***************
  440. *** 54,60 ****
  441.   /* Array in which the equivalence classes are allocated.
  442.      The bucket-chains go through the elements in this array.
  443.      The number of an equivalence class is its index in this array.  */
  444. ! static struct equivclass *equivs;
  445.   
  446.   /* Index of first free element in the array `equivs'.  */
  447.   static int equivs_index;
  448. --- 54,60 ----
  449.   /* Array in which the equivalence classes are allocated.
  450.      The bucket-chains go through the elements in this array.
  451.      The number of an equivalence class is its index in this array.  */
  452. ! static struct equivclass HUGE *equivs;
  453.   
  454.   /* Index of first free element in the array `equivs'.  */
  455.   static int equivs_index;
  456. ***************
  457. *** 103,109 ****
  458. --- 103,115 ----
  459.       current->bufsize = max (current->bufsize,
  460.                   current->stat.st_size + sizeof (word) + 1);
  461.   
  462. + #ifdef __MSDOS__
  463. +       if ((current->buffer = (char HUGE *) farmalloc (current->bufsize)) == NULL)
  464. +     fatal ("far memory exhausted");
  465. + #else
  466.         current->buffer = xmalloc (current->bufsize);
  467. + #endif /*__MSDOS__*/
  468.         if (skip_test)
  469.       current->buffered_chars = 0;
  470.         else
  471. ***************
  472. *** 111,116 ****
  473. --- 117,125 ----
  474.         /* Check first part of file to see if it's a binary file.  */
  475.         current->buffered_chars = read (current->desc,
  476.                         current->buffer,
  477. + #ifdef __MSDOS__
  478. +             (unsigned int)
  479. + #endif /*__MSDOS__*/
  480.                         current->buffered_chars);
  481.         if (current->buffered_chars == -1)
  482.           pfatal_with_name (current->name);
  483. ***************
  484. *** 135,140 ****
  485. --- 144,166 ----
  486.     else if (S_ISREG (current->stat.st_mode))
  487.       {
  488.         /* It's a regular file; slurp in the rest all at once.  */
  489. + #ifdef __MSDOS__
  490. +       /* read inside of segment boundaries */
  491. +       while ((current->stat.st_size - current->buffered_chars) > 0)
  492. +       {
  493. +         unsigned nr;
  494. +         char HUGE *rp;
  495. +         rp = current->buffer + current->buffered_chars;
  496. +         nr = 0 - (unsigned)((long)rp & 0x0000FFFF);
  497. +         nr = read (current->desc, rp, nr);
  498. +         if (nr == 0)
  499. +           break;
  500. +         if (nr == 0xFFFF)
  501. +           pfatal_with_name (current->name);
  502. +         current->buffered_chars += nr ;
  503. +       }
  504. + #else
  505.         cc = current->stat.st_size - current->buffered_chars;
  506.         if (cc)
  507.       {
  508. ***************
  509. *** 145,150 ****
  510. --- 171,177 ----
  511.           pfatal_with_name (current->name);
  512.         current->buffered_chars += cc;
  513.       }
  514. + #endif /*__MSDOS__*/
  515.       }
  516.     /* It's not a regular file; read it, growing the buffer as needed.  */
  517.     else if (always_text_flag || current->buffered_chars != 0)
  518. ***************
  519. *** 153,160 ****
  520. --- 180,192 ----
  521.       {
  522.         if (current->buffered_chars == current->bufsize)
  523.           {
  524. + #ifdef __MSDOS__
  525. +           current->bufsize += 4096;
  526. +           current->buffer = (char HUGE *) farrealloc (current->buffer, current->bufsize);
  527. + #else
  528.             current->bufsize = current->bufsize * 2;
  529.             current->buffer = xrealloc (current->buffer, current->bufsize);
  530. + #endif /*__MSDOS__*/
  531.           }
  532.         cc = read (current->desc,
  533.                current->buffer + current->buffered_chars,
  534. ***************
  535. *** 165,173 ****
  536. --- 197,207 ----
  537.           pfatal_with_name (current->name);
  538.         current->buffered_chars += cc;
  539.       }
  540. + #ifndef __MSDOS__
  541.         /* Allocate just enough room for appended newline and sentinel.  */
  542.         current->bufsize = current->buffered_chars + sizeof (word) + 1;
  543.         current->buffer = xrealloc (current->buffer, current->bufsize);
  544. + #endif /*!__MSDOS__*/
  545.       }
  546.   }
  547.   
  548. ***************
  549. *** 179,208 ****
  550.        struct file_data *current;
  551.   {
  552.     unsigned h;
  553. !   unsigned char const *p = (unsigned char const *) current->prefix_end;
  554.     unsigned char c;
  555.     int i, *bucket;
  556.     size_t length;
  557.   
  558.     /* Cache often-used quantities in local variables to help the compiler.  */
  559. !   char const **linbuf = current->linbuf;
  560.     int alloc_lines = current->alloc_lines;
  561.     int line = 0;
  562.     int linbuf_base = current->linbuf_base;
  563.     int *cureqs = (int *) xmalloc (alloc_lines * sizeof (int));
  564. !   struct equivclass *eqs = equivs;
  565.     int eqs_index = equivs_index;
  566.     int eqs_alloc = equivs_alloc;
  567. !   char const *suffix_begin = current->suffix_begin;
  568. !   char const *bufend = current->buffer + current->buffered_chars;
  569. !   char const *incomplete_tail
  570.       = current->missing_newline && ROBUST_OUTPUT_STYLE (output_style)
  571. !       ? bufend : (char const *) 0;
  572.     int varies = length_varies;
  573.   
  574. !   while ((char const *) p < suffix_begin)
  575.       {
  576. !       char const *ip = (char const *) p;
  577.   
  578.         /* Compute the equivalence class for this line.  */
  579.   
  580. --- 213,242 ----
  581.        struct file_data *current;
  582.   {
  583.     unsigned h;
  584. !   unsigned char const HUGE *p = (unsigned char const HUGE *) current->prefix_end;
  585.     unsigned char c;
  586.     int i, *bucket;
  587.     size_t length;
  588.   
  589.     /* Cache often-used quantities in local variables to help the compiler.  */
  590. !   char const HUGE **linbuf = current->linbuf;
  591.     int alloc_lines = current->alloc_lines;
  592.     int line = 0;
  593.     int linbuf_base = current->linbuf_base;
  594.     int *cureqs = (int *) xmalloc (alloc_lines * sizeof (int));
  595. !   struct equivclass HUGE *eqs = equivs;
  596.     int eqs_index = equivs_index;
  597.     int eqs_alloc = equivs_alloc;
  598. !   char const HUGE *suffix_begin = current->suffix_begin;
  599. !   char const HUGE *bufend = current->buffer + current->buffered_chars;
  600. !   char const HUGE *incomplete_tail
  601.       = current->missing_newline && ROBUST_OUTPUT_STYLE (output_style)
  602. !       ? bufend : (char const HUGE *) 0;
  603.     int varies = length_varies;
  604.   
  605. !   while ((char const HUGE *) p < suffix_begin)
  606.       {
  607. !       char const HUGE *ip = (char const HUGE *) p;
  608.   
  609.         /* Compute the equivalence class for this line.  */
  610.   
  611. ***************
  612. *** 262,268 ****
  613.      hashing_done:;
  614.   
  615.         bucket = &buckets[h % nbuckets];
  616. !       length = (char const *) p - ip - ((char const *) p == incomplete_tail);
  617.         for (i = *bucket;  ;  i = eqs[i].next)
  618.       if (!i)
  619.         {
  620. --- 296,302 ----
  621.      hashing_done:;
  622.   
  623.         bucket = &buckets[h % nbuckets];
  624. !       length = (char const HUGE *) p - ip - ((char const HUGE *) p == incomplete_tail);
  625.         for (i = *bucket;  ;  i = eqs[i].next)
  626.       if (!i)
  627.         {
  628. ***************
  629. *** 269,276 ****
  630. --- 303,315 ----
  631.           /* Create a new equivalence class in this bucket. */
  632.           i = eqs_index++;
  633.           if (i == eqs_alloc)
  634. + #ifdef __MSDOS__
  635. +           if ((eqs = (struct equivclass HUGE *) farrealloc (eqs, (long) (eqs_alloc*=2) * sizeof(*eqs))) == NULL)
  636. +             fatal ("far memory exhausted");
  637. + #else
  638.             eqs = (struct equivclass *)
  639.                 xrealloc (eqs, (eqs_alloc*=2) * sizeof(*eqs));
  640. + #endif /*__MSDOS__*/
  641.           eqs[i].next = *bucket;
  642.           eqs[i].hash = h;
  643.           eqs[i].line = ip;
  644. ***************
  645. *** 290,296 ****
  646.         /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
  647.         alloc_lines = 2 * alloc_lines - linbuf_base;
  648.         cureqs = (int *) xrealloc (cureqs, alloc_lines * sizeof (*cureqs));
  649. !       linbuf = (char const **) xrealloc (linbuf + linbuf_base,
  650.                            (alloc_lines - linbuf_base)
  651.                            * sizeof (*linbuf))
  652.              - linbuf_base;
  653. --- 329,335 ----
  654.         /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
  655.         alloc_lines = 2 * alloc_lines - linbuf_base;
  656.         cureqs = (int *) xrealloc (cureqs, alloc_lines * sizeof (*cureqs));
  657. !       linbuf = (char const HUGE **) xrealloc (linbuf + linbuf_base,
  658.                            (alloc_lines - linbuf_base)
  659.                            * sizeof (*linbuf))
  660.              - linbuf_base;
  661. ***************
  662. *** 311,326 ****
  663.       {
  664.         /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
  665.         alloc_lines = 2 * alloc_lines - linbuf_base;
  666. !       linbuf = (char const **) xrealloc (linbuf + linbuf_base,
  667.                            (alloc_lines - linbuf_base)
  668.                            * sizeof (*linbuf))
  669.              - linbuf_base;
  670.       }
  671. !       linbuf[line] = (char const *) p;
  672.       
  673. !       if ((char const *) p == bufend)
  674.       {
  675. !       linbuf[line]  -=  (char const *) p == incomplete_tail;
  676.         break;
  677.       }
  678.   
  679. --- 350,365 ----
  680.       {
  681.         /* Double (alloc_lines - linbuf_base) by adding to alloc_lines.  */
  682.         alloc_lines = 2 * alloc_lines - linbuf_base;
  683. !       linbuf = (char const HUGE **) xrealloc (linbuf + linbuf_base,
  684.                            (alloc_lines - linbuf_base)
  685.                            * sizeof (*linbuf))
  686.              - linbuf_base;
  687.       }
  688. !       linbuf[line] = (char const HUGE *) p;
  689.       
  690. !       if ((char const HUGE *) p == bufend)
  691.       {
  692. !       linbuf[line]  -=  (char const HUGE *) p == incomplete_tail;
  693.         break;
  694.       }
  695.   
  696. ***************
  697. *** 351,358 ****
  698.   prepare_text_end (current)
  699.        struct file_data *current;
  700.   {
  701. !   size_t buffered_chars = current->buffered_chars;
  702. !   char *p = current->buffer;
  703.   
  704.     if (buffered_chars == 0 || p[buffered_chars - 1] == '\n')
  705.       current->missing_newline = 0;
  706. --- 390,397 ----
  707.   prepare_text_end (current)
  708.        struct file_data *current;
  709.   {
  710. !   FSIZE buffered_chars = current->buffered_chars;
  711. !   char HUGE *p = current->buffer;
  712.   
  713.     if (buffered_chars == 0 || p[buffered_chars - 1] == '\n')
  714.       current->missing_newline = 0;
  715. ***************
  716. *** 375,387 ****
  717.   find_identical_ends (filevec)
  718.        struct file_data filevec[];
  719.   {
  720. !   word *w0, *w1;
  721. !   char *p0, *p1, *buffer0, *buffer1;
  722. !   char const *end0, *beg0;
  723. !   char const **linbuf0, **linbuf1;
  724.     int i, lines;
  725. !   size_t n0, n1, tem;
  726. !   int alloc_lines0, alloc_lines1;
  727.     int buffered_prefix, prefix_count, prefix_mask;
  728.   
  729.     slurp (&filevec[0]);
  730. --- 414,427 ----
  731.   find_identical_ends (filevec)
  732.        struct file_data filevec[];
  733.   {
  734. !   word HUGE *w0, HUGE *w1;
  735. !   char HUGE *p0, HUGE *p1, HUGE *buffer0, HUGE *buffer1;
  736. !   char const HUGE *end0, HUGE *beg0;
  737. !   char const HUGE **linbuf0, HUGE **linbuf1;
  738.     int i, lines;
  739. !   FSIZE n0, n1;
  740. !   FSIZE tem;
  741. !   FSIZE alloc_lines0, alloc_lines1;
  742.     int buffered_prefix, prefix_count, prefix_mask;
  743.   
  744.     slurp (&filevec[0]);
  745. ***************
  746. *** 490,496 ****
  747.       while (*p0++ != '\n')
  748.         ;
  749.   
  750. !       p1 += p0 - beg0;
  751.       }
  752.   
  753.     /* Record the suffix.  */
  754. --- 530,536 ----
  755.       while (*p0++ != '\n')
  756.         ;
  757.   
  758. !       p1 += p0 - (char HUGE *)beg0;
  759.       }
  760.   
  761.     /* Record the suffix.  */
  762. ***************
  763. *** 517,523 ****
  764.         prefix_mask = prefix_count - 1;
  765.         alloc_lines0
  766.       = prefix_count
  767. !       + GUESS_LINES (0, 0, p0 - filevec[0].prefix_end)
  768.         + context;
  769.       }
  770.     else
  771. --- 557,563 ----
  772.         prefix_mask = prefix_count - 1;
  773.         alloc_lines0
  774.       = prefix_count
  775. !       + GUESS_LINES (0, 0, p0 - (char HUGE *)filevec[0].prefix_end)
  776.         + context;
  777.       }
  778.     else
  779. ***************
  780. *** 528,534 ****
  781.       }
  782.   
  783.     lines = 0;
  784. !   linbuf0 = (char const **) xmalloc (alloc_lines0 * sizeof (*linbuf0));
  785.   
  786.     /* If the prefix is needed, find the prefix lines.  */
  787.     if (! (no_diff_means_no_output
  788. --- 568,574 ----
  789.       }
  790.   
  791.     lines = 0;
  792. !   linbuf0 = (char const HUGE **) xmalloc (alloc_lines0 * sizeof (*linbuf0));
  793.   
  794.     /* If the prefix is needed, find the prefix lines.  */
  795.     if (! (no_diff_means_no_output
  796. ***************
  797. *** 541,547 ****
  798.       {
  799.         int l = lines++ & prefix_mask;
  800.         if (l == alloc_lines0)
  801. !         linbuf0 = (char const **) xrealloc (linbuf0, (alloc_lines0 *= 2)
  802.                                * sizeof(*linbuf0));
  803.         linbuf0[l] = p0;
  804.         while (*p0++ != '\n')
  805. --- 581,587 ----
  806.       {
  807.         int l = lines++ & prefix_mask;
  808.         if (l == alloc_lines0)
  809. !         linbuf0 = (char const HUGE **) xrealloc (linbuf0, (alloc_lines0 *= 2)
  810.                                * sizeof(*linbuf0));
  811.         linbuf0[l] = p0;
  812.         while (*p0++ != '\n')
  813. ***************
  814. *** 557,563 ****
  815.       = (buffered_prefix
  816.          + GUESS_LINES (lines, filevec[1].prefix_end - buffer1, tem)
  817.          + context);
  818. !   linbuf1 = (char const **) xmalloc (alloc_lines1 * sizeof (*linbuf1));
  819.   
  820.     if (buffered_prefix != lines)
  821.       {
  822. --- 597,603 ----
  823.       = (buffered_prefix
  824.          + GUESS_LINES (lines, filevec[1].prefix_end - buffer1, tem)
  825.          + context);
  826. !   linbuf1 = (char const HUGE **) xmalloc (alloc_lines1 * sizeof (*linbuf1));
  827.   
  828.     if (buffered_prefix != lines)
  829.       {
  830. ***************
  831. *** 594,599 ****
  832. --- 634,640 ----
  833.     8191,
  834.     16381,
  835.     32749,
  836. + #if 32767 < INT_MAX
  837.     65521,
  838.     131071,
  839.     262139,
  840. ***************
  841. *** 610,615 ****
  842. --- 651,657 ----
  843.     536870909,
  844.     1073741789,
  845.     2147483647,
  846. + #endif
  847.     0
  848.   };
  849.   
  850. ***************
  851. *** 641,647 ****
  852. --- 683,694 ----
  853.     find_identical_ends (filevec);
  854.   
  855.     equivs_alloc = filevec[0].alloc_lines + filevec[1].alloc_lines + 1;
  856. + #ifdef __MSDOS__
  857. +   if ((equivs = (struct equivclass HUGE *) farmalloc ((long) equivs_alloc * sizeof(struct equivclass))) == NULL)
  858. +     fatal ("far memory exhausted");
  859. + #else
  860.     equivs = (struct equivclass *) xmalloc (equivs_alloc * sizeof (struct equivclass));
  861. + #endif /*__MSDOS__*/
  862.     /* Equivalence class 0 is permanently safe for lines that were not
  863.        hashed.  Real equivalence classes start at 1. */
  864.     equivs_index = 1;
  865. diff -c diffutils-2.5-org/side.c diffutils-2.5-new/side.c
  866. *** diffutils-2.5-org/side.c    Thu Sep 16 22:26:45 1993
  867. --- diffutils-2.5-new/side.c    Mon Oct  4 11:21:10 1993
  868. ***************
  869. *** 21,29 ****
  870.   
  871.   #include "diff.h"
  872.   
  873. ! static unsigned print_half_line PARAMS((char const * const *, unsigned, unsigned));
  874.   static unsigned tab_from_to PARAMS((unsigned, unsigned));
  875. ! static void print_1sdiff_line PARAMS((char const * const *, int, char const * const *));
  876.   static void print_sdiff_common_lines PARAMS((int, int));
  877.   static void print_sdiff_hunk PARAMS((struct change *));
  878.   
  879. --- 21,29 ----
  880.   
  881.   #include "diff.h"
  882.   
  883. ! static unsigned print_half_line PARAMS((char const HUGE * const *, unsigned, unsigned));
  884.   static unsigned tab_from_to PARAMS((unsigned, unsigned));
  885. ! static void print_1sdiff_line PARAMS((char const HUGE * const *, int, char const HUGE * const *));
  886.   static void print_sdiff_common_lines PARAMS((int, int));
  887.   static void print_sdiff_hunk PARAMS((struct change *));
  888.   
  889. ***************
  890. *** 71,84 ****
  891.    */
  892.   static unsigned
  893.   print_half_line (line, indent, out_bound)
  894. !      char const * const *line;
  895.        unsigned indent, out_bound;
  896.   {
  897.     FILE *out = outfile;
  898.     register unsigned in_position = 0, out_position = 0;
  899.     register char const
  900. !     *text_pointer = line[0],
  901. !     *text_limit = line[1];
  902.   
  903.     while (text_pointer < text_limit)
  904.       {
  905. --- 71,84 ----
  906.    */
  907.   static unsigned
  908.   print_half_line (line, indent, out_bound)
  909. !      char const HUGE * const *line;
  910.        unsigned indent, out_bound;
  911.   {
  912.     FILE *out = outfile;
  913.     register unsigned in_position = 0, out_position = 0;
  914.     register char const
  915. !     HUGE *text_pointer = line[0],
  916. !     HUGE *text_limit = line[1];
  917.   
  918.     while (text_pointer < text_limit)
  919.       {
  920. ***************
  921. *** 166,174 ****
  922.   
  923.   static void
  924.   print_1sdiff_line (left, sep, right)
  925. !      char const * const *left;
  926.        int sep;
  927. !      char const * const *right;
  928.   {
  929.     FILE *out = outfile;
  930.     unsigned hw = sdiff_half_width, c2o = sdiff_column2_offset;
  931. --- 166,174 ----
  932.   
  933.   static void
  934.   print_1sdiff_line (left, sep, right)
  935. !      char const HUGE * const *left;
  936.        int sep;
  937. !      char const HUGE * const *right;
  938.   {
  939.     FILE *out = outfile;
  940.     unsigned hw = sdiff_half_width, c2o = sdiff_column2_offset;
  941. diff -c diffutils-2.5-org/system.h diffutils-2.5-new/system.h
  942. *** diffutils-2.5-org/system.h    Mon Sep 27 00:20:24 1993
  943. --- diffutils-2.5-new/system.h    Mon Oct  4 11:21:10 1993
  944. ***************
  945. *** 29,35 ****
  946.   #include <sys/types.h>
  947.   #include <sys/stat.h>
  948.   
  949. ! #if __STDC__
  950.   #define PARAMS(args) args
  951.   #define VOID void
  952.   #else
  953. --- 29,35 ----
  954.   #include <sys/types.h>
  955.   #include <sys/stat.h>
  956.   
  957. ! #if __STDC__ || defined(__MSDOS__) || defined(__NT__)
  958.   #define PARAMS(args) args
  959.   #define VOID void
  960.   #else
  961. ***************
  962. *** 211,215 ****
  963. --- 211,237 ----
  964.   extern int errno;
  965.   #endif
  966.   
  967. + #ifndef min
  968.   #define min(a,b) ((a) <= (b) ? (a) : (b))
  969.   #define max(a,b) ((a) >= (b) ? (a) : (b))
  970. + #endif
  971. + #ifdef __MSDOS__
  972. + typedef int pid_t;
  973. + typedef long off_t;
  974. + #include <stdio.h>
  975. + #include <malloc.h>
  976. + FILE *popen(char *, char *);
  977. + int pclose(FILE *);
  978. + #define HUGE huge
  979. + #define FSIZE long
  980. + #else
  981. + #define HUGE
  982. + #define FSIZE size_t
  983. + #endif
  984. + #ifdef __NT__
  985. + typedef int pid_t;
  986. + #define popen    _popen
  987. + #define pclose    _pclose
  988. + #endif
  989. diff -c diffutils-2.5-org/util.c diffutils-2.5-new/util.c
  990. *** diffutils-2.5-org/util.c    Mon Sep 27 00:20:24 1993
  991. --- diffutils-2.5-new/util.c    Fri Oct  8 18:22:04 1993
  992. ***************
  993. *** 179,184 ****
  994. --- 179,191 ----
  995.   
  996.     if (paginate_flag)
  997.       {
  998. + #if defined(__MSDOS__) || defined(__NT__)
  999. +       char command[120];
  1000. +       sprintf(command, "%s -f -h \"%s\"", PR_FILE_NAME, name);
  1001. +       if ((outfile = popen(command, "w")) == NULL)
  1002. +         pfatal_with_name ("popen");
  1003. + #else
  1004.         int pipes[2];
  1005.   
  1006.         /* Fork a `pr' and make OUTFILE a pipe to it.  */
  1007. ***************
  1008. *** 209,214 ****
  1009. --- 216,222 ----
  1010.         close (pipes[0]);
  1011.         outfile = fdopen (pipes[1], "w");
  1012.       }
  1013. + #endif /*__MSDOS__||__NT__*/
  1014.       }
  1015.     else
  1016.       {
  1017. ***************
  1018. *** 249,254 ****
  1019. --- 257,266 ----
  1020.   {
  1021.     if (outfile != 0 && outfile != stdout)
  1022.       {
  1023. + #if defined(__MSDOS__) || defined(__NT__)
  1024. +       if (pclose (outfile))
  1025. +     pfatal_with_name ("write error");
  1026. + #else
  1027.         int wstatus;
  1028.         if (ferror (outfile))
  1029.       fatal ("write error");
  1030. ***************
  1031. *** 268,273 ****
  1032. --- 280,286 ----
  1033.   #endif
  1034.         if (! WIFEXITED (wstatus) || WEXITSTATUS (wstatus) != 0)
  1035.       fatal ("subsidiary pr failed");
  1036. + #endif /*__MSDOS__||__NT__*/
  1037.       }
  1038.   
  1039.     outfile = 0;
  1040. ***************
  1041. *** 279,285 ****
  1042.   
  1043.   int
  1044.   line_cmp (s1, len1, s2, len2)
  1045. !      char const *s1, *s2;
  1046.        size_t len1, len2;
  1047.   {
  1048.     register unsigned char const *t1, *t2;
  1049. --- 292,298 ----
  1050.   
  1051.   int
  1052.   line_cmp (s1, len1, s2, len2)
  1053. !      char const HUGE *s1, HUGE *s2;
  1054.        size_t len1, len2;
  1055.   {
  1056.     register unsigned char const *t1, *t2;
  1057. ***************
  1058. *** 436,444 ****
  1059.   void
  1060.   print_1_line (line_flag, line)
  1061.        char const *line_flag;
  1062. !      char const * const *line;
  1063.   {
  1064. !   char const *text = line[0], *limit = line[1]; /* Help the compiler.  */
  1065.     FILE *out = outfile; /* Help the compiler some more.  */
  1066.     char const *flag_format = 0;
  1067.   
  1068. --- 449,457 ----
  1069.   void
  1070.   print_1_line (line_flag, line)
  1071.        char const *line_flag;
  1072. !      char const HUGE * const *line;
  1073.   {
  1074. !   char const HUGE *text = line[0], HUGE *limit = line[1]; /* Help the compiler.  */
  1075.     FILE *out = outfile; /* Help the compiler some more.  */
  1076.     char const *flag_format = 0;
  1077.   
  1078. ***************
  1079. *** 466,472 ****
  1080.   
  1081.   void
  1082.   output_1_line (text, limit, flag_format, line_flag)
  1083. !      char const *text, *limit, *flag_format, *line_flag;
  1084.   {
  1085.     if (!tab_expand_flag)
  1086.       fwrite (text, sizeof (char), limit - text, outfile);
  1087. --- 479,485 ----
  1088.   
  1089.   void
  1090.   output_1_line (text, limit, flag_format, line_flag)
  1091. !      char const HUGE *text, HUGE *limit, *flag_format, *line_flag;
  1092.   {
  1093.     if (!tab_expand_flag)
  1094.       fwrite (text, sizeof (char), limit - text, outfile);
  1095. ***************
  1096. *** 474,480 ****
  1097.       {
  1098.         register FILE *out = outfile;
  1099.         register unsigned char c;
  1100. !       register char const *t = text;
  1101.         register unsigned column = 0;
  1102.   
  1103.         while (t < limit)
  1104. --- 487,493 ----
  1105.       {
  1106.         register FILE *out = outfile;
  1107.         register unsigned char c;
  1108. !       register char const HUGE *t = text;
  1109.         register unsigned column = 0;
  1110.   
  1111.         while (t < limit)
  1112. ***************
  1113. *** 615,621 ****
  1114.       if (!ignore_blank_lines_flag || files[0].linbuf[i][0] != '\n')
  1115.         {
  1116.           struct regexp_list *r;
  1117. !         char const *line = files[0].linbuf[i];
  1118.           int len = files[0].linbuf[i + 1] - line;
  1119.   
  1120.           for (r = ignore_regexp_list; r; r = r->next)
  1121. --- 628,634 ----
  1122.       if (!ignore_blank_lines_flag || files[0].linbuf[i][0] != '\n')
  1123.         {
  1124.           struct regexp_list *r;
  1125. !         char const HUGE *line = files[0].linbuf[i];
  1126.           int len = files[0].linbuf[i + 1] - line;
  1127.   
  1128.           for (r = ignore_regexp_list; r; r = r->next)
  1129. ***************
  1130. *** 631,637 ****
  1131.       if (!ignore_blank_lines_flag || files[1].linbuf[i][0] != '\n')
  1132.         {
  1133.           struct regexp_list *r;
  1134. !         char const *line = files[1].linbuf[i];
  1135.           int len = files[1].linbuf[i + 1] - line;
  1136.   
  1137.           for (r = ignore_regexp_list; r; r = r->next)
  1138. --- 644,650 ----
  1139.       if (!ignore_blank_lines_flag || files[1].linbuf[i][0] != '\n')
  1140.         {
  1141.           struct regexp_list *r;
  1142. !         char const HUGE *line = files[1].linbuf[i];
  1143.           int len = files[1].linbuf[i + 1] - line;
  1144.   
  1145.           for (r = ignore_regexp_list; r; r = r->next)
  1146. ***************
  1147. *** 672,678 ****
  1148. --- 685,695 ----
  1149.     value = (VOID *) malloc (size);
  1150.   
  1151.     if (!value)
  1152. + #ifdef __MSDOS__
  1153. +     fatal ("real memory exhausted");
  1154. + #else
  1155.       fatal ("virtual memory exhausted");
  1156. + #endif
  1157.     return value;
  1158.   }
  1159.   
  1160. ***************
  1161. *** 691,697 ****
  1162. --- 708,718 ----
  1163.     value = (VOID *) realloc (old, size);
  1164.   
  1165.     if (!value)
  1166. + #ifdef __MSDOS__
  1167. +     fatal ("real memory exhausted");
  1168. + #else
  1169.       fatal ("virtual memory exhausted");
  1170. + #endif
  1171.     return value;
  1172.   }
  1173.   
  1174. ***************
  1175. *** 714,720 ****
  1176. --- 735,746 ----
  1177.   dir_file_pathname (dir, file)
  1178.        char const *dir, *file;
  1179.   {
  1180. + #if defined(__MSDOS__) || defined(__NT__)
  1181. +   char sep = dir[strlen(dir) - 1];
  1182. +   return concat (dir, "/" + (*dir && ((sep == '/') || (sep == '\\'))), file);
  1183. + #else
  1184.     return concat (dir, "/" + (*dir && dir[strlen (dir) - 1] == '/'), file);
  1185. + #endif /*__MSDOS__||__NT__*/
  1186.   }
  1187.   
  1188.   void
  1189.