diff options
| author | jtc <jtc@NetBSD.org> | 1993-09-29 21:37:02 +0000 |
|---|---|---|
| committer | jtc <jtc@NetBSD.org> | 1993-09-29 21:37:02 +0000 |
| commit | ac21a0e171d9b7161e91467775af3b7213ad7502 (patch) | |
| tree | 629d6f045c9baf006133cbb7dab9a6668f793c3e /gnu/usr.bin/diff | |
| parent | 81c776a8e40880f27728682bf653ff4d15da1ef7 (diff) | |
Upgrade to GNU Diffutils 2.5.
No user visable changes, I just want to keep things in sync to make sure
that integrating future versions of diffutils will continue to be relatively
painless.
Diffstat (limited to 'gnu/usr.bin/diff')
| -rw-r--r-- | gnu/usr.bin/diff/analyze.c | 11 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/diff.c | 5 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/diff.h | 2 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/diff3.c | 14 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/getopt.c | 8 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/getopt1.c | 8 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/ifdef.c | 10 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/sdiff.c | 18 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/side.c | 4 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/system.h | 39 | ||||
| -rw-r--r-- | gnu/usr.bin/diff/version.c | 6 |
11 files changed, 79 insertions, 46 deletions
diff --git a/gnu/usr.bin/diff/analyze.c b/gnu/usr.bin/diff/analyze.c index a8ff2ceddc9..de7dad98e10 100644 --- a/gnu/usr.bin/diff/analyze.c +++ b/gnu/usr.bin/diff/analyze.c @@ -18,7 +18,7 @@ along with GNU DIFF; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef lint -static char *rcsid = "$Id: analyze.c,v 1.4 1993/09/16 17:39:02 jtc Exp $"; +static char *rcsid = "$Id: analyze.c,v 1.5 1993/09/29 21:37:02 jtc Exp $"; #endif /* The basic algorithm is described in: @@ -312,7 +312,7 @@ compareseq (xoff, xlim, yoff, ylim) When we discard a line, we also mark it as a deletion or insertion so that it will be printed in the output. */ -void +static void discard_confusing_lines (filevec) struct file_data filevec[]; { @@ -776,9 +776,10 @@ diff_2_files (filevec, depth) /* If the buffers differ, the files differ. */ if (filevec[0].buffered_chars != filevec[1].buffered_chars - || memcmp (filevec[0].buffer, - filevec[1].buffer, - filevec[0].buffered_chars) != 0) + || (filevec[0].buffered_chars != 0 + && memcmp (filevec[0].buffer, + filevec[1].buffer, + filevec[0].buffered_chars) != 0)) { changes = 1; break; diff --git a/gnu/usr.bin/diff/diff.c b/gnu/usr.bin/diff/diff.c index bf836e75bc2..d5e7f8c09be 100644 --- a/gnu/usr.bin/diff/diff.c +++ b/gnu/usr.bin/diff/diff.c @@ -18,7 +18,7 @@ along with GNU DIFF; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef lint -static char *rcsid = "$Id: diff.c,v 1.4 1993/09/16 17:39:07 jtc Exp $"; +static char *rcsid = "$Id: diff.c,v 1.5 1993/09/29 21:37:04 jtc Exp $"; #endif /* GNU DIFF was written by Mike Haertel, David Hayes, @@ -28,7 +28,6 @@ static char *rcsid = "$Id: diff.c,v 1.4 1993/09/16 17:39:07 jtc Exp $"; #include "diff.h" #include "getopt.h" #include "fnmatch.h" -#include "system.h" #ifndef DEFAULT_WIDTH #define DEFAULT_WIDTH 130 @@ -154,7 +153,7 @@ add_exclude_file (name) for (p = f.buffer, lim = p + f.buffered_chars; p < lim; p = q) { - q = memchr (p, '\n', lim - p); + q = (char *) memchr (p, '\n', lim - p); if (!q) q = lim; *q++ = 0; diff --git a/gnu/usr.bin/diff/diff.h b/gnu/usr.bin/diff/diff.h index 47da779df67..e75050f9bf6 100644 --- a/gnu/usr.bin/diff/diff.h +++ b/gnu/usr.bin/diff/diff.h @@ -17,9 +17,9 @@ 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 <ctype.h> #include <stdio.h> -#include "system.h" #include "regex.h" #ifndef PR_FILE_NAME diff --git a/gnu/usr.bin/diff/diff3.c b/gnu/usr.bin/diff/diff3.c index aef680ab1c3..fe27ef2f1cb 100644 --- a/gnu/usr.bin/diff/diff3.c +++ b/gnu/usr.bin/diff/diff3.c @@ -18,13 +18,13 @@ /* Written by Randy Smith */ #ifndef lint -static char *rcsid = "$Id: diff3.c,v 1.3 1993/09/16 17:39:10 jtc Exp $"; +static char *rcsid = "$Id: diff3.c,v 1.4 1993/09/29 21:37:07 jtc Exp $"; #endif +#include "system.h" #include <stdio.h> #include <ctype.h> #include "getopt.h" -#include "system.h" extern char const version_string[]; @@ -179,7 +179,7 @@ static int merge; static char *argv0; -VOID *xmalloc PARAMS((size_t)); +static VOID *xmalloc PARAMS((size_t)); static VOID *xrealloc PARAMS((VOID *, size_t)); static char *read_diff PARAMS((char const *, char const *, char **)); @@ -1032,9 +1032,9 @@ process_diff_control (string, db) #define SKIPWHITE(s) { while (*s == ' ' || *s == '\t') s++; } #define READNUM(s, num) \ - { if (!isdigit (*s)) return ERROR; holdnum = 0; \ - do { holdnum = (*s++ - '0' + holdnum * 10); } \ - while (isdigit (*s)); (num) = holdnum; } + { unsigned char c = *s; if (!isdigit (c)) return ERROR; holdnum = 0; \ + do { holdnum = (c - '0' + holdnum * 10); } \ + while (isdigit (c = *++s)); (num) = holdnum; } /* Read first set of digits */ SKIPWHITE (s); @@ -1658,7 +1658,7 @@ myread (fd, ptr, size) return result; } -VOID * +static VOID * xmalloc (size) size_t size; { diff --git a/gnu/usr.bin/diff/getopt.c b/gnu/usr.bin/diff/getopt.c index f26db9620ab..a51f2c55916 100644 --- a/gnu/usr.bin/diff/getopt.c +++ b/gnu/usr.bin/diff/getopt.c @@ -21,14 +21,18 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef lint -static char *rcsid = "$Id: getopt.c,v 1.4 1993/09/16 17:39:14 jtc Exp $"; +static char *rcsid = "$Id: getopt.c,v 1.5 1993/09/29 21:37:09 jtc Exp $"; #endif #ifdef HAVE_CONFIG_H +#if defined (emacs) || defined (CONFIG_BROKETS) /* We use <config.h> instead of "config.h" so that a compilation using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because getopt.c was found in $srcdir). */ + (which it would do because it found this file in $srcdir). */ #include <config.h> +#else +#include "config.h" +#endif #endif #ifndef __STDC__ diff --git a/gnu/usr.bin/diff/getopt1.c b/gnu/usr.bin/diff/getopt1.c index 9a1767c8b98..ac311630700 100644 --- a/gnu/usr.bin/diff/getopt1.c +++ b/gnu/usr.bin/diff/getopt1.c @@ -17,14 +17,18 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef lint -static char *rcsid = "$Id: getopt1.c,v 1.4 1993/09/16 17:39:15 jtc Exp $"; +static char *rcsid = "$Id: getopt1.c,v 1.5 1993/09/29 21:37:10 jtc Exp $"; #endif #ifdef HAVE_CONFIG_H +#if defined (emacs) || defined (CONFIG_BROKETS) /* We use <config.h> instead of "config.h" so that a compilation using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because getopt1.c was found in $srcdir). */ + (which it would do because it found this file in $srcdir). */ #include <config.h> +#else +#include "config.h" +#endif #endif #include "getopt.h" diff --git a/gnu/usr.bin/diff/ifdef.c b/gnu/usr.bin/diff/ifdef.c index 2ac1e4f926c..781e4528719 100644 --- a/gnu/usr.bin/diff/ifdef.c +++ b/gnu/usr.bin/diff/ifdef.c @@ -19,7 +19,7 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ #ifndef lint -static char *rcsid = "$Id: ifdef.c,v 1.4 1993/09/16 17:39:16 jtc Exp $"; +static char *rcsid = "$Id: ifdef.c,v 1.5 1993/09/29 21:37:11 jtc Exp $"; #endif #include "diff.h" @@ -144,17 +144,19 @@ format_group (out, format, endchar, groups) for (i = 0; i < 2; i++) { - if (isdigit (*f)) + unsigned char f0 = f[0]; + if (isdigit (f0)) { value[i] = atoi (f); - while (isdigit (*++f)) + while (isdigit ((unsigned char) *++f)) continue; } else { - value[i] = groups_letter_value (groups, *f++); + value[i] = groups_letter_value (groups, f0); if (value[i] < 0) goto bad_format; + f++; } if (*f++ != "=?"[i]) goto bad_format; diff --git a/gnu/usr.bin/diff/sdiff.c b/gnu/usr.bin/diff/sdiff.c index 008803ba9bc..70188a0d99b 100644 --- a/gnu/usr.bin/diff/sdiff.c +++ b/gnu/usr.bin/diff/sdiff.c @@ -18,14 +18,14 @@ along with GNU DIFF; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef lint -static char *rcsid = "$Id: sdiff.c,v 1.3 1993/09/16 17:39:28 jtc Exp $"; +static char *rcsid = "$Id: sdiff.c,v 1.4 1993/09/29 21:37:12 jtc Exp $"; #endif /* GNU SDIFF was written by Thomas Lord. */ +#include "system.h" #include <stdio.h> #include <ctype.h> -#include "system.h" #include <signal.h> #include "getopt.h" @@ -171,11 +171,11 @@ perror_fatal (msg) /* malloc freely or DIE! */ -VOID * +static VOID * xmalloc (size) size_t size; { - VOID *r = malloc (size); + VOID *r = (VOID *) malloc (size); if (!r) fatal ("virtual memory exhausted"); return r; @@ -244,11 +244,11 @@ ck_fflush (f) #if !HAVE_MEMCHR char * memchr (s, c, n) - char *s; + char const *s; int c; size_t n; { - unsigned char *p = (unsigned char *) s, *lim = p + n; + unsigned char const *p = (unsigned char const *) s, *lim = p + n; for (; p < lim; p++) if (*p == c) return (char *) p; @@ -354,7 +354,7 @@ lf_copy (lf, lines, outfile) while (lines) { - lf->bufpos = memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); + lf->bufpos = (char *) memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); if (! lf->bufpos) { ck_fwrite (start, lf->buflim - start, outfile); @@ -380,7 +380,7 @@ lf_skip (lf, lines) { while (lines) { - lf->bufpos = memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); + lf->bufpos = (char *) memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); if (! lf->bufpos) { if (! lf_refill (lf)) @@ -405,7 +405,7 @@ lf_snarf (lf, buffer, bufsize) for (;;) { - char *next = memchr (start, '\n', lf->buflim + 1 - start); + char *next = (char *) memchr (start, '\n', lf->buflim + 1 - start); size_t s = next - start; if (bufsize <= s) return 0; diff --git a/gnu/usr.bin/diff/side.c b/gnu/usr.bin/diff/side.c index ce695dafe6b..2d3abc00dca 100644 --- a/gnu/usr.bin/diff/side.c +++ b/gnu/usr.bin/diff/side.c @@ -19,7 +19,7 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ #ifndef lint -static char *rcsid = "$Id: side.c,v 1.3 1993/09/16 17:39:29 jtc Exp $"; +static char *rcsid = "$Id: side.c,v 1.4 1993/09/29 21:37:13 jtc Exp $"; #endif #include "diff.h" @@ -142,7 +142,7 @@ print_half_line (line, indent, out_bound) break; default: - if (! isgraph (c)) + if (! isprint (c)) goto control_char; /* falls through */ case ' ': diff --git a/gnu/usr.bin/diff/system.h b/gnu/usr.bin/diff/system.h index 4b9d6bceea2..f58fb8b4c9b 100644 --- a/gnu/usr.bin/diff/system.h +++ b/gnu/usr.bin/diff/system.h @@ -17,7 +17,15 @@ 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. */ +#if !__STDC__ +#ifndef volatile +#define volatile +#endif +#endif #include <config.h> + #include <sys/types.h> #include <sys/stat.h> @@ -29,12 +37,32 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define VOID char #endif +#if STAT_MACROS_BROKEN +#undef S_ISBLK +#undef S_ISCHR +#undef S_ISDIR +#undef S_ISFIFO +#undef S_ISREG +#undef S_ISSOCK +#endif #ifndef S_ISDIR #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif #ifndef S_ISREG #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) #endif +#if !defined(S_ISBLK) && defined(S_IFBLK) +#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#endif +#if !defined(S_ISCHR) && defined(S_IFCHR) +#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#endif +#if !defined(S_ISFIFO) && defined(S_IFFIFO) +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO) +#endif +#if !defined(S_ISSOCK) && defined(S_IFSOCK) +#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) +#endif #ifndef S_IXOTH #define S_IXOTH 1 @@ -137,10 +165,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #if HAVE_STDLIB_H #include <stdlib.h> #else -char *getenv (); VOID *malloc (); VOID *realloc (); #endif +#ifndef getenv +char *getenv (); +#endif #if HAVE_LIMITS_H #include <limits.h> @@ -172,7 +202,6 @@ VOID *realloc (); #define memcmp(s1,s2,n) bcmp (s1,s2,n) #endif #endif /* !HAVE_STRING_H */ - #if !HAVE_MEMCHR char *memchr (); #endif @@ -182,11 +211,5 @@ char *memchr (); extern int errno; #endif -#if !__STDC__ -#ifndef volatile -#define volatile -#endif -#endif - #define min(a,b) ((a) <= (b) ? (a) : (b)) #define max(a,b) ((a) >= (b) ? (a) : (b)) diff --git a/gnu/usr.bin/diff/version.c b/gnu/usr.bin/diff/version.c index 140e87678d8..b10e240d4f7 100644 --- a/gnu/usr.bin/diff/version.c +++ b/gnu/usr.bin/diff/version.c @@ -1,7 +1,7 @@ /* Version number of GNU diff. - * $Id: version.c,v 1.5 1993/09/16 17:39:32 jtc Exp $ + * $Id: version.c,v 1.6 1993/09/29 21:37:15 jtc Exp $ */ -#include <config.h> +#include "config.h" -char const version_string[] = "2.4"; +char const version_string[] = "2.5"; |
