summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/cvs/diff
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>1999-02-28 21:30:22 +0000
committertholo <tholo@openbsd.org>1999-02-28 21:30:22 +0000
commitc71bc7e269286e43816004eb0fcd7a55f036cd69 (patch)
tree794eb682ed86bb344bf2e65b4bee5ea179297b82 /gnu/usr.bin/cvs/diff
parentconditionalize use of sbus_testdma() (diff)
downloadwireguard-openbsd-c71bc7e269286e43816004eb0fcd7a55f036cd69.tar.xz
wireguard-openbsd-c71bc7e269286e43816004eb0fcd7a55f036cd69.zip
Latest version from Cyclic
Diffstat (limited to 'gnu/usr.bin/cvs/diff')
-rw-r--r--gnu/usr.bin/cvs/diff/ChangeLog32
-rw-r--r--gnu/usr.bin/cvs/diff/analyze.c4
-rw-r--r--gnu/usr.bin/cvs/diff/cmpbuf.c4
-rw-r--r--gnu/usr.bin/cvs/diff/cmpbuf.h4
-rw-r--r--gnu/usr.bin/cvs/diff/context.c4
-rw-r--r--gnu/usr.bin/cvs/diff/diagmeet.note71
-rw-r--r--gnu/usr.bin/cvs/diff/diff.c4
-rw-r--r--gnu/usr.bin/cvs/diff/diff.h4
-rw-r--r--gnu/usr.bin/cvs/diff/diff3.c4
-rw-r--r--gnu/usr.bin/cvs/diff/diffrun.h10
-rw-r--r--gnu/usr.bin/cvs/diff/dir.c4
-rw-r--r--gnu/usr.bin/cvs/diff/ed.c4
-rw-r--r--gnu/usr.bin/cvs/diff/io.c4
-rw-r--r--gnu/usr.bin/cvs/diff/normal.c4
-rw-r--r--gnu/usr.bin/cvs/diff/system.h7
-rw-r--r--gnu/usr.bin/cvs/diff/util.c56
16 files changed, 167 insertions, 53 deletions
diff --git a/gnu/usr.bin/cvs/diff/ChangeLog b/gnu/usr.bin/cvs/diff/ChangeLog
index 3ebde5df9d0..90ba69b11b9 100644
--- a/gnu/usr.bin/cvs/diff/ChangeLog
+++ b/gnu/usr.bin/cvs/diff/ChangeLog
@@ -1,3 +1,35 @@
+1999-02-17 Jim Kingdon <http://www.cyclic.com>
+ and Hallvard B Furuseth.
+
+ * util.c: Use __STDC__ consistently with ./system.h.
+ * system.h: Add comment about PARAMS.
+
+1999-01-12 Jim Kingdon <http://www.cyclic.com>
+
+ * Makefile.in, analyze.c, cmpbuf.c, cmpbuf.h, context.c, diff.c,
+ diff.h, diff3.c, diffrun.h, dir.c, ed.c, io.c, normal.c, system.h,
+ util.c: Remove paragraph containing the old snail mail address of
+ the Free Software Foundation.
+
+1998-09-21 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * util.c (printf_output): Make msg static; avoids auto
+ initializer, which is not portable to SunOS4 /bin/cc.
+ Reported by Mike Sutton@SAIC.
+
+1998-09-14 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in (DISTFILES): Add diagmeet.note.
+
+1998-08-15 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * diffrun.h (struct diff_callbacks): Change calling convention of
+ write_output so that a zero length means to output zero bytes.
+ The cvs_output convention is just too ugly/error-prone.
+ * util.c (printf_output): Rewrite to parse format string
+ overselves rather than calling vasprintf, which cannot be
+ implemented in portable C.
+
1998-08-06 David Masterson of kla-tencor.com
* util.c (flush_output): Don't prototype.
diff --git a/gnu/usr.bin/cvs/diff/analyze.c b/gnu/usr.bin/cvs/diff/analyze.c
index 0bda3cf7723..f2925946e38 100644
--- a/gnu/usr.bin/cvs/diff/analyze.c
+++ b/gnu/usr.bin/cvs/diff/analyze.c
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
/* The basic algorithm is described in:
"An O(ND) Difference Algorithm and its Variations", Eugene Myers,
diff --git a/gnu/usr.bin/cvs/diff/cmpbuf.c b/gnu/usr.bin/cvs/diff/cmpbuf.c
index e95a8f98ed9..2820dfa5a28 100644
--- a/gnu/usr.bin/cvs/diff/cmpbuf.c
+++ b/gnu/usr.bin/cvs/diff/cmpbuf.c
@@ -11,9 +11,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+ */
#include "system.h"
#include "cmpbuf.h"
diff --git a/gnu/usr.bin/cvs/diff/cmpbuf.h b/gnu/usr.bin/cvs/diff/cmpbuf.h
index e3852b7bd4f..b7b965d8575 100644
--- a/gnu/usr.bin/cvs/diff/cmpbuf.h
+++ b/gnu/usr.bin/cvs/diff/cmpbuf.h
@@ -13,8 +13,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
size_t buffer_lcm PARAMS((size_t, size_t));
diff --git a/gnu/usr.bin/cvs/diff/context.c b/gnu/usr.bin/cvs/diff/context.c
index e843734f45c..c4562c94b13 100644
--- a/gnu/usr.bin/cvs/diff/context.c
+++ b/gnu/usr.bin/cvs/diff/context.c
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#include "diff.h"
diff --git a/gnu/usr.bin/cvs/diff/diagmeet.note b/gnu/usr.bin/cvs/diff/diagmeet.note
new file mode 100644
index 00000000000..8f7242c7356
--- /dev/null
+++ b/gnu/usr.bin/cvs/diff/diagmeet.note
@@ -0,0 +1,71 @@
+Here is a comparison matrix which shows a case in which
+it is possible for the forward and backward scan in `diag'
+to meet along a nonzero length of diagonal simultaneous
+(so that bdiag[d] and fdiag[d] are not equal)
+even though there is no snake on that diagonal at the meeting point.
+
+
+ 85 1 1 1 159 1 1 17
+ 1 2 3 4
+60
+ 1 2
+1
+ 2 2 3 4
+71
+ 3 3 4 5
+85
+ 4 3 4 5
+17
+ 5 4 5
+1
+ 6 4 5 6
+183
+ 7 5 6 7
+10
+ 8 6 7
+1
+ 9 6 7 8
+12
+ 7 8 9 10
+13
+ 10 8 9 10
+14
+ 10 9 10
+17
+ 10 10
+1
+ 10 9 10
+1
+ 8 10 10 10
+183
+ 8 7 9 9 9
+10
+ 7 6 8 9 8 8
+1
+ 6 5 7 7
+1
+ 5 6 6
+1
+ 5 5 5
+50
+ 5 4 4 4
+1
+ 4 3 3
+85
+ 5 4 3 2 2
+1
+ 2 1
+17
+ 5 4 3 2 1 1
+1
+ 1 0
+ 85 1 1 1 159 1 1 17
+
+
+
+
+
+
+
+
+
diff --git a/gnu/usr.bin/cvs/diff/diff.c b/gnu/usr.bin/cvs/diff/diff.c
index 3467b537aec..bc951c4105f 100644
--- a/gnu/usr.bin/cvs/diff/diff.c
+++ b/gnu/usr.bin/cvs/diff/diff.c
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
/* GNU DIFF was written by Mike Haertel, David Hayes,
Richard Stallman, Len Tower, and Paul Eggert. */
diff --git a/gnu/usr.bin/cvs/diff/diff.h b/gnu/usr.bin/cvs/diff/diff.h
index 6107e6221fb..642138d6ef0 100644
--- a/gnu/usr.bin/cvs/diff/diff.h
+++ b/gnu/usr.bin/cvs/diff/diff.h
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#include "system.h"
#include <stdio.h>
diff --git a/gnu/usr.bin/cvs/diff/diff3.c b/gnu/usr.bin/cvs/diff/diff3.c
index 64867f48f23..65b783b3e67 100644
--- a/gnu/usr.bin/cvs/diff/diff3.c
+++ b/gnu/usr.bin/cvs/diff/diff3.c
@@ -11,9 +11,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+ */
/* Written by Randy Smith */
/* Librarification by Tim Pierce */
diff --git a/gnu/usr.bin/cvs/diff/diffrun.h b/gnu/usr.bin/cvs/diff/diffrun.h
index 28c1f45e5fd..08fbd0db70a 100644
--- a/gnu/usr.bin/cvs/diff/diffrun.h
+++ b/gnu/usr.bin/cvs/diff/diffrun.h
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#ifndef DIFFRUN_H
#define DIFFRUN_H
@@ -41,12 +39,14 @@ struct diff_callbacks
{
/* Write output. This function just writes a string of a given
length to the output file. The default is to fwrite to OUTFILE.
- If this callback is defined, flush_output must also be defined. */
+ If this callback is defined, flush_output must also be defined.
+ If the length is zero, output zero bytes. */
void (*write_output) DIFFPARAMS((char const *, size_t));
/* Flush output. The default is to fflush OUTFILE. If this
callback is defined, write_output must also be defined. */
void (*flush_output) DIFFPARAMS((void));
- /* Write to stdout. This is called for version and help messages. */
+ /* Write a '\0'-terminated string to stdout.
+ This is called for version and help messages. */
void (*write_stdout) DIFFPARAMS((char const *));
/* Print an error message. The first argument is a printf format,
and the next two are parameters. The default is to print a
diff --git a/gnu/usr.bin/cvs/diff/dir.c b/gnu/usr.bin/cvs/diff/dir.c
index 6eef9a63244..fae74e82c65 100644
--- a/gnu/usr.bin/cvs/diff/dir.c
+++ b/gnu/usr.bin/cvs/diff/dir.c
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#include "diff.h"
diff --git a/gnu/usr.bin/cvs/diff/ed.c b/gnu/usr.bin/cvs/diff/ed.c
index 6b00d133e4d..74fc2a4f1fe 100644
--- a/gnu/usr.bin/cvs/diff/ed.c
+++ b/gnu/usr.bin/cvs/diff/ed.c
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#include "diff.h"
diff --git a/gnu/usr.bin/cvs/diff/io.c b/gnu/usr.bin/cvs/diff/io.c
index 66059155109..730c09acd54 100644
--- a/gnu/usr.bin/cvs/diff/io.c
+++ b/gnu/usr.bin/cvs/diff/io.c
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#include "diff.h"
diff --git a/gnu/usr.bin/cvs/diff/normal.c b/gnu/usr.bin/cvs/diff/normal.c
index 75dae889930..b1f495522e0 100644
--- a/gnu/usr.bin/cvs/diff/normal.c
+++ b/gnu/usr.bin/cvs/diff/normal.c
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#include "diff.h"
diff --git a/gnu/usr.bin/cvs/diff/system.h b/gnu/usr.bin/cvs/diff/system.h
index 7812b767592..76bc1631fee 100644
--- a/gnu/usr.bin/cvs/diff/system.h
+++ b/gnu/usr.bin/cvs/diff/system.h
@@ -13,9 +13,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
/* We must define `volatile' and `const' first (the latter inside config.h),
so that they're used consistently in all system includes. */
@@ -29,6 +27,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/types.h>
#include <sys/stat.h>
+/* Note that PARAMS is just internal to the diff library; diffrun.h
+ has its own mechanism, which will hopefully be less likely to
+ conflict with the library's caller's namespace. */
#if __STDC__
#define PARAMS(args) args
#define VOID void
diff --git a/gnu/usr.bin/cvs/diff/util.c b/gnu/usr.bin/cvs/diff/util.c
index 1b281700a5d..c4d2d7169a1 100644
--- a/gnu/usr.bin/cvs/diff/util.c
+++ b/gnu/usr.bin/cvs/diff/util.c
@@ -13,13 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU DIFF; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+*/
#include "diff.h"
-#ifdef __STDC__
+#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
@@ -340,14 +338,14 @@ write_output (text, len)
/* Printf something to the output file. */
-#ifdef __STDC__
+#if __STDC__
#define VA_START(args, lastarg) va_start(args, lastarg)
#else /* ! __STDC__ */
#define VA_START(args, lastarg) va_start(args)
#endif /* __STDC__ */
void
-#if defined (__STDC__)
+#if __STDC__
printf_output (const char *format, ...)
#else
printf_output (format, va_alist)
@@ -360,17 +358,51 @@ printf_output (format, va_alist)
VA_START (args, format);
if (callbacks && callbacks->write_output)
{
- char *p;
+ /* We implement our own limited printf-like functionality (%s, %d,
+ and %c only). Callers who want something fancier can use
+ sprintf. */
+ const char *p = format;
+ char *q;
+ char *str;
+ int num;
+ int ch;
+ unsigned char buf[100];
+
+ while ((q = strchr (p, '%')) != NULL)
+ {
+ static const char msg[] =
+ "\ninternal error: bad % in printf_output\n";
+ (*callbacks->write_output) (p, q - p);
- p = NULL;
- vasprintf (&p, format, args);
- if (p == NULL)
- fatal ("out of memory");
+ switch (q[1])
+ {
+ case 's':
+ str = va_arg (args, char *);
+ (*callbacks->write_output) (str, strlen (str));
+ break;
+ case 'd':
+ num = va_arg (args, int);
+ sprintf (buf, "%d", num);
+ (*callbacks->write_output) (buf, strlen (buf));
+ break;
+ case 'c':
+ ch = va_arg (args, int);
+ buf[0] = ch;
+ (*callbacks->write_output) (buf, 1);
+ break;
+ default:
+ (*callbacks->write_output) (msg, sizeof (msg) - 1);
+ /* Don't just keep going, because q + 1 might point to the
+ terminating '\0'. */
+ goto out;
+ }
+ p = q + 2;
+ }
(*callbacks->write_output) (p, strlen (p));
- free (p);
}
else
vfprintf (outfile, format, args);
+ out:
va_end (args);
}