diff options
author | peter <peter@FreeBSD.org> | 1999-12-11 12:24:21 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-12-11 12:24:21 +0000 |
commit | 784ea5066cbea73d04e8ce5783dd0eb842e3ac1f (patch) | |
tree | 2a59869a343a5d43c01370f1083d67c2a02785a0 /contrib/cvs/diff | |
parent | 308b60f66831aa65a459a7b347ea6ca14b6e4799 (diff) | |
download | FreeBSD-src-784ea5066cbea73d04e8ce5783dd0eb842e3ac1f.zip FreeBSD-src-784ea5066cbea73d04e8ce5783dd0eb842e3ac1f.tar.gz |
Import cvs-1.10.7. There are a number of nasty bugs that have been fixed.
Obtained from: cyclic.com
Diffstat (limited to 'contrib/cvs/diff')
-rw-r--r-- | contrib/cvs/diff/ChangeLog | 67 | ||||
-rw-r--r-- | contrib/cvs/diff/Makefile.in | 7 | ||||
-rw-r--r-- | contrib/cvs/diff/analyze.c | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/cmpbuf.c | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/cmpbuf.h | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/context.c | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/diff.c | 7 | ||||
-rw-r--r-- | contrib/cvs/diff/diff.h | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/diff3.c | 14 | ||||
-rw-r--r-- | contrib/cvs/diff/diffrun.h | 10 | ||||
-rw-r--r-- | contrib/cvs/diff/dir.c | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/ed.c | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/io.c | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/normal.c | 4 | ||||
-rw-r--r-- | contrib/cvs/diff/system.h | 7 | ||||
-rw-r--r-- | contrib/cvs/diff/util.c | 56 |
16 files changed, 141 insertions, 63 deletions
diff --git a/contrib/cvs/diff/ChangeLog b/contrib/cvs/diff/ChangeLog index 3ebde5d..a435182 100644 --- a/contrib/cvs/diff/ChangeLog +++ b/contrib/cvs/diff/ChangeLog @@ -1,3 +1,70 @@ +1999-05-06 Jim Kingdon <http://www.cyclic.com> + + * Makefile.in (DISTFILES): Remove libdiff.mak. + * libdiff.mak: Removed; we are back to a single makefile for + Visual C++ version 4. + +1999-04-29 Jim Kingdon <http://www.cyclic.com> + + * diff.c (diff_run): Use separate statement for setjmp call and if + statement. This is better style in general (IMHO) but in the case + of setjmp the UNICOS compiler apparently cares (I don't have the + standard handy, but there are lots of legitimate restrictions on + how you can call setjmp). + +1999-04-26 Jim Kingdon <http://www.cyclic.com> + + * Makefile.in (DISTFILES): Add libdiff.dsp libdiff.mak .cvsignore. + +1999-04-26 (submitted 1999-03-24) John O'Connor <john@shore.net> + + * libdiff.dsp: new file. MSVC project file used to build the library. + + * libdiff.mak: new file. Makefile for building from the command-line. + + * .cvsignore: Removed un-used entries related to MSVC. Added + entries to ignore directories generated by the NT build, Debug + and Release. + +1999-03-24 Larry Jones <larry.jones@sdrc.com> + and Olaf Brandes + + * diff3.c (diff3_run): Use a separate stream for the input to + output_diff3_merge instead of reopening stdin to avoid problems + with leaving it open. + +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/contrib/cvs/diff/Makefile.in b/contrib/cvs/diff/Makefile.in index b47d4c1..31f4910 100644 --- a/contrib/cvs/diff/Makefile.in +++ b/contrib/cvs/diff/Makefile.in @@ -12,10 +12,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. #### Start of system configuration section. #### @@ -47,7 +43,8 @@ SOURCES = diff.c diff3.c analyze.c cmpbuf.c cmpbuf.h io.c context.c ed.c \ diffrun.h OBJECTS = diff.o diff3.o analyze.o cmpbuf.o dir.o io.o util.o \ context.o ed.o ifdef.o normal.o side.o version.o -DISTFILES = $(SOURCES) ChangeLog build_diff.com Makefile.in +DISTFILES = $(SOURCES) ChangeLog build_diff.com Makefile.in diagmeet.note \ + libdiff.dsp .cvsignore all: libdiff.a diff --git a/contrib/cvs/diff/analyze.c b/contrib/cvs/diff/analyze.c index 0bda3cf..f292594 100644 --- a/contrib/cvs/diff/analyze.c +++ b/contrib/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/contrib/cvs/diff/cmpbuf.c b/contrib/cvs/diff/cmpbuf.c index e95a8f9..2820dfa 100644 --- a/contrib/cvs/diff/cmpbuf.c +++ b/contrib/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/contrib/cvs/diff/cmpbuf.h b/contrib/cvs/diff/cmpbuf.h index e3852b7..b7b965d 100644 --- a/contrib/cvs/diff/cmpbuf.h +++ b/contrib/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/contrib/cvs/diff/context.c b/contrib/cvs/diff/context.c index e843734..c4562c9 100644 --- a/contrib/cvs/diff/context.c +++ b/contrib/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/contrib/cvs/diff/diff.c b/contrib/cvs/diff/diff.c index 3467b53..e5f7e42 100644 --- a/contrib/cvs/diff/diff.c +++ b/contrib/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. */ @@ -690,7 +688,8 @@ diff_run (argc, argv, out, callbacks_arg) /* Set the jump buffer, so that diff may abort execution without terminating the process. */ - if ((val = setjmp (diff_abort_buf)) != 0) + val = setjmp (diff_abort_buf); + if (val != 0) { optind = optind_old; if (opened_file) diff --git a/contrib/cvs/diff/diff.h b/contrib/cvs/diff/diff.h index 6107e62..642138d 100644 --- a/contrib/cvs/diff/diff.h +++ b/contrib/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/contrib/cvs/diff/diff3.c b/contrib/cvs/diff/diff3.c index 64867f4..e3be150 100644 --- a/contrib/cvs/diff/diff3.c +++ b/contrib/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 */ @@ -459,13 +457,15 @@ diff3_run (argc, argv, out, callbacks_arg) tag_strings[0], tag_strings[1], tag_strings[2]); else if (merge) { - if (! freopen (file[rev_mapping[FILE0]], "r", stdin)) + FILE *mfp = fopen (file[rev_mapping[FILE0]], "r"); + if (! mfp) diff3_perror_with_exit (file[rev_mapping[FILE0]]); - conflicts_found - = output_diff3_merge (stdin, diff3, mapping, rev_mapping, + conflicts_found = output_diff3_merge (mfp, diff3, mapping, rev_mapping, tag_strings[0], tag_strings[1], tag_strings[2]); - if (ferror (stdin)) + if (ferror (mfp)) diff3_fatal ("read error"); + if (fclose(mfp) != 0) + perror_with_name (file[rev_mapping[FILE0]]); } else { diff --git a/contrib/cvs/diff/diffrun.h b/contrib/cvs/diff/diffrun.h index 28c1f45..08fbd0d 100644 --- a/contrib/cvs/diff/diffrun.h +++ b/contrib/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/contrib/cvs/diff/dir.c b/contrib/cvs/diff/dir.c index 6eef9a6..fae74e8 100644 --- a/contrib/cvs/diff/dir.c +++ b/contrib/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/contrib/cvs/diff/ed.c b/contrib/cvs/diff/ed.c index 6b00d13..74fc2a4 100644 --- a/contrib/cvs/diff/ed.c +++ b/contrib/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/contrib/cvs/diff/io.c b/contrib/cvs/diff/io.c index 6605915..730c09a 100644 --- a/contrib/cvs/diff/io.c +++ b/contrib/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/contrib/cvs/diff/normal.c b/contrib/cvs/diff/normal.c index 75dae88..b1f4955 100644 --- a/contrib/cvs/diff/normal.c +++ b/contrib/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/contrib/cvs/diff/system.h b/contrib/cvs/diff/system.h index 7812b76..76bc163 100644 --- a/contrib/cvs/diff/system.h +++ b/contrib/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/contrib/cvs/diff/util.c b/contrib/cvs/diff/util.c index 1b28170..c4d2d71 100644 --- a/contrib/cvs/diff/util.c +++ b/contrib/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); } |