home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / sources / 2885 < prev    next >
Encoding:
Text File  |  1992-12-25  |  50.4 KB  |  1,728 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!utgpu!attcan!sobeco!philmtl!altitude!matrox!IRO.UMontreal.CA!pinard
  2. From: pinard@IRO.UMontreal.CA (Francois Pinard)
  3. Newsgroups: alt.sources
  4. Subject: wdiff - Patch 4, Part (2/3) - brings 0.03 to 0.04
  5. Message-ID: <PINARD.92Dec24003610@kovic.IRO.UMontreal.CA>
  6. Date: 24 Dec 92 05:36:10 GMT
  7. Sender: news@IRO.UMontreal.CA
  8. Distribution: alt
  9. Organization: Universite' de Montre'al
  10. Lines: 1716
  11.  
  12. ---- Cut Here and feed the following to sh ----
  13. #!/bin/sh
  14. # this is x.02 (part 2 of a multipart archive)
  15. # do not concatenate these parts, unpack them in order with /bin/sh
  16. # file Patch4 continued
  17. #
  18. if test ! -r _shar_seq_.tmp; then
  19.     echo 'Please unpack part 1 first!'
  20.     exit 1
  21. fi
  22. (read Scheck
  23.  if test "$Scheck" != 2; then
  24.     echo Please unpack part "$Scheck" next!
  25.     exit 1
  26.  else
  27.     exit 0
  28.  fi
  29. ) < _shar_seq_.tmp || exit 1
  30. if test ! -f _shar_wnt_.tmp; then
  31.     echo 'x - still skipping Patch4'
  32. else
  33. echo 'x - continuing file Patch4'
  34. sed 's/^X//' << 'SHAR_EOF' >> 'Patch4' &&
  35. X-  saveifs="$IFS"; IFS="${IFS}:"
  36. X-  for dir in $PATH; do
  37. X-    test -z "$dir" && dir=.
  38. X-    if test -f $dir/flex; then
  39. X-      LEX="flex"
  40. X-      break
  41. X-    fi
  42. X-  done
  43. X-  IFS="$saveifs"
  44. X-fi
  45. X-test -z "$LEX" && LEX="lex"
  46. X-
  47. X-if test -z "$LEXLIB"
  48. X-then
  49. X-  case "$LEX" in
  50. X-  flex*)
  51. X-    if test -r /usr/local/lib/libfl.a
  52. X-    then LEXLIB=/usr/local/lib/libfl.a
  53. X-    elif test -r ${prefix}/lib/libfl.a
  54. X-    then LEXLIB=${prefix}/lib/libfl.a
  55. X-    else LEXLIB="-lfl"
  56. X-    fi
  57. X-    ;;
  58. X-  *) LEXLIB="-ll" ;;
  59. X-  esac
  60. X-fi
  61. X # Make sure to not get the incompatible SysV /etc/install and
  62. X # /usr/sbin/install, which might be in PATH before a BSD-like install,
  63. X-# or the SunOS /usr/etc/install directory.
  64. X+# or the SunOS /usr/etc/install directory, or the AIX /bin/install.
  65. X if test -z "$INSTALL"; then
  66. X   echo checking for install
  67. X   saveifs="$IFS"; IFS="${IFS}:"
  68. X@@ -163,10 +141,14 @@
  69. X     /etc|/usr/sbin|/usr/etc) ;;
  70. X     *)
  71. X       if test -f $dir/install; then
  72. X-    INSTALL="$dir/install -c"
  73. X-    INSTALL_PROGRAM='$(INSTALL)'
  74. X-    INSTALL_DATA='$(INSTALL) -m 644'
  75. X-    break
  76. X+    if grep dspmsg $dir/install >/dev/null 2>&1; then
  77. X+      : AIX
  78. X+    else
  79. X+      INSTALL="$dir/install -c"
  80. X+      INSTALL_PROGRAM='$(INSTALL)'
  81. X+      INSTALL_DATA='$(INSTALL) -m 644'
  82. X+      break
  83. X+    fi
  84. X       fi
  85. X       ;;
  86. X     esac
  87. X@@ -177,7 +159,7 @@
  88. X INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  89. X INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  90. X-for p in gdiff diff
  91. X+for p in gnudiff diffgnu gdiff
  92. X do
  93. X if test -z "$DIFF"; then
  94. X   echo checking for $p
  95. X@@ -196,10 +178,11 @@
  96. X test -n "$DIFF" && break
  97. X done
  98. X-if test -z "$DIFF"; then
  99. X-  echo "No diff program found.  Cannot continue."
  100. X-  exit 1
  101. X+if test "$DIFF" = gdiff; then
  102. X+  # Carefully avoid gdiff for X as found on SGI systems.
  103. X+  DISPLAY= gdiff /dev/null /dev/null > /dev/null 2>&1 || DIFF=
  104. X fi
  105. X+test -n "$DIFF" || DIFF=diff
  106. X for p in less more
  107. X do
  108. X if test -z "$PAGER"; then
  109. X@@ -256,18 +239,60 @@
  110. X   LIBS="$LIBS -ltermcap"
  111. X fi
  112. X-echo checking if __STDC__ defined
  113. X+echo checking for malloc library
  114. X+# Irix requires -lmalloc for some unknown reason.
  115. X+if test -r /usr/lib/libmalloc.a; then
  116. X+  LIBS="$LIBS -lmalloc"
  117. X+fi
  118. X+
  119. X+echo checking for POSIXized ISC
  120. X+if test -d /etc/conf/kconfig.d &&
  121. X+  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  122. X+then
  123. X+  ISC=1 # If later tests want to check for ISC.
  124. X+  DEFS="$DEFS -D_POSIX_SOURCE=1"
  125. X+  if test -n "$GCC"; then
  126. X+    CC="$CC -posix"
  127. X+  else
  128. X+    CC="$CC -Xp"
  129. X+  fi
  130. X+fi
  131. X+
  132. X+echo checking for working const
  133. X+echo "
  134. X+main() { exit(0); } t() { /* Ultrix mips cc rejects this.  */
  135. X+typedef int charset[2]; const charset x;
  136. X+/* SunOS 4.1.1 cc rejects this. */
  137. X+char const *const *p;
  138. X+char **p2;
  139. X+/* HPUX 7.0 cc rejects these. */
  140. X+++p;
  141. X+p2 = (char const* const*) p;
  142. X+ }" > conftest.c
  143. X+if eval $compile; then
  144. X+  :
  145. X+else
  146. X+  DEFS="$DEFS -Dconst="
  147. X+fi
  148. X+rm -f conftest*
  149. X+
  150. X+echo checking for ANSI prototypes
  151. X cat <<EOF > conftest.c
  152. X #ifdef __STDC__
  153. X-#include <nonexistent.h>
  154. X+  yes
  155. X #endif
  156. X+
  157. X EOF
  158. X-err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  159. X-if test -z "$err"; then
  160. X+eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  161. X+if egrep "yes" conftest.out >/dev/null 2>&1; then
  162. X+  :
  163. X+else 
  164. X   U=_
  165. X fi
  166. X rm -f conftest*
  167. X+
  168. X+
  169. X echo checking for ANSI C header files
  170. X cat <<EOF > conftest.c
  171. X@@ -274,6 +299,7 @@
  172. X #include <stdlib.h>
  173. X #include <stdarg.h>
  174. X #include <string.h>
  175. X+#include <float.h>
  176. X #include <limits.h>
  177. X EOF
  178. X err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  179. X@@ -282,7 +308,18 @@
  180. X fi
  181. X rm -f conftest*
  182. X-for hdr in termcap.h
  183. X+echo checking for unistd.h
  184. X+cat <<EOF > conftest.c
  185. X+
  186. X+#include <unistd.h>
  187. X+EOF
  188. X+err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  189. X+if test -z "$err"; then
  190. X+  DEFS="$DEFS -DHAVE_UNISTD_H=1"
  191. X+fi
  192. X+rm -f conftest*
  193. X+
  194. X+for hdr in string.h termcap.h
  195. X do
  196. X trfrom='[a-z]./' trto='[A-Z]__'
  197. X echo checking for $hdr
  198. X@@ -297,18 +334,7 @@
  199. X rm -f conftest*
  200. X done
  201. X-echo checking for working const
  202. X-echo "
  203. X-main() { exit(0); } t() { /* Ultrix mips cc rejects this.  */
  204. X-typedef int charset[2]; const charset x;
  205. X- }" > conftest.c
  206. X-if eval $compile; then
  207. X-  :
  208. X-else
  209. X-  DEFS="$DEFS -Dconst="
  210. X-fi
  211. X-rm -f conftest*
  212. X-
  213. X+echo checking return type of signal handlers
  214. X echo '#include <signal.h>' > conftest.c
  215. X eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
  216. X if egrep "(void|sighandler_t).*signal" conftest.out >/dev/null 2>&1; then
  217. X@@ -349,13 +375,12 @@
  218. X done
  219. X-echo checking for alloca.h
  220. X-cat <<EOF > conftest.c
  221. X-
  222. X-#include <alloca.h>
  223. X-EOF
  224. X-err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  225. X-if test -z "$err"; then
  226. X+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  227. X+# for constant arguments.  Useless!
  228. X+echo checking for working alloca.h
  229. X+echo "#include <alloca.h>
  230. X+main() { exit(0); } t() { char *p = alloca(2 * sizeof(int)); }" > conftest.c
  231. X+if eval $compile; then
  232. X   DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  233. X fi
  234. X rm -f conftest*
  235. X@@ -412,23 +437,13 @@
  236. X   fi
  237. X fi
  238. X-echo checking for BSD string and memory functions
  239. X-echo "#include <strings.h>
  240. X-main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  241. X-if eval $compile; then
  242. X-  :
  243. X-else
  244. X-  DEFS="$DEFS -DUSG=1"
  245. X-fi
  246. X-rm -f conftest*
  247. X-
  248. X if test -n "$prefix"; then
  249. X   test -z "$exec_prefix" && exec_prefix='$(prefix)'
  250. X-  prsub="s,^prefix[     ]*=.*$,prefix = $prefix,"
  251. X+  prsub="s%^prefix[     ]*=.*$%prefix = $prefix%"
  252. X fi
  253. X if test -n "$exec_prefix"; then
  254. X   prsub="$prsub
  255. X-s,^exec_prefix[     ]*=.*$,exec_prefix = $exec_prefix,"
  256. X+s%^exec_prefix[     ]*=.*$%exec_prefix = $exec_prefix%"
  257. X fi
  258. X trap 'rm -f config.status; exit 1' 1 3 15
  259. X@@ -438,7 +453,9 @@
  260. X #!/bin/sh
  261. X # Generated automatically by configure.
  262. X # Run this file to recreate the current configuration.
  263. X-# This directory was configured as follows:
  264. X+# This directory was configured as follows,
  265. X+# on host `(hostname || uname -n) 2>/dev/null`:
  266. X+#
  267. X # $0 $*
  268. X case "\$1" in
  269. X@@ -448,8 +465,6 @@
  270. X trap 'rm -f Makefile; exit 1' 1 3 15
  271. X CC='$CC'
  272. X-LEX='$LEX'
  273. X-LEXLIB='$LEXLIB'
  274. X INSTALL='$INSTALL'
  275. X INSTALL_PROGRAM='$INSTALL_PROGRAM'
  276. X INSTALL_DATA='$INSTALL_DATA'
  277. X@@ -472,7 +487,7 @@
  278. X for file in Makefile; do
  279. X   srcdir=$top_srcdir
  280. X   # Remove last slash and all that follows it.  Not all systems have dirname.
  281. X-  dir=`echo $file|sed 's,/[^/][^/]*$,,'`
  282. X+  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  283. X   if test "$dir" != "$file"; then
  284. X     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  285. X     test ! -d $dir && mkdir $dir
  286. X@@ -482,21 +497,19 @@
  287. X   echo "# Generated automatically from `basename $file`.in by configure." > $file
  288. X   sed -e "
  289. X $prsub
  290. X-s,@CC@,$CC,
  291. X-s,@LEX@,$LEX,
  292. X-s,@LEXLIB@,$LEXLIB,
  293. X-s,@INSTALL@,$INSTALL,
  294. X-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,
  295. X-s,@INSTALL_DATA@,$INSTALL_DATA,
  296. X-s,@DIFF@,$DIFF,
  297. X-s,@PAGER@,$PAGER,
  298. X-s,@CPP@,$CPP,
  299. X-s,@U@,$U,
  300. X-s,@LIBOBJS@,$LIBOBJS,
  301. X-s,@ALLOCA@,$ALLOCA,
  302. X-s,@LIBS@,$LIBS,
  303. X-s,@srcdir@,$srcdir,
  304. X-s,@DEFS@,$DEFS," $top_srcdir/${file}.in >> $file
  305. X+s%@CC@%$CC%g
  306. X+s%@INSTALL@%$INSTALL%g
  307. X+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  308. X+s%@INSTALL_DATA@%$INSTALL_DATA%g
  309. X+s%@DIFF@%$DIFF%g
  310. X+s%@PAGER@%$PAGER%g
  311. X+s%@CPP@%$CPP%g
  312. X+s%@U@%$U%g
  313. X+s%@LIBOBJS@%$LIBOBJS%g
  314. X+s%@ALLOCA@%$ALLOCA%g
  315. X+s%@LIBS@%$LIBS%g
  316. X+s%@srcdir@%$srcdir%g
  317. X+s%@DEFS@%$DEFS%" $top_srcdir/${file}.in >> $file
  318. X done
  319. X EOF
  320. X--- wdiff-0.03/configure.in    Tue Aug 18 04:24:43 1992
  321. X+++ wdiff-0.04/configure.in    Wed Dec 23 20:53:57 1992
  322. X@@ -1,21 +1,14 @@
  323. X dnl Process this file with autoconf to produce a configure script.
  324. X dnl
  325. X-define(FP_STDC_CHECK,
  326. X-[echo checking if __STDC__ defined
  327. X-AC_TEST_CPP([#ifdef __STDC__
  328. X-#include <nonexistent.h>
  329. X-#endif], [U=_])AC_SUBST(U)])
  330. X-dnl
  331. X-dnl
  332. X AC_INIT(wdiff.c)
  333. X AC_PROG_CC
  334. X-AC_PROG_LEX
  335. X AC_PROG_INSTALL
  336. X-AC_PROGRAMS_CHECK(DIFF, gdiff diff)
  337. X-if test -z "$DIFF"; then
  338. X-  echo "No diff program found.  Cannot continue."
  339. X-  exit 1
  340. X+AC_PROGRAMS_CHECK(DIFF, gnudiff diffgnu gdiff)
  341. X+if test "$DIFF" = gdiff; then
  342. X+  # Carefully avoid gdiff for X as found on SGI systems.
  343. X+  DISPLAY= gdiff /dev/null /dev/null > /dev/null 2>&1 || DIFF=
  344. X fi
  345. X+test -n "$DIFF" || DIFF=diff
  346. X AC_PROGRAMS_CHECK(PAGER, less more)
  347. X echo checking for Xenix
  348. X@@ -30,13 +23,20 @@
  349. X   LIBS="$LIBS -ltermcap"
  350. X fi
  351. X-FP_STDC_CHECK
  352. X-AC_STDC_HEADERS
  353. X-AC_HAVE_HEADERS(termcap.h)
  354. X+echo checking for malloc library
  355. X+# Irix requires -lmalloc for some unknown reason.
  356. X+if test -r /usr/lib/libmalloc.a; then
  357. X+  LIBS="$LIBS -lmalloc"
  358. X+fi
  359. X+
  360. X+AC_ISC_POSIX
  361. X AC_CONST
  362. X+FP_PROTOTYPES
  363. X+AC_STDC_HEADERS
  364. X+AC_UNISTD_H
  365. X+AC_HAVE_HEADERS(string.h termcap.h)
  366. X AC_RETSIGTYPE
  367. X AC_HAVE_FUNCS(tputs)
  368. X AC_REPLACE_FUNCS(strstr)
  369. X AC_ALLOCA
  370. X-AC_USG
  371. X AC_OUTPUT(Makefile)
  372. X--- wdiff-0.03/getopt.c    Tue Jun 16 19:43:34 1992
  373. X+++ wdiff-0.04/getopt.c    Tue Dec  1 13:22:16 1992
  374. X@@ -6,20 +6,24 @@
  375. X    Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc.
  376. X    This program is free software; you can redistribute it and/or modify it
  377. X-   under the terms of the GNU Library General Public License as published
  378. X-   by the Free Software Foundation; either version 2, or (at your option)
  379. X-   any later version.
  380. X-
  381. X+   under the terms of the GNU General Public License as published by the
  382. X+   Free Software Foundation; either version 2, or (at your option) any
  383. X+   later version.
  384. X+   
  385. X    This program is distributed in the hope that it will be useful,
  386. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  387. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  388. X    GNU General Public License for more details.
  389. X-
  390. X-   You should have received a copy of the GNU Library General Public
  391. X-   License along with this program; if not, write to the Free Software
  392. X-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  393. X+   
  394. X+   You should have received a copy of the GNU General Public License
  395. X+   along with this program; if not, write to the Free Software
  396. X+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  397. X-/* AIX requires this to be the first thing in the file. */
  398. X+#ifdef HAVE_CONFIG_H
  399. X+#include "config.h"
  400. X+#endif
  401. X+
  402. X+/* AIX requires this to be the first thing in the file.  */
  403. X #ifdef __GNUC__
  404. X #define alloca __builtin_alloca
  405. X #else /* not __GNUC__ */
  406. X@@ -34,6 +38,10 @@
  407. X #endif /* alloca.h */
  408. X #endif /* not __GNUC__ */
  409. X+#if !__STDC__ && !defined(const)
  410. X+#define const
  411. X+#endif
  412. X+
  413. X #include <stdio.h>
  414. X /* This needs to come after some library #include
  415. X@@ -40,20 +48,16 @@
  416. X    to get __GNU_LIBRARY__ defined.  */
  417. X #ifdef    __GNU_LIBRARY__
  418. X #undef    alloca
  419. X+/* Don't include stdlib.h for non-GNU C libraries because some of them
  420. X+   contain conflicting prototypes for getopt.  */
  421. X #include <stdlib.h>
  422. X-#include <string.h>
  423. X #else    /* Not GNU C library.  */
  424. X #define    __alloca    alloca
  425. X #endif    /* GNU C library.  */
  426. X-
  427. X-#ifndef __STDC__
  428. X-#define const
  429. X-#endif
  430. X-
  431. X /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
  432. X    long-named option.  Because this is not POSIX.2 compliant, it is
  433. X-   being phased out. */
  434. X+   being phased out.  */
  435. X #define GETOPT_COMPAT
  436. X /* This version of `getopt' appears to the caller like standard Unix `getopt'
  437. X@@ -143,6 +147,10 @@
  438. X } ordering;
  439. X #ifdef    __GNU_LIBRARY__
  440. X+/* We want to avoid inclusion of string.h with non-GNU libraries
  441. X+   because there are many ways it can cause trouble.
  442. X+   On some systems, it contains special magic macros that don't work
  443. X+   in GCC.  */
  444. X #include <string.h>
  445. X #define    my_index    strchr
  446. X #define    my_bcopy(src, dst, n)    memcpy ((dst), (src), (n))
  447. X@@ -205,10 +213,12 @@
  448. X   /* Interchange the two blocks of data in ARGV.  */
  449. X-  my_bcopy (&argv[first_nonopt], temp, nonopts_size);
  450. X-  my_bcopy (&argv[last_nonopt], &argv[first_nonopt],
  451. X+  my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size);
  452. X+  my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt],
  453. X         (optind - last_nonopt) * sizeof (char *));
  454. X-  my_bcopy (temp, &argv[first_nonopt + optind - last_nonopt], nonopts_size);
  455. X+  my_bcopy ((char *) temp,
  456. X+        (char *) &argv[first_nonopt + optind - last_nonopt],
  457. X+        nonopts_size);
  458. X   /* Update records for the slots the non-options now occupy.  */
  459. X@@ -452,7 +462,7 @@
  460. X       if (*s)
  461. X         {
  462. X           /* Don't test has_arg with >, because some C compilers don't
  463. X-         allow it to be used on enums. */
  464. X+         allow it to be used on enums.  */
  465. X           if (pfound->has_arg)
  466. X         optarg = s + 1;
  467. X           else
  468. X@@ -500,7 +510,7 @@
  469. X       /* Can't find it as a long option.  If this is not getopt_long_only,
  470. X      or the option starts with '--' or is not a valid short
  471. X      option, then it's an error.
  472. X-     Otherwise interpret it as a short option. */
  473. X+     Otherwise interpret it as a short option.  */
  474. X       if (!long_only || argv[optind][1] == '-'
  475. X #ifdef GETOPT_COMPAT
  476. X       || argv[optind][0] == '+'
  477. X--- wdiff-0.03/getopt.h    Sat May 23 22:29:47 1992
  478. X+++ wdiff-0.04/getopt.h    Fri Oct 16 17:41:24 1992
  479. X@@ -2,18 +2,18 @@
  480. X    Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
  481. X    This program is free software; you can redistribute it and/or modify it
  482. X-   under the terms of the GNU Library General Public License as published
  483. X-   by the Free Software Foundation; either version 2, or (at your option)
  484. X-   any later version.
  485. X-
  486. X+   under the terms of the GNU General Public License as published by the
  487. X+   Free Software Foundation; either version 2, or (at your option) any
  488. X+   later version.
  489. X+   
  490. X    This program is distributed in the hope that it will be useful,
  491. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  492. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  493. X    GNU General Public License for more details.
  494. X-
  495. X-   You should have received a copy of the GNU Library General Public
  496. X-   License along with this program; if not, write to the Free Software
  497. X-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  498. X+   
  499. X+   You should have received a copy of the GNU General Public License
  500. X+   along with this program; if not, write to the Free Software
  501. X+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  502. X #ifndef _GETOPT_H
  503. X #define _GETOPT_H 1
  504. X@@ -86,15 +86,19 @@
  505. X /* Names for the values of the `has_arg' field of `struct option'.  */
  506. X-enum _argtype
  507. X-{
  508. X-  no_argument,
  509. X-  required_argument,
  510. X-  optional_argument
  511. X-};
  512. X+#define    no_argument        0
  513. X+#define required_argument    1
  514. X+#define optional_argument    2
  515. X #if __STDC__
  516. X+#if defined(__GNU_LIBRARY__)
  517. X+/* Many other libraries have conflicting prototypes for getopt, with
  518. X+   differences in the consts, in stdlib.h.  To avoid compilation
  519. X+   errors, only prototype getopt for the GNU C library.  */
  520. X extern int getopt (int argc, char *const *argv, const char *shortopts);
  521. X+#else /* not __GNU_LIBRARY__ */
  522. X+extern int getopt ();
  523. X+#endif /* not __GNU_LIBRARY__ */
  524. X extern int getopt_long (int argc, char *const *argv, const char *shortopts,
  525. X                 const struct option *longopts, int *longind);
  526. X extern int getopt_long_only (int argc, char *const *argv,
  527. X--- wdiff-0.03/getopt1.c    Sat May 23 22:29:48 1992
  528. X+++ wdiff-0.04/getopt1.c    Tue Dec  1 13:22:38 1992
  529. X@@ -2,37 +2,40 @@
  530. X    Copyright (C) 1987, 88, 89, 90, 91, 1992 Free Software Foundation, Inc.
  531. X    This program is free software; you can redistribute it and/or modify it
  532. X-   under the terms of the GNU Library General Public License as published
  533. X-   by the Free Software Foundation; either version 2, or (at your option)
  534. X-   any later version.
  535. X-
  536. X+   under the terms of the GNU General Public License as published by the
  537. X+   Free Software Foundation; either version 2, or (at your option) any
  538. X+   later version.
  539. X+   
  540. X    This program is distributed in the hope that it will be useful,
  541. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  542. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  543. X    GNU General Public License for more details.
  544. X-
  545. X-   You should have received a copy of the GNU Library General Public
  546. X-   License along with this program; if not, write to the Free Software
  547. X-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  548. X+   
  549. X+   You should have received a copy of the GNU General Public License
  550. X+   along with this program; if not, write to the Free Software
  551. X+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  552. X-#ifdef    LIBC
  553. X-/* For when compiled as part of the GNU C library.  */
  554. X-#include <ansidecl.h>
  555. X+#ifdef HAVE_CONFIG_H
  556. X+#include "config.h"
  557. X #endif
  558. X #include "getopt.h"
  559. X-#ifndef __STDC__
  560. X+#if !__STDC__ && !defined(const)
  561. X #define const
  562. X #endif
  563. X-#if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__) || defined (LIBC)
  564. X+#include <stdio.h>
  565. X+
  566. X+/* This needs to come after some library #include
  567. X+   to get __GNU_LIBRARY__ defined.  */
  568. X+#ifdef __GNU_LIBRARY__
  569. X #include <stdlib.h>
  570. X-#else /* STDC_HEADERS or __GNU_LIBRARY__ */
  571. X+#else
  572. X char *getenv ();
  573. X-#endif /* STDC_HEADERS or __GNU_LIBRARY__ */
  574. X+#endif
  575. X-#if !defined (NULL)
  576. X+#ifndef    NULL
  577. X #define NULL 0
  578. X #endif
  579. X@@ -50,7 +53,7 @@
  580. X /* Like getopt_long, but '-' as well as '--' can indicate a long option.
  581. X    If an option that starts with '-' (not '--') doesn't match a long option,
  582. X    but does match a short option, it is parsed as a short option
  583. X-   instead. */
  584. X+   instead.  */
  585. X int 
  586. X getopt_long_only (argc, argv, options, long_options, opt_index)
  587. X--- wdiff-0.03/gpl.texinfo    Fri Jun 12 18:18:24 1992
  588. X+++ wdiff-0.04/gpl.texinfo    Mon Jul  6 20:09:42 1992
  589. X@@ -378,6 +378,7 @@
  590. X necessary.  Here is a sample; alter the names:
  591. X @example
  592. X+@group
  593. X Yoyodyne, Inc., hereby disclaims all copyright
  594. X interest in the program `Gnomovision'
  595. X (which makes passes at compilers) written 
  596. X@@ -385,6 +386,7 @@
  597. X @var{signature of Ty Coon}, 1 April 1989
  598. X Ty Coon, President of Vice
  599. X+@end group
  600. X @end example
  601. X This General Public License does not permit incorporating your program into
  602. X--- wdiff-0.03/pathmax.h
  603. X+++ wdiff-0.04/pathmax.h    Thu Oct  1 23:33:48 1992
  604. X@@ -0,0 +1,53 @@
  605. X+/* Define PATH_MAX somehow.  Requires sys/types.h.
  606. X+   Copyright (C) 1992 Free Software Foundation, Inc.
  607. X+
  608. X+   This program is free software; you can redistribute it and/or modify
  609. X+   it under the terms of the GNU General Public License as published by
  610. X+   the Free Software Foundation; either version 2, or (at your option)
  611. X+   any later version.
  612. X+
  613. X+   This program is distributed in the hope that it will be useful,
  614. X+   but WITHOUT ANY WARRANTY; without even the implied warranty of
  615. X+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  616. X+   GNU General Public License for more details.
  617. X+
  618. X+   You should have received a copy of the GNU General Public License
  619. X+   along with this program; if not, write to the Free Software
  620. X+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  621. X+
  622. X+#ifndef _PATHMAX_H
  623. X+#define _PATHMAX_H
  624. X+
  625. X+#ifdef HAVE_UNISTD_H
  626. X+#include <unistd.h>
  627. X+#endif
  628. X+
  629. X+/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
  630. X+   PATH_MAX but might cause redefinition warnings when sys/param.h is
  631. X+   later included (as on MORE/BSD 4.3).  */
  632. X+#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && defined(USG))
  633. X+#include <limits.h>
  634. X+#endif
  635. X+
  636. X+#ifndef _POSIX_PATH_MAX
  637. X+#define _POSIX_PATH_MAX 255
  638. X+#endif
  639. X+
  640. X+#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
  641. X+#define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
  642. X+#endif
  643. X+
  644. X+/* Don't include sys/param.h if it already has been.  */
  645. X+#if !defined(PATH_MAX) && !defined(MAXPATHLEN) && !defined(__MSDOS__)
  646. X+#include <sys/param.h>
  647. X+#endif
  648. X+
  649. X+#if !defined(PATH_MAX) && defined(MAXPATHLEN)
  650. X+#define PATH_MAX MAXPATHLEN
  651. X+#endif
  652. X+
  653. X+#ifndef PATH_MAX
  654. X+#define PATH_MAX _POSIX_PATH_MAX
  655. X+#endif
  656. X+
  657. X+#endif /* _PATHMAX_H */
  658. X--- wdiff-0.03/readpipe.c    Mon Aug 17 14:19:10 1992
  659. X+++ wdiff-0.04/readpipe.c    Sat Dec  5 18:47:47 1992
  660. X@@ -20,6 +20,10 @@
  661. X #include <stdio.h>
  662. X #include <varargs.h>
  663. X+#if defined (HAVE_UNISTD_H)
  664. X+#include <unistd.h>
  665. X+#endif
  666. X+
  667. X /* Open a pipe to read from a program without intermediary sh.
  668. X    Checks PATH.
  669. X    Sample use:
  670. X@@ -38,7 +42,7 @@
  671. X   /* Copy arguments into `args'. */
  672. X   va_start (ap);
  673. X-  while (args[argno++] = va_arg (ap, char *))
  674. X+  while ((args[argno++] = va_arg (ap, char *)) != NULL)
  675. X     /* Do nothing. */ ;
  676. X   va_end (ap);
  677. X@@ -49,13 +53,16 @@
  678. X     {
  679. X     case 0:            /* Child.  Write to pipe. */
  680. X       close (fds[0]);        /* Not needed. */
  681. X-      close (1);        /* We don't want the old stdout. */
  682. X-      if (dup (fds[1]) == 0)    /* Maybe stdin was closed. */
  683. X+      if (fds[1] != 1)        /* Redirect 1 (stdout) only if needed.  */
  684. X     {
  685. X-      dup (fds[1]);        /* Guaranteed to dup to 1 (stdout). */
  686. X-      close (0);
  687. X+      close (1);        /* We don't want the old stdout. */
  688. X+      if (dup (fds[1]) == 0)/* Maybe stdin was closed. */
  689. X+        {
  690. X+          dup (fds[1]);    /* Guaranteed to dup to 1 (stdout). */
  691. X+          close (0);
  692. X+        }
  693. X+      close (fds[1]);    /* No longer needed. */
  694. X     }
  695. X-      close (fds[1]);        /* No longer needed. */
  696. X       execvp (args[0], args);
  697. X       _exit (2);        /* 2 for `cmp'. */
  698. X     case -1:            /* Error. */
  699. X--- wdiff-0.03/strstr.c    Fri Jul 19 21:40:32 1991
  700. X+++ wdiff-0.04/strstr.c    Sat Nov 21 20:47:18 1992
  701. X@@ -30,20 +30,16 @@
  702. X      char *s1;
  703. X      char *s2;
  704. X {
  705. X-  int i;
  706. X   char *p1;
  707. X   char *p2;
  708. X-  char *s = s1;
  709. X+  char *s;
  710. X-  for (p2 = s2, i = 0; *s; p2 = s2, i++, s++)
  711. X-    {
  712. X-      for (p1 = s; *p1 && *p2 && *p1 == *p2; p1++, p2++)
  713. X-    ;
  714. X+  for (s = s1; ; s++)
  715. X+    for (p1 = s, p2 = s2; ; p1++, p2++)
  716. X       if (!*p2)
  717. X+    return s;
  718. X+      else if (!*p1)
  719. X+    return 0;
  720. X+      else if (*p1 != *p2)
  721. X     break;
  722. X-    }
  723. X-  if (!*p2)
  724. X-    return s1 + i;
  725. X-
  726. X-  return 0;
  727. X }
  728. X--- wdiff-0.03/wdiff.1
  729. X+++ wdiff-0.04/wdiff.1    Mon Dec 21 21:35:53 1992
  730. X@@ -0,0 +1,427 @@
  731. X+.\" ------------------------------------------------------------
  732. X+.\" Manual page for the wdiff program, based on the texinfo manual. 
  733. X+.\" 
  734. X+.\" Colin Brough, December 1992.
  735. X+.\" ------------------------------------------------------------
  736. X+.de Id
  737. X+.ds Rv \\$3
  738. X+.ds Dt \\$4
  739. X+..
  740. X+.Id $Id: wdiff.1,v 0.4 1992/12/21 22:34:46 cmb Exp $
  741. X+.ds r \s-1RCS\s0
  742. X+.if n .ds - \%--
  743. X+.if t .ds - \(em
  744. X+.TH WDIFF 1 \*(Dt GNU
  745. X+.SH NAME
  746. X+wdiff \- display word differences between text files
  747. X+
  748. X+.SH SYNOPSIS
  749. X+.B wdiff
  750. X+[
  751. X+.B option \&.\|.\|.
  752. X+]
  753. X+.I old\_file new_file
  754. X+
  755. X+.SH COPYRIGHT
  756. X+Copyright (C) 1992 by the Free Software Foundation, Inc.
  757. X+
  758. X+.\" --------------------------------------------------
  759. X+.\" Now the body of the text...
  760. X+.\" --------------------------------------------------
  761. X+.SH DESCRIPTION
  762. X+
  763. X+.B wdiff
  764. X+compares two files, finding which words have been deleted or added to
  765. X+.I old_file
  766. X+to get
  767. X+.I new_file.
  768. X+A word is anything between whitespace.  The output is collected and
  769. X+used to produce an annotated copy of
  770. X+.I new_file
  771. X+on standard output. Suitable annotations produce a nice display of
  772. X+word differences between the original files.
  773. X+
  774. X+.B wdiff
  775. X+will exit with a status of 0 if no differences were found, a status of
  776. X+1 if any differences were found, or a status of 2 for any error.
  777. X+
  778. X+Usually underlining is used to mark deleted text, while bold or
  779. X+reverse video is used to mark inserted text; these defaults may be
  780. X+over-ridden by command line options.
  781. X+.I deleted text
  782. X+refers to text in
  783. X+.I old_file
  784. X+which is not in 
  785. X+.I new_file,
  786. X+while 
  787. X+.I inserted text
  788. X+refers to text on 
  789. X+.I new_file
  790. X+which is not in
  791. X+.I old_file.
  792. X+
  793. X+.\" --------------------------------------------------
  794. X+.\" Now the command line options.
  795. X+.\" --------------------------------------------------
  796. X+.SH OPTIONS
  797. X+.\" ------------------------------
  798. X+.TP
  799. X+.B \-\-help
  800. X+Has the same effect as \-h.
  801. X+.TP
  802. X+.B \-h
  803. X+Print an informative help message describing the options.
  804. X+.\" ------------------------------------------------------------
  805. X+.TP
  806. X+.B \-\-version
  807. X+Has the same effect as \-v.
  808. X+.TP
  809. X+.B \-v
  810. X+Print the version number of
  811. X+.B wdiff
  812. X+on the standard error output.
  813. X+.\" ------------------------------------------------------------
  814. X+.TP
  815. X+.B \-\-no\-deleted
  816. X+Has the same effect as \-1.
  817. X+.TP
  818. X+.B \-1
  819. X+Avoid producing deleted words on the output. If neither
  820. X+.B \-1
  821. X+or
  822. X+.B \-2
  823. X+is selected, the original right margin may be exceeded for some lines.
  824. X+.\" ------------------------------------------------------------
  825. X+.TP
  826. X+.B \-\-no\-inserted
  827. X+Has the same effect as \2.
  828. X+.TP
  829. X+.B \-2
  830. X+Avoid producing inserted words on the output. If neither
  831. X+.B \-1
  832. X+or
  833. X+.B \-2
  834. X+is selected, the original right margin may be exceeded for some lines.
  835. X+.\" ------------------------------------------------------------
  836. X+.TP
  837. X+.B \-\-no\-common
  838. X+Has the same effect as \-3.
  839. X+.TP
  840. X+.B \-3
  841. X+Avoid producing common words on the output.  When this option is not
  842. X+selected, common words and whitespace are taken from 
  843. X+.I new_file.
  844. X+When selected, differences are separated from one another by lines of
  845. X+dashes.  Moreover, if this option is selected at the same time as
  846. X+.B \-1
  847. X+or
  848. X+.B \-2,
  849. X+then none of the output will have any emphasis \- i.e. no bold or
  850. X+underlining.  Finally, if this option is not selected, but both
  851. X+.B \-1
  852. X+and
  853. X+.B \-2
  854. X+are, then sections of common words between differences are separated
  855. X+by lines of dashes.
  856. X+
  857. X+.\" ------------------------------------------------------------
  858. X+.TP
  859. X+.B \-\-statistics
  860. X+Has the same effect as \-s.
  861. X+.TP
  862. X+.B \-s
  863. X+On completion, for each file, the total number of words, the number of
  864. X+common words between the files, the number of words deleted or
  865. X+inserted and the number of words that have changed is output. (A
  866. X+changed word is one that has been replaced or is part of a
  867. X+replacement.)  Except for the total number of words, all of the
  868. X+numbers are followed by a percentage relative to the total number of
  869. X+words in the file.
  870. X+
  871. X+.\" ------------------------------------------------------------
  872. X+.TP
  873. X+.B \-\-auto-pager
  874. X+Has the same effect as \-a.
  875. X+.TP
  876. X+.B \-a
  877. X+A pager is interposed whenever the 
  878. X+.B wdiff
  879. X+output is directed to the user's terminal.  Without this option, no
  880. X+pager will be called; the user is then responsible for explicitly
  881. X+piping 
  882. X+.B wdiff
  883. X+output into a pager if required.
  884. X+
  885. X+The pager is selected by the value of the 
  886. X+.B PAGER
  887. X+environment
  888. X+variable when 
  889. X+.B wdiff
  890. X+is run.  If 
  891. X+.B PAGER
  892. X+is not defined at run time, then a default pager, selected at
  893. X+installation time, will be used instead.  A defined but empty value of 
  894. X+.B PAGER
  895. X+means no pager at all.
  896. X+
  897. X+When a pager is interposed through the use of this option, one of the
  898. X+options \-l or \-t is also selected, depending on whether the string
  899. X+"less" appears in the pager's name or not.
  900. X+
  901. X+It is often useful to define
  902. X+.I wdiff
  903. X+as an alias for
  904. X+.I wdiff -a.
  905. X+However, this "hides" the normal 
  906. X+.B wdiff
  907. X+behaviour. The default behaviour may be restored simply by piping the
  908. X+output from 
  909. X+.B wdiff
  910. X+through
  911. X+.B cat.
  912. X+This dissociates the output from the user terminal.
  913. X+
  914. X+.\" ------------------------------------------------------------
  915. X+.TP
  916. X+.B \-\-printer
  917. X+Has the same effect as \-p.
  918. X+.TP
  919. X+.B \-p
  920. X+Use over-striking to emphasize parts of the output.  Each character of
  921. X+the deleted text is underlined by writing an underscore \_ first, then
  922. X+a backspace and then the letter to be underlined.  Each character of
  923. X+the inserted text is emboldened by writing it twice, with a backspace
  924. X+in between.  This option is not selected by default.
  925. X+
  926. X+.\" ------------------------------------------------------------
  927. X+.TP
  928. X+.B \-\-less-mode
  929. X+Has the same effect as \-l.
  930. X+.TP
  931. X+.B \-l
  932. X+Use over-striking to emphasize parts of output.  This option works as
  933. X+option \-p, but also over-strikes whitespace associated with
  934. X+inserted text.  
  935. X+.B less
  936. X+shows such whitespace using reverse video.  This option is not
  937. X+selected by default.  However, it is automatically turned on whenever 
  938. X+.B wdiff
  939. X+launches
  940. X+.B less.
  941. X+(See option \-a.)
  942. X+
  943. X+This option is commonly used in conjunction with 
  944. X+.B less:
  945. X+
  946. X+.B wdiff -l
  947. X+.I old_file
  948. X+.I new_file
  949. X+.B | less
  950. X+
  951. X+.\" ------------------------------------------------------------
  952. X+.TP
  953. X+.B \-\-terminal
  954. X+Has the same effect as \-t.
  955. X+.TP
  956. X+.B \-t
  957. X+Force the production of 
  958. X+.I termcap
  959. X+strings for emphasising parts of output, even if the standard output
  960. X+is not associated with a terminal.  The
  961. X+.B TERM
  962. X+environment variable must contain the name of a valid
  963. X+.I termcap
  964. X+entry. If the terminal description permits, underlining is used for
  965. X+marking deleted text, while bold or reverse video is used for
  966. X+marking inserted text.  This option is not selected by default.
  967. X+However, it is automatically turned on whenever
  968. X+.B wdiff
  969. X+launches a pager, and it is known that the pager is
  970. X+.I not
  971. X+.B less.
  972. X+(See option \-a.)
  973. X+
  974. X+This option is commonly used when
  975. X+.B wdiff
  976. X+output is not redirected, but sent directly to the user's terminal, as
  977. X+in: 
  978. X+
  979. X+.B wdiff -t
  980. X+.I old_file
  981. X+.I new_file
  982. X+
  983. X+A common kludge uses
  984. X+.B wdiff
  985. X+together with the pager
  986. X+.B more,
  987. X+as in:
  988. X+
  989. X+.B wdiff -t
  990. X+.I old_file
  991. X+.I new_file
  992. X+.B | more
  993. X+
  994. X+
  995. X+However, some versions of 
  996. X+.B more
  997. X+use 
  998. X+.B termcap
  999. X+emphasis for their own purposes, so strange interactions are possible.
  1000. X+
  1001. X+.\" ------------------------------------------------------------
  1002. X+.TP
  1003. X+.B \-\-start\-delete argument
  1004. X+Has the same effect as \-w.
  1005. X+.TP
  1006. X+.B \-w argument
  1007. X+Use 
  1008. X+.I argument 
  1009. X+as the "start delete" string.  This string will be output prior to
  1010. X+every sequence of deleted text, to mark where it starts.  By default,
  1011. X+no start delete string is used unless there is no other means of
  1012. X+distinguishing where such text starts; in this case the default start
  1013. X+delete string is
  1014. X+.B [\-.
  1015. X+
  1016. X+.\" ------------------------------------------------------------
  1017. X+.TP
  1018. X+.B \-\-end\-delete argument
  1019. X+Has the same effect as \-x.
  1020. X+.TP
  1021. X+.B \-x argument
  1022. X+Use 
  1023. X+.I argument
  1024. X+as the "end delete" string.  This string will be output after every
  1025. X+sequence of deleted text, to mark where it ends.  By default, no end
  1026. X+delete string is used unless there is no other means of distinguishing
  1027. X+where such text ends; in this case the default end delete string is
  1028. X+.B \-].
  1029. X+
  1030. X+.\" ------------------------------------------------------------
  1031. X+.TP
  1032. X+.B \-\-start\-insert argument
  1033. X+Has the same effect as \-y.
  1034. X+.TP
  1035. X+.B \-y argument
  1036. X+Use 
  1037. X+.I argument
  1038. X+as the "start insert" string.  This string will be output prior to any
  1039. X+sequence of inserted text, to mark where it starts.  By default, no
  1040. X+start insert string is used unless there is no other means of
  1041. X+distinguishing where such text starts; in this case the default start
  1042. X+insert string is
  1043. X+.B {+.
  1044. X+
  1045. X+.\" ------------------------------------------------------------
  1046. X+.TP
  1047. X+.B \-\-end\-insert argument
  1048. X+Has the same effect as \-z.
  1049. X+.TP
  1050. X+.B \-z argument
  1051. X+Use 
  1052. X+.I argument
  1053. X+as the "end insert" string.  This string will be output after any
  1054. X+sequence of inserted text, to mark where it ends.  By default, no end
  1055. X+insert string is used unless there is no other means of distinguishing
  1056. X+where such text ends; in this case the default end insert string is
  1057. X+.B +}.
  1058. X+
  1059. X+.\" ------------------------------------------------------------
  1060. X+.TP
  1061. X+.B \-\-avoid\-wraps
  1062. X+Has the same effect as \-n.
  1063. X+.TP
  1064. X+.B \-n
  1065. X+Avoid spanning the end of line while showing deleted or inserted text.
  1066. X+Any single fragment of deleted or inserted text spanning many lines
  1067. X+will be considered as being made up of many smaller fragments not
  1068. X+containing a newline.  So deleted text, for example, will have an end
  1069. X+delete string at the end of each line, just before the new line, and a
  1070. X+start delete string at the beginning of the next line.  A long
  1071. X+paragraph of inserted text will have each line bracketed between start
  1072. X+insert and end insert strings.  This behaviour is not selected by
  1073. X+default.
  1074. X+
  1075. X+.\" ------------------------------------------------------------
  1076. X+.LP
  1077. X+.\" --------------------------------------------------
  1078. X+.\" Some text to round things off, after the command line options. 
  1079. X+.\" --------------------------------------------------
  1080. X+
  1081. X+Note that options 
  1082. X+.B \-p, \-t, 
  1083. X+and 
  1084. X+.B \-[wxyz] 
  1085. X+are not mutually exclusive. If you use a combination of them, you will
  1086. X+merely accumulate the effect of each.  Option 
  1087. X+.B \-l
  1088. X+is a variant of option 
  1089. X+.B \-p.
  1090. X+
  1091. X+.\" --------------------------------------------------
  1092. X+.\" Some useful example of the use of the options above
  1093. X+.\" --------------------------------------------------
  1094. X+.SH EXAMPLES
  1095. X+
  1096. X+The following command produces a copy of
  1097. X+.I new_file,
  1098. X+shifted right one space to accommodate change bars since the last
  1099. X+revision, ignoring those changes coming only from paragraph refilling.
  1100. X+Any line with new or changed text will get a
  1101. X+.B |
  1102. X+in column 1. However, deleted text is not shown nor marked.
  1103. X+
  1104. X+.B wdiff -1n
  1105. X+.I old_file new_file 
  1106. X+.B | sed -e 's/^/  /;/{+/s/^ /|/;s/{+//g;s/+}//g'
  1107. X+
  1108. X+
  1109. X+.\" --------------------------------------------------
  1110. X+.\" Now the bugs section.
  1111. X+.\" --------------------------------------------------
  1112. X+.SH BUGS
  1113. X+If you find a bug in 
  1114. X+.B wdiff,
  1115. X+please send electronic mail to 
  1116. X+.I pinard@iro.umontreal.ca.
  1117. X+Include the version number, which you can find by running 
  1118. X+.B wdiff \-\-version.
  1119. X+Include in your message sufficient input to reproduce the problem and
  1120. X+also, the output you expected.
  1121. X+
  1122. X+.B wdiff
  1123. X+currently calls 
  1124. X+.B diff.
  1125. X+.B wdiff
  1126. X+would be quicker and cleaner to implement if it were part of the
  1127. X+.B diff
  1128. X+suite of programs.
  1129. X+
  1130. X+Here are some (un-processed) suggestions:
  1131. X+.TP
  1132. X+\-
  1133. X+Make an MS-DOS port.
  1134. X+.TP
  1135. X+\-
  1136. X+Select by options exactly what is whitespace.
  1137. X+.TP
  1138. X+\- 
  1139. X+Have a 
  1140. X+.B wpatch
  1141. X+program.  Hard to see a good way of doing this.
  1142. X+.LP
  1143. X+
  1144. X+.\" --------------------------------------------------
  1145. X+.\" Some final sections
  1146. X+.\" --------------------------------------------------
  1147. X+.SH IDENTIFICATION
  1148. X+Author: Francois Pinard,
  1149. X+.I pinard@iro.umontreal.ca
  1150. X+.br
  1151. X+Manual Page: Colin M. Brough,
  1152. X+.I cmb@epcc.ed.ac.uk
  1153. X+.br
  1154. X+Revision Number: \*(Rv; Release Date: \*(Dt.
  1155. X+
  1156. X+.SH SEE ALSO
  1157. X+diff(1), less(1), cat(1), more(1), termcap(3).
  1158. X--- wdiff-0.03/wdiff.c    Mon Aug 17 14:17:20 1992
  1159. X+++ wdiff-0.04/wdiff.c    Wed Dec 23 21:10:28 1992
  1160. X@@ -27,9 +27,9 @@
  1161. X #define DIFF_PROGRAM "diff"
  1162. X #endif
  1163. X-/* One may also, optionnaly, define a default PAGER_PROGRAM.  This is
  1164. X-   normally done from the Makefile.  If PAGER_PROGRAM is undefined and
  1165. X-   the PAGER environment variable is not set, none will be used.  */
  1166. X+/* One may also, optionnaly, define a default PAGER_PROGRAM.  This might
  1167. X+   be done from the Makefile.  If PAGER_PROGRAM is undefined and the
  1168. X+   PAGER environment variable is not set, none will be used.  */
  1169. X /* Define the separator lines when output is inhibited.  */
  1170. X #define SEPARATOR_LINE \
  1171. X@@ -44,17 +44,25 @@
  1172. X #include <ctype.h>
  1173. X #include <stdio.h>
  1174. X-#ifdef USG
  1175. X+#ifdef STDC_HEADERS
  1176. X #include <string.h>
  1177. X-#else
  1178. X+#else /* not STDC_HEADERS */
  1179. X+#ifdef HAVE_STRING_H
  1180. X+#include <string.h>
  1181. X+#else /* not HAVE_STRING_H */
  1182. X #include <strings.h>
  1183. X-#endif
  1184. X+#endif /* not HAVE_STRING_H */
  1185. X+#endif /* not STDC_HEADERS */
  1186. X+char *strstr ();
  1187. X+
  1188. X+#ifdef HAVE_TPUTS
  1189. X #ifdef HAVE_TERMCAP_H
  1190. X #include <termcap.h>
  1191. X #else
  1192. X const char *tgetstr ();
  1193. X #endif
  1194. X+#endif /* HAVE_TPUTS */
  1195. X #include <setjmp.h>
  1196. X #include <signal.h>
  1197. X@@ -62,6 +70,10 @@
  1198. X #define RETSIGTYPE void
  1199. X #endif
  1200. X+#if defined (HAVE_UNISTD_H)
  1201. X+#include <unistd.h>
  1202. X+#endif
  1203. X+
  1204. X #include "getopt.h"
  1205. X char *getenv ();
  1206. X@@ -68,13 +80,13 @@
  1207. X FILE *readpipe ();
  1208. X FILE *writepipe ();
  1209. X char *tmpnam ();
  1210. X-void *xmalloc ();
  1211. X-const char *strstr ();
  1212. X-const char *xstrdup ();
  1213. X+void error ();
  1214. X+
  1215. X+/* Declarations.  */
  1216. X /* Option variables.  */
  1217. X-struct option longopts[] =
  1218. X+struct option const longopts[] =
  1219. X {
  1220. X   {"copyright"   , 0, NULL, 'C'},
  1221. X   {"no-deleted"  , 0, NULL, '1'},
  1222. X@@ -92,8 +104,10 @@
  1223. X   {NULL          , 0, NULL, 0}
  1224. X };
  1225. X-extern char version[];        /* program version */
  1226. X-extern char copyright[];    /* short copyright */
  1227. X+static char const version[] =
  1228. X+  "wdiff, version 0.04";
  1229. X+static char const copyright[] =
  1230. X+  "Copyright (C) 1992 Free Software Foundation, Inc.";
  1231. X const char *program_name;    /* name of executing program */
  1232. X@@ -100,14 +114,17 @@
  1233. X int inhibit_left;        /* inhibit display of left side words */
  1234. X int inhibit_right;        /* inhibit display of left side words */
  1235. X int inhibit_common;        /* inhibit display of common words */
  1236. X-int show_statistics;        /* for printing summary statistics */
  1237. X-int is_printer;            /* use printer modes */
  1238. X-int is_display;            /* use termcap strings */
  1239. X-int pager_is_less;        /* if paging through the "less" program */
  1240. X+int show_statistics;        /* if printing summary statistics */
  1241. X+int no_wrapping;        /* end/restart strings at end of lines */
  1242. X+int autopager;            /* if calling the pager automatically */
  1243. X+int overstrike;            /* if using printer overstrikes */
  1244. X+int overstrike_for_less;    /* if output aimed to the "less" program */
  1245. X const char *user_delete_start;    /* user specified string for start of delete */
  1246. X const char *user_delete_end;    /* user specified string for end of delete */
  1247. X const char *user_insert_start;    /* user specified string for start of insert */
  1248. X const char *user_insert_end;    /* user specified string for end of insert */
  1249. X+
  1250. X+int find_termcap;        /* initialize the termcap strings */
  1251. X const char *term_delete_start;    /* termcap string for start of delete */
  1252. X const char *term_delete_end;    /* termcap string for end of delete */
  1253. X const char *term_insert_start;    /* termcap string for start of insert */
  1254. X@@ -126,6 +143,13 @@
  1255. X jmp_buf signal_label;        /* where to jump when signal received */
  1256. X int jump_trigger;        /* set when some signal has been received */
  1257. X+/* Guarantee some value for L_tmpnam.  */
  1258. X+#ifndef L_tmpnam
  1259. X+#include <sys/types.h>
  1260. X+#include "pathmax.h"
  1261. X+#define L_tmpnam PATH_MAX
  1262. X+#endif
  1263. X+
  1264. X typedef struct side SIDE;    /* all variables for one side */
  1265. X struct side
  1266. X {
  1267. X@@ -133,7 +157,7 @@
  1268. X   FILE *file;            /* original input file */
  1269. X   int position;            /* number of words read so far */
  1270. X   int character;        /* one character look ahead */
  1271. X-  const char *temp_name;    /* temporary file name */
  1272. X+  char temp_name[L_tmpnam];    /* temporary file name */
  1273. X   FILE *temp_file;        /* temporary file */
  1274. X };
  1275. X SIDE side_array[2];        /* area for holding side descriptions */
  1276. X@@ -146,7 +170,6 @@
  1277. X int argument[4];        /* four diff directive arguments */
  1278. X FILE *output_file;        /* file to which we write output */
  1279. X-int output_is_less;        /* flag indicating that pager is less */
  1280. X const char *termcap_init_string; /* how to initialize the termcap mode */
  1281. X const char *termcap_end_string; /* how to complete the termcap mode */
  1282. X@@ -199,7 +222,7 @@
  1283. X   int success;            /* tgetent results */
  1284. X #ifdef HAVE_TPUTS
  1285. X-  if (is_display)
  1286. X+  if (find_termcap)
  1287. X     {
  1288. X       name = getenv ("TERM");
  1289. X       if (name == NULL)
  1290. X@@ -221,16 +244,19 @@
  1291. X     }
  1292. X #endif /* HAVE_TPUTS */
  1293. X-  /* Insure some default strings.  */
  1294. X+  /* Ensure some default strings.  */
  1295. X-  if (!term_delete_start && !is_printer && user_delete_start == NULL)
  1296. X-    user_delete_start = "[-";
  1297. X-  if (!term_delete_end && !is_printer && user_delete_end == NULL)
  1298. X-    user_delete_end = "-]";
  1299. X-  if (!term_insert_start && !is_printer && user_insert_start == NULL)
  1300. X-    user_insert_start = "{+";
  1301. X-  if (!term_insert_end && !is_printer && user_insert_end == NULL)
  1302. X-    user_insert_end = "+}";
  1303. X+  if (!overstrike)
  1304. X+    {
  1305. X+      if (!term_delete_start && !user_delete_start)
  1306. X+    user_delete_start = "[-";
  1307. X+      if (!term_delete_end && !user_delete_end)
  1308. X+    user_delete_end = "-]";
  1309. X+      if (!term_insert_start && !user_insert_start)
  1310. X+    user_insert_start = "{+";
  1311. X+      if (!term_insert_end && !user_insert_end)
  1312. X+    user_insert_end = "+}";
  1313. X+    }
  1314. X }
  1315. X@@ -376,7 +402,7 @@
  1316. X   while (isspace (side->character))
  1317. X     {
  1318. X-      /* While changing lines, insure we stop any special display prior
  1319. X+      /* While changing lines, ensure we stop any special display prior
  1320. X      to, and restore the special display after.  When copy_mode is
  1321. X      anything else than COPY_NORMAL, file is always output_file.  We
  1322. X      care underlining whitespace or overstriking it with itself,
  1323. X@@ -391,6 +417,8 @@
  1324. X     case COPY_DELETED:
  1325. X       if (side->character == '\n')
  1326. X         {
  1327. X+          if (no_wrapping && user_delete_end)
  1328. X+        fprintf (output_file, "%s", user_delete_end);
  1329. X #ifdef HAVE_TPUTS
  1330. X           if (term_delete_end)
  1331. X         tputs (term_delete_end, 0, putc_for_tputs);
  1332. X@@ -400,8 +428,10 @@
  1333. X           if (term_delete_start)
  1334. X         tputs (term_delete_start, 0, putc_for_tputs);
  1335. X #endif
  1336. X+          if (no_wrapping && user_delete_start)
  1337. X+        fprintf (output_file, "%s", user_delete_start);
  1338. X         }
  1339. X-      else if (pager_is_less)
  1340. X+      else if (overstrike_for_less)
  1341. X         {
  1342. X           putc ('_', output_file);
  1343. X           putc ('\b', output_file);
  1344. X@@ -414,6 +444,8 @@
  1345. X     case COPY_INSERTED:
  1346. X       if (side->character == '\n')
  1347. X         {
  1348. X+          if (no_wrapping && user_insert_end)
  1349. X+        fprintf (output_file, "%s", user_insert_end);
  1350. X #ifdef HAVE_TPUTS
  1351. X           if (term_insert_end)
  1352. X         tputs (term_insert_end, 0, putc_for_tputs);
  1353. X@@ -423,8 +455,10 @@
  1354. X           if (term_insert_start)
  1355. X         tputs (term_insert_start, 0, putc_for_tputs);
  1356. X #endif
  1357. X+          if (no_wrapping && user_insert_start)
  1358. X+        fprintf (output_file, "%s", user_insert_start);
  1359. X         }
  1360. X-      else if (pager_is_less)
  1361. X+      else if (overstrike_for_less)
  1362. X         {
  1363. X           putc (side->character, output_file);
  1364. X           putc ('\b', output_file);
  1365. X@@ -457,7 +491,7 @@
  1366. X       /* In printer mode, act according to copy_mode.  If copy_mode is not
  1367. X      COPY_NORMAL, we know that file is necessarily output_file.  */
  1368. X-      if (is_printer)
  1369. X+      if (overstrike)
  1370. X     switch (copy_mode)
  1371. X       {
  1372. X       case COPY_NORMAL:
  1373. X@@ -510,6 +544,7 @@
  1374. X   side->character = getc (side->file);
  1375. X   side->position = 0;
  1376. X+  tmpnam (side->temp_name);
  1377. X   side->temp_file = fopen (side->temp_name, "w");
  1378. X   if (side->temp_file == NULL)
  1379. X     {
  1380. X@@ -722,6 +757,10 @@
  1381. X           count_changed_right += argument[3] - argument[2] + 1;
  1382. X           resync_left = argument[0] - 1;
  1383. X           resync_right = argument[2] - 1;
  1384. X+          break;
  1385. X+
  1386. X+        default:
  1387. X+          abort ();
  1388. X         }
  1389. X       if (!inhibit_left)
  1390. X@@ -760,7 +799,7 @@
  1391. X           end_of_delete ();
  1392. X         }
  1393. X-      /* Show any inserted code, or insure skipping over it in case the
  1394. X+      /* Show any inserted code, or ensure skipping over it in case the
  1395. X          right file is used merely to show common words.  */
  1396. X       if (directive == 'a' || directive == 'c')
  1397. X@@ -850,9 +889,8 @@
  1398. X   /* Check if a output program should be called, and which one.  Avoid
  1399. X      all paging if only statistics are needed.  */
  1400. X-  if (inhibit_left && inhibit_right && inhibit_common)
  1401. X-    program = NULL;
  1402. X-  else if (isatty (fileno (stdout)))
  1403. X+  if (autopager && isatty (fileno (stdout))
  1404. X+      && !(inhibit_left && inhibit_right && inhibit_common))
  1405. X     {
  1406. X       program = getenv ("PAGER");
  1407. X #ifdef PAGER_PROGRAM
  1408. X@@ -863,16 +901,18 @@
  1409. X   else
  1410. X     program = NULL;
  1411. X-  /* By default, use stdout for output_file.  Insure the termcap
  1412. X-     initialization string is sent to stdout, not the pager.  */
  1413. X+  /* Use stdout as default output.  */
  1414. X   output_file = stdout;
  1415. X+
  1416. X+  /* Ensure the termcap initialization string is sent to stdout right
  1417. X+     away, never to the pager.  */
  1418. X+
  1419. X #ifdef HAVE_TPUTS
  1420. X   if (termcap_init_string)
  1421. X     {
  1422. X       tputs (termcap_init_string, 0, putc_for_tputs);
  1423. X-      if (program && *program)
  1424. X-    fflush (stdout);
  1425. X+      fflush (stdout);
  1426. X     }
  1427. X #endif
  1428. X@@ -891,9 +931,9 @@
  1429. X       if (strstr (program, "less"))
  1430. X     {
  1431. X-      is_display = 0;
  1432. X-      is_printer = 1;
  1433. X-      pager_is_less = 1;
  1434. X+      find_termcap = 0;
  1435. X+      overstrike = 1;
  1436. X+      overstrike_for_less = 1;
  1437. X     }
  1438. X     }
  1439. X }
  1440. X@@ -918,6 +958,12 @@
  1441. X     case COPY_INSERTED:
  1442. X       end_of_insert ();
  1443. X       break;
  1444. X+    
  1445. X+    case COPY_NORMAL:
  1446. X+      break;
  1447. X+
  1448. X+    default:
  1449. X+      abort ();
  1450. X     }
  1451. X   /* Let the user play at will inside the pager, until s/he exits, before
  1452. X@@ -929,8 +975,8 @@
  1453. X       wait (NULL);
  1454. X     }
  1455. X-  /* Insure the termcap termination string is sent to stdout, not the
  1456. X-     pager, and this only once the pager has terminated.  */
  1457. X+  /* Ensure the termcap termination string is sent to stdout, never to
  1458. X+     the pager.  Moreover, the pager has terminated already.  */
  1459. X #ifdef HAVE_TPUTS
  1460. X   if (termcap_end_string)
  1461. X@@ -984,21 +1030,48 @@
  1462. X /* Main control.  */
  1463. X+/*-----------------------------------.
  1464. X+| Prints a more detailed Copyright.  |
  1465. X+`-----------------------------------*/
  1466. X+
  1467. X+static void
  1468. X+print_copyright (void)
  1469. X+{
  1470. X+  fprintf (stderr, "\
  1471. X+This program is free software; you can redistribute it and/or modify\n\
  1472. X+it under the terms of the GNU General Public License as published by\n\
  1473. X+the Free Software Foundation; either version 2, or (at your option)\n\
  1474. X+any later version.\n\
  1475. X+\n\
  1476. X+This program is distributed in the hope that it will be useful,\n\
  1477. X+but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
  1478. X+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
  1479. X+GNU General Public License for more details.\n\
  1480. X+\n\
  1481. X+You should have received a copy of the GNU General Public License\n\
  1482. X+along with this program; if not, write to the Free Software\n\
  1483. X+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\
  1484. X+\n");
  1485. X+}
  1486. X+
  1487. X /*-----------------------------.
  1488. X | Tell how to use, then exit.  |
  1489. X `-----------------------------*/
  1490. X-void
  1491. X+static void
  1492. X usage_and_exit (void)
  1493. X {
  1494. X   fprintf (stderr, "\
  1495. X-Usage: %s [ OPTION ... ] FILE_1 FILE_2\n\
  1496. X+Usage: %s [ OPTION ... ] OLD_FILE NEW_FILE\n\
  1497. X \n\
  1498. X   -C, --copyright            print Copyright then exit\n\
  1499. X   -1, --no-deleted           inhibit output of deleted words\n\
  1500. X   -2, --no-inserted          inhibit output of inserted words\n\
  1501. X   -3, --no-common            inhibit output of common words\n\
  1502. X+  -a, --auto-pager           automatically calls a pager\n\
  1503. X   -h, --help                 print this help\n\
  1504. X+  -l, --less-mode            variation of printer mode for \"less\"\n\
  1505. X+  -n, --avoid-wraps          do not extend fields through newlines\n\
  1506. X   -p, --printer              overstrike as for printers\n\
  1507. X   -s, --statistics           say how many words deleted, inserted etc.\n\
  1508. X   -t, --terminal             use termcap as for terminal displays\n\
  1509. X@@ -1029,13 +1102,16 @@
  1510. X   inhibit_right = 0;
  1511. X   inhibit_common = 0;
  1512. X   show_statistics = 0;
  1513. X-  is_printer = 0;
  1514. X-  is_display = isatty (fileno (stdout));
  1515. X-  pager_is_less = 0;
  1516. X+  no_wrapping = 0;
  1517. X+  autopager = 0;
  1518. X+  overstrike = 0;
  1519. X+  overstrike_for_less = 0;
  1520. X   user_delete_start = NULL;
  1521. X   user_delete_end = NULL;
  1522. X   user_insert_start = NULL;
  1523. X   user_insert_end = NULL;
  1524. X+
  1525. X+  find_termcap = -1;        /* undecided yet */
  1526. X   term_delete_start = NULL;
  1527. X   term_delete_end = NULL;
  1528. X   term_insert_start = NULL;
  1529. X@@ -1050,7 +1126,7 @@
  1530. X   count_changed_right = 0;
  1531. X   while ((option_char
  1532. X-      = getopt_long (argc, argv, "123Chdpstvw:x:y:z:", longopts, NULL)
  1533. X+      = getopt_long (argc, argv, "123Cahdlnpstvw:x:y:z:", longopts, NULL)
  1534. X       ) != EOF)
  1535. X     switch (option_char)
  1536. X       {
  1537. X@@ -1070,8 +1146,23 @@
  1538. X     print_copyright ();
  1539. X     exit (EXIT_OTHER_REASON);
  1540. X+      case 'a':
  1541. X+    autopager = 1;
  1542. X+    break;
  1543. X+
  1544. X+      case 'l':
  1545. X+    if (find_termcap < 0)
  1546. X+      find_termcap = 0;
  1547. X+    overstrike = 1;
  1548. X+    overstrike_for_less = 1;
  1549. X+    break;
  1550. X+
  1551. X+      case 'n':
  1552. X+    no_wrapping = 1;
  1553. X+    break;
  1554. X+
  1555. X       case 'p':
  1556. X-    is_printer = 1;
  1557. X+    overstrike = 1;
  1558. X     break;
  1559. X       case 's':
  1560. X@@ -1079,12 +1170,15 @@
  1561. X     break;
  1562. X       case 't':
  1563. X+    if (find_termcap < 0)
  1564. X+      {
  1565. X #ifdef HAVE_TPUTS
  1566. X-    is_display = 1;
  1567. X+        find_termcap = 1;
  1568. X #else
  1569. X-    fprintf (stderr, "Cannot use -t, termcap not available.\n");
  1570. X-    exit (EXIT_OTHER_REASON);
  1571. X+        fprintf (stderr, "Cannot use -t, termcap not available.\n");
  1572. X+        exit (EXIT_OTHER_REASON);
  1573. X #endif
  1574. X+      }
  1575. X     break;
  1576. X       case 'v':
  1577. X@@ -1115,12 +1209,19 @@
  1578. X   if (optind + 2 != argc)
  1579. X     usage_and_exit ();
  1580. X+  /* If find_termcap still undecided, consider it unset.  However, set if
  1581. X+     autopager is set while stdout is directed to a terminal, but this
  1582. X+     decision will be reversed later if the pager happens to be "less".  */
  1583. X+
  1584. X+  if (find_termcap < 0)
  1585. X+    find_termcap = autopager && isatty (fileno (stdout));
  1586. X+
  1587. X   /* Setup file names and signals, then do it all.  */
  1588. X   left_side->filename = argv[optind++];
  1589. X   right_side->filename = argv[optind++];
  1590. X-  left_side->temp_name = xstrdup (tmpnam (NULL));
  1591. X-  right_side->temp_name = xstrdup (tmpnam (NULL));
  1592. X+  *left_side->temp_name = '\0';
  1593. X+  *right_side->temp_name = '\0';
  1594. X   setup_signals ();
  1595. X   input_file = NULL;
  1596. X@@ -1147,8 +1248,10 @@
  1597. X   if (input_file)
  1598. X     complete_input_program ();
  1599. X-  unlink (left_side->temp_name);
  1600. X-  unlink (right_side->temp_name);
  1601. X+  if (*left_side->temp_name)
  1602. X+    unlink (left_side->temp_name);
  1603. X+  if (*right_side->temp_name)
  1604. X+    unlink (right_side->temp_name);
  1605. X   if (output_file)
  1606. X     complete_output_program ();
  1607. X--- wdiff-0.03/wdiff.info    Tue Aug 18 06:31:12 1992
  1608. X+++ wdiff-0.04/wdiff.info    Wed Dec 23 17:50:54 1992
  1609. X@@ -1,11 +1,11 @@
  1610. X This is Info file wdiff.info, produced by Makeinfo-1.47 from the input
  1611. X-file wdiff.texi.
  1612. X+file ./wdiff.texi.
  1613. X-   This file documents the the `wdiff' command, which compares two
  1614. X-files, finding which words have been deleted or added to the first for
  1615. X-getting the second.
  1616. X+   This file documents the `wdiff' command, which compares two files,
  1617. X+finding which words have been deleted or added to the first for getting
  1618. X+the second.
  1619. X-   Copyright (C) 1992 Free Software Foundation, Inc.
  1620. X+   Copyright (C) 1992 by the Free Software Foundation, Inc.
  1621. SHAR_EOF
  1622. true || echo 'restore of Patch4 failed'
  1623. fi
  1624. echo 'End of  part 2'
  1625. echo 'File Patch4 is continued in part 3'
  1626. echo 3 > _shar_seq_.tmp
  1627. exit 0
  1628. --
  1629. Franc,ois Pinard       ``Happy GNU Year!''      pinard@iro.umontreal.ca
  1630. (514) 588-4656                                   ...!uunet!iros1!pinard
  1631. About the League for Programming Freedom?  Email me or lpf@uunet.uu.net
  1632.