CVS commit: othersrc/external/bsd/netdiff/dist

2015-09-07 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Mon Sep  7 22:39:54 UTC 2015

Modified Files:
othersrc/external/bsd/netdiff/dist: diffreg.c

Log Message:
fgetpos(3) and fsetpos(3) may work on opaque types, so don't rely on
being able to set individual fields in the fpos_t struct. Instead, just
use the and ftell(3) and fseek(3) components.

Also define __UNCONST() if it's not already been defined. Just in case.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 othersrc/external/bsd/netdiff/dist/diffreg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.11 othersrc/external/bsd/netdiff/dist/diffreg.c:1.12
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.11	Wed Jan 16 01:50:19 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Mon Sep  7 22:39:54 2015
@@ -120,6 +120,10 @@ __FBSDID("$FreeBSD$");
 #define USE_ARG(x)		/*LINTED*/(void)&(x)
 #endif
 
+#ifndef __UNCONST
+#define __UNCONST(a)		((void *)(unsigned long)(const void *)(a))
+#endif
+
 #ifdef ST_MTIM_NSEC
 # define TIMESPEC_NS(timespec) ((timespec).ST_MTIM_NSEC)
 #else
@@ -398,28 +402,6 @@ diff_getc(diff_t *diff, file_t *f)
 	return DIFF_GET_FLAG(diff, 'i') ? tolower(ch) : ch;
 }
 
-static int
-diff_fgetpos(file_t *f, fpos_t *pos)
-{
-	if (f->mapped) {
-		pos->_pos = f->curpos;
-		return 0;
-	} else {
-		return fgetpos(f->fp, pos);
-	}
-}
-
-static int
-diff_fsetpos(file_t *f, const fpos_t *pos)
-{
-	if (f->mapped) {
-		f->curpos = pos->_pos;
-		return 0;
-	} else {
-		return fsetpos(f->fp, pos);
-	}
-}
-
 /*
  * Check to see if the given files differ.
  * Returns 0 if they are the same, 1 if different, and -1 on error.
@@ -771,7 +753,7 @@ check(diff_t *diff, stone_t *s, file_t *
 {
 	int	i, j, jackpot, c, d, spacecount;
 	int64_t	ct[2];
-	fpos_t position;
+	off_t	position;
 		
 	diff_fseek([0], 0, SEEK_SET);
 	diff_fseek([1], 0, SEEK_SET);
@@ -850,14 +832,14 @@ check(diff_t *diff, stone_t *s, file_t *
 			 * Checks if file1 has 8 consecutive spaces, which is 
 			 * equal to 1 tab.
 			 */
-			diff_fgetpos([0], );
+			position = diff_ftell([0]);
 			for (spacecount = 1; spacecount <= 8; spacecount++) {
 c = diff_getc(diff, [0]);
 if (c != ' ') {
 	break;
 }
 			}
-			diff_fsetpos([0], );
+			diff_fseek([0], position, SEEK_SET);
 			while (c == ' ' && spacecount == 9) {
 c = diff_getc(diff, [0]);
 ct[0]++;
@@ -868,14 +850,14 @@ check(diff_t *diff, stone_t *s, file_t *
 			 * Checks if file2 has 8 consecutive spaces, which is 
 			 * equal to 1 tab.
 			 */
-			diff_fgetpos([1], );
+			position = diff_ftell([1]);
 			for (spacecount = 1; spacecount <= 8; spacecount++) {
 d = diff_getc(diff, [1]);
 if (d != ' ') {
 	break;
 }
 			}
-			diff_fsetpos([1], );
+			diff_fseek([1], position, SEEK_SET);
 			while (d == ' ' && spacecount == 9) {
 d = diff_getc(diff, [1]);
 ct[1]++;



CVS commit: othersrc/external/bsd/netdiff/dist

2014-09-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Sep 18 01:47:13 UTC 2014

Modified Files:
othersrc/external/bsd/netdiff/dist: diff.c mem.c qdiff.c

Log Message:
fixes for WARNS=5 with gcc-4.8

Mainly variable set but not used errors


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/netdiff/dist/diff.c
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/mem.c
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/netdiff/dist/qdiff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/diff.c
diff -u othersrc/external/bsd/netdiff/dist/diff.c:1.5 othersrc/external/bsd/netdiff/dist/diff.c:1.6
--- othersrc/external/bsd/netdiff/dist/diff.c:1.5	Wed Jan 16 01:50:19 2013
+++ othersrc/external/bsd/netdiff/dist/diff.c	Thu Sep 18 01:47:13 2014
@@ -340,7 +340,6 @@ main(int argc, char **argv)
 {
 	diff_t		  diff;
 	char		**oargv;
-	char		 *line_format, *group_format;
 	char		 *prog;
 	int		  ch, lastch, prevoptind, newarg;
 	int		  oargc;
@@ -455,7 +454,6 @@ main(int argc, char **argv)
 		case OPT_UNCHGD_GF:
 			/* XXX To do: Complete --GTYPE-group-format. */
 			diff.format = D_GF;
-			group_format = optarg;
 			break;
 		case OPT_NEW_LF:
 		case OPT_OLD_LF:
@@ -463,7 +461,6 @@ main(int argc, char **argv)
 		case OPT_LF:
 			/* XXX To do: Complete --line-format. */
 			diff.format = D_LF;
-			line_format = optarg;
 			break;
 		case OPT_NORMAL:
 			diff.format = D_NORMAL;

Index: othersrc/external/bsd/netdiff/dist/mem.c
diff -u othersrc/external/bsd/netdiff/dist/mem.c:1.2 othersrc/external/bsd/netdiff/dist/mem.c:1.3
--- othersrc/external/bsd/netdiff/dist/mem.c:1.2	Wed Jan 16 01:50:19 2013
+++ othersrc/external/bsd/netdiff/dist/mem.c	Thu Sep 18 01:47:13 2014
@@ -279,6 +279,7 @@ read_excludes_file(diff_t *diff, char *f
 	char	*buf, *pattern;
 	size_t	 len;
 
+	pattern = NULL;
 	if (strcmp(file, -) == 0) {
 		fp = stdin;
 	} else if ((fp = fopen(file, r)) == NULL) {
@@ -380,7 +381,6 @@ main(int argc, char **argv)
 {
 	diff_t		 diff;
 	char		**oargv;
-	char		 *line_format, *group_format;
 	char		 *prog;
 	int		  ch, lastch, prevoptind, newarg;
 	int		  oargc;
@@ -495,7 +495,6 @@ main(int argc, char **argv)
 		case OPT_UNCHGD_GF:
 			/* XXX To do: Complete --GTYPE-group-format. */
 			diff.format = D_GF;
-			group_format = optarg;
 			break;
 		case OPT_NEW_LF:
 		case OPT_OLD_LF:
@@ -503,7 +502,6 @@ main(int argc, char **argv)
 		case OPT_LF:
 			/* XXX To do: Complete --line-format. */
 			diff.format = D_LF;
-			line_format = optarg;
 			break;
 		case OPT_NORMAL:
 			diff.format = D_NORMAL;

Index: othersrc/external/bsd/netdiff/dist/qdiff.c
diff -u othersrc/external/bsd/netdiff/dist/qdiff.c:1.3 othersrc/external/bsd/netdiff/dist/qdiff.c:1.4
--- othersrc/external/bsd/netdiff/dist/qdiff.c:1.3	Wed Jan 16 01:50:20 2013
+++ othersrc/external/bsd/netdiff/dist/qdiff.c	Thu Sep 18 01:47:13 2014
@@ -278,18 +278,21 @@ read_excludes_file(diff_t *diff, char *f
 	char	*buf, *pattern;
 	size_t	 len;
 
-	if (strcmp(file, -) == 0)
+	pattern = NULL;
+	if (strcmp(file, -) == 0) {
 		fp = stdin;
-	else if ((fp = fopen(file, r)) == NULL)
+	} else if ((fp = fopen(file, r)) == NULL) {
 		err(2, %s, file);
+	}
 	while ((buf = fgetln(fp, len)) != NULL) {
 		if (buf[len - 1] == '\n') {
 			len--;
 		}
 		push_excludes(diff, pattern, len);
 	}
-	if (strcmp(file, -) != 0)
+	if (strcmp(file, -) != 0) {
 		fclose(fp);
+	}
 }
 
 static int
@@ -334,8 +337,6 @@ main(int argc, char **argv)
 {
 	diff_t		  diff;
 	size_t		  cc;
-	char		 *line_format;
-	char		 *group_format;
 	char		**oargv;
 	char		 *prog;
 	char		 *s;
@@ -449,7 +450,6 @@ main(int argc, char **argv)
 		case OPT_UNCHGD_GF:
 			/* XXX To do: Complete --GTYPE-group-format. */
 			diff.format = D_GF;
-			group_format = optarg;
 			break;
 		case OPT_NEW_LF:
 		case OPT_OLD_LF:
@@ -457,7 +457,6 @@ main(int argc, char **argv)
 		case OPT_LF:
 			/* XXX To do: Complete --line-format. */
 			diff.format = D_LF;
-			line_format = optarg;
 			break;
 		case OPT_NORMAL:
 			diff.format = D_NORMAL;



CVS commit: othersrc/external/bsd/netdiff/dist

2014-09-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Sep 18 02:35:32 UTC 2014

Modified Files:
othersrc/external/bsd/netdiff/dist: mem.c qdiff.c

Log Message:
use the correct variable to push a file to exclude onto the stack.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/netdiff/dist/mem.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/qdiff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/mem.c
diff -u othersrc/external/bsd/netdiff/dist/mem.c:1.3 othersrc/external/bsd/netdiff/dist/mem.c:1.4
--- othersrc/external/bsd/netdiff/dist/mem.c:1.3	Thu Sep 18 01:47:13 2014
+++ othersrc/external/bsd/netdiff/dist/mem.c	Thu Sep 18 02:35:32 2014
@@ -276,10 +276,9 @@ static int
 read_excludes_file(diff_t *diff, char *file)
 {
 	FILE	*fp;
-	char	*buf, *pattern;
+	char	*buf;
 	size_t	 len;
 
-	pattern = NULL;
 	if (strcmp(file, -) == 0) {
 		fp = stdin;
 	} else if ((fp = fopen(file, r)) == NULL) {
@@ -290,7 +289,7 @@ read_excludes_file(diff_t *diff, char *f
 		if (buf[len - 1] == '\n') {
 			len--;
 		}
-		if (!push_excludes(diff, pattern, len)) {
+		if (!push_excludes(diff, buf, len)) {
 			return 0;
 		}
 	}

Index: othersrc/external/bsd/netdiff/dist/qdiff.c
diff -u othersrc/external/bsd/netdiff/dist/qdiff.c:1.4 othersrc/external/bsd/netdiff/dist/qdiff.c:1.5
--- othersrc/external/bsd/netdiff/dist/qdiff.c:1.4	Thu Sep 18 01:47:13 2014
+++ othersrc/external/bsd/netdiff/dist/qdiff.c	Thu Sep 18 02:35:32 2014
@@ -275,10 +275,9 @@ static void
 read_excludes_file(diff_t *diff, char *file)
 {
 	FILE	*fp;
-	char	*buf, *pattern;
+	char	*buf;
 	size_t	 len;
 
-	pattern = NULL;
 	if (strcmp(file, -) == 0) {
 		fp = stdin;
 	} else if ((fp = fopen(file, r)) == NULL) {
@@ -288,7 +287,7 @@ read_excludes_file(diff_t *diff, char *f
 		if (buf[len - 1] == '\n') {
 			len--;
 		}
-		push_excludes(diff, pattern, len);
+		push_excludes(diff, buf, len);
 	}
 	if (strcmp(file, -) != 0) {
 		fclose(fp);



CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-15 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Tue Jan 15 09:05:57 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: netwdiff.1

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/netwdiff.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/netwdiff.1
diff -u othersrc/external/bsd/netdiff/dist/netwdiff.1:1.4 othersrc/external/bsd/netdiff/dist/netwdiff.1:1.5
--- othersrc/external/bsd/netdiff/dist/netwdiff.1:1.4	Tue Jan 15 08:26:16 2013
+++ othersrc/external/bsd/netdiff/dist/netwdiff.1	Tue Jan 15 09:05:57 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: netwdiff.1,v 1.4 2013/01/15 08:26:16 agc Exp $
+.\ $NetBSD: netwdiff.1,v 1.5 2013/01/15 09:05:57 wiz Exp $
 .\
 .\ Copyright (c) 2013 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -130,7 +130,7 @@ static int
 .Ed
 .Pp
 To use colors to highlight text which has been inserted and deleted,
-the 
+the
 .Fl w ,
 .Fl x ,
 .Fl y
@@ -139,7 +139,7 @@ and
 arguments can be used.
 In C shell, shell variables can be set in the following way:
 .Bd -literal
-% set ansi_red = `printf '\\e[31m'`   
+% set ansi_red = `printf '\\e[31m'`
 % set ansi_end = `printf '\\e[0m'`
 % set ansi_green = `printf '\\e[32m'`
 .Ed



CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-15 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jan 15 15:54:53 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: diffreg.c netdiff.1

Log Message:
Remove support for -l option which piped output through pr(1). Not really
useful in 2013, and gets rid of a fork()/exec() in a library function.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/netdiff.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.9 othersrc/external/bsd/netdiff/dist/diffreg.c:1.10
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.9	Tue Jan 15 08:26:16 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Tue Jan 15 15:54:52 2013
@@ -100,7 +100,6 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/stat.h
 #include sys/mman.h
-#include sys/wait.h
 
 #include ctype.h
 #include err.h
@@ -1772,12 +1771,10 @@ istextfile(diff_t *diff, file_t *f)
 
 /* common function to perform the diff, and display output */
 static int
-diffit(diff_t *diff, file_t *f, stone_t *s, int flags, int allow_pr)
+diffit(diff_t *diff, file_t *f, stone_t *s, int flags)
 {
 	size_t	 sz;
-	pid_t	 pid = -1;
 	int	 rval = D_SAME;
-	int	 ostdout = -1;
 	int	 i;
 
 	switch (files_differ(diff, f, flags)) {
@@ -1795,49 +1792,6 @@ diffit(diff_t *diff, file_t *f, stone_t 
 		diff-status |= 1;
 		goto closem;
 	}
-	if (allow_pr  DIFF_GET_FLAG(diff, 'l')) {
-		/* redirect stdout to pr */
-		int	 pfd[2];
-		char	*header;
-		const char	*prargv[] = { pr, -h, NULL, -f, NULL };
-
-		if (asprintf(header, %s %s %s, diff-diffargs, f[0].name, f[1].name)  0) {
-			warn(diffargs header %s, header);
-			diff-status |= 2;
-			goto closem;
-		}
-		prargv[2] = header;
-		fflush(stdout);
-		rewind(stdout);
-		pipe(pfd);
-		switch ((pid = fork())) {
-		case -1:
-			warnx(No more processes);
-			diff-status |= 2;
-			free(header);
-			return D_ERROR;
-		case 0:
-			/* child */
-			if (pfd[0] != STDIN_FILENO) {
-dup2(pfd[0], STDIN_FILENO);
-close(pfd[0]);
-			}
-			close(pfd[1]);
-			execv(_PATH_PR, __UNCONST(prargv));
-			_exit(127);
-			/*FALLTHROUGH*/
-		default:
-			/* parent */
-			if (pfd[1] != STDOUT_FILENO) {
-ostdout = dup(STDOUT_FILENO);
-dup2(pfd[1], STDOUT_FILENO);
-close(pfd[1]);
-			}
-			close(pfd[0]);
-			rewind(stdout);
-			free(header);
-		}
-	}
 	prepare(diff, f[0], diff-st[0].st_size);
 	prepare(diff, f[1], diff-st[1].st_size);
 	prune(s, f);
@@ -1897,19 +1851,6 @@ diffit(diff_t *diff, file_t *f, stone_t 
 	output(diff, s, f, (flags  D_HEADER));
 	free(f[0].offsets);
 	free(f[1].offsets);
-	if (ostdout != -1) {
-		int wstatus;
-
-		/* close the pipe to pr and restore stdout */
-		fflush(stdout);
-		rewind(stdout);
-		if (ostdout != STDOUT_FILENO) {
-			close(STDOUT_FILENO);
-			dup2(ostdout, STDOUT_FILENO);
-			close(ostdout);
-		}
-		waitpid(pid, wstatus, 0);
-	}
 closem:
 	if (s-changec) {
 		diff-status |= 1;
@@ -2229,7 +2170,7 @@ diff_file(diff_t *diff, const char *ofil
 		diff-status |= 2;
 		return D_MISMATCH1;
 	}
-	return diffit(diff, f, s, flags, 1);
+	return diffit(diff, f, s, flags);
 }
 
 /* compare two areas of memory */
@@ -2263,7 +2204,7 @@ diff_mem(diff_t *diff, const char *m1, s
 	s.context_vec_ptr = s.context_vec_start - 1;
 	setupmem(f[0], diff-st[0], m1, size1);
 	setupmem(f[1], diff-st[1], m2, size2);
-	return diffit(diff, f, s, flags, 0);
+	return diffit(diff, f, s, flags);
 }
 
 /* word diff two files */

Index: othersrc/external/bsd/netdiff/dist/netdiff.1
diff -u othersrc/external/bsd/netdiff/dist/netdiff.1:1.2 othersrc/external/bsd/netdiff/dist/netdiff.1:1.3
--- othersrc/external/bsd/netdiff/dist/netdiff.1:1.2	Thu Jan 10 08:51:28 2013
+++ othersrc/external/bsd/netdiff/dist/netdiff.1	Tue Jan 15 15:54:52 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: netdiff.1,v 1.2 2013/01/10 08:51:28 wiz Exp $
+.\	$NetBSD: netdiff.1,v 1.3 2013/01/15 15:54:52 agc Exp $
 .\	$FreeBSD$
 .\	$OpenBSD: diff.1,v 1.33 2007/05/31 19:20:09 jmc Exp $
 .\
@@ -31,7 +31,7 @@
 .\
 .\ @(#)diff.1	8.1 (Berkeley) 6/30/93
 .\
-.Dd April 7, 2008
+.Dd January 15, 2013
 .Dt DIFF 1
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Nd differential file and directory comparator
 .Sh SYNOPSIS
 .Nm diff
-.Op Fl abdilpqTtw
+.Op Fl abdipqTtw
 .Op Fl I Ar pattern
 .Oo
 .Fl c | e | f |
@@ -228,14 +228,6 @@ Print
 .Ar label
 instead of the first (and second, if this option is specified twice)
 file name and time in the context or unified diff header.
-.It Fl l , Fl Fl paginate
-Long output format; each text file
-.Nm diff Ns \'d
-is piped through
-.Xr pr 1
-to paginate it;
-other differences are remembered and summarized
-after all text file differences are reported.
 .It Fl p , Fl Fl show-c-function
 With unified and context diffs, show with each change
 the 

CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-15 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Jan 16 01:50:20 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: cmp.c diff.c diff_subr.c diffdir.c
diffreg.c mem.c netdiff.h netwdiff.c qdiff.c

Log Message:
Perform error message reporting differently, using an error buffer in
the diff_t structure.

Don't violate abstractions by accessing the status field in the
structure directly, use an accessor function to get the exit status
from the struct.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/cmp.c \
othersrc/external/bsd/netdiff/dist/diffdir.c \
othersrc/external/bsd/netdiff/dist/qdiff.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/diff.c
cvs rdiff -u -r1.7 -r1.8 othersrc/external/bsd/netdiff/dist/diff_subr.c
cvs rdiff -u -r1.10 -r1.11 othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/netdiff/dist/mem.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/netdiff/dist/netdiff.h
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/netdiff/dist/netwdiff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/cmp.c
diff -u othersrc/external/bsd/netdiff/dist/cmp.c:1.2 othersrc/external/bsd/netdiff/dist/cmp.c:1.3
--- othersrc/external/bsd/netdiff/dist/cmp.c:1.2	Tue Jan 15 01:57:56 2013
+++ othersrc/external/bsd/netdiff/dist/cmp.c	Wed Jan 16 01:50:19 2013
@@ -55,5 +55,5 @@ main(int argc, char **argv)
 	if (diff_get_diffs(diff, s, cc)) {
 		printf(%.*s, (int)cc, s);
 	}
-	exit(diff.status);
+	exit(diff_get_var(diff, (int)status, NULL, 0));
 }
Index: othersrc/external/bsd/netdiff/dist/diffdir.c
diff -u othersrc/external/bsd/netdiff/dist/diffdir.c:1.2 othersrc/external/bsd/netdiff/dist/diffdir.c:1.3
--- othersrc/external/bsd/netdiff/dist/diffdir.c:1.2	Fri Jan 11 05:19:46 2013
+++ othersrc/external/bsd/netdiff/dist/diffdir.c	Wed Jan 16 01:50:19 2013
@@ -59,7 +59,6 @@ __FBSDID($FreeBSD$);
 #include sys/stat.h
 
 #include dirent.h
-#include err.h
 #include errno.h
 #include fcntl.h
 #include fnmatch.h
@@ -133,7 +132,7 @@ slurpdir(diff_t *diff, char *path, size_
 
 	USE_ARG(enoentok);
 	if ((dirp = opendir(path)) == NULL) {
-		warn(can't open directory '%s', path);
+		snprintf(diff-errbuf, sizeof(diff-errbuf), can't open directory '%s' (%s), path, strerror(errno));
 		return NULL;
 	}
 	dv = NULL;
@@ -165,7 +164,7 @@ diffit(diff_t *diff, struct dirent *dp, 
 	strlcpy(path1 + plen1, dp-d_name, MAXPATHLEN - plen1);
 	if (stat(path1, diff-st[0]) != 0) {
 		if (!(DIFF_GET_FLAG(diff, 'N') || DIFF_GET_FLAG(diff, 'P')) || errno != ENOENT) {
-			warn(%s, path1);
+			snprintf(diff-errbuf, sizeof(diff-errbuf), %s (%s), path1, strerror(errno));
 			return 0;
 		}
 		flags |= D_EMPTY1;
@@ -175,7 +174,7 @@ diffit(diff_t *diff, struct dirent *dp, 
 	strlcpy(path2 + plen2, dp-d_name, MAXPATHLEN - plen2);
 	if (stat(path2, diff-st[1]) != 0) {
 		if (!DIFF_GET_FLAG(diff, 'N') || errno != ENOENT) {
-			warn(%s, path2);
+			snprintf(diff-errbuf, sizeof(diff-errbuf), %s (%s), path2, strerror(errno));
 			return 0;
 		}
 		flags |= D_EMPTY2;
@@ -239,7 +238,7 @@ diff_dir(diff_t *diff, char *p1, char *p
 	}
 	dirlen1 = strlcpy(path1, *p1 ? p1 : ., sizeof(path1));
 	if (dirlen1 = sizeof(path1) - 1) {
-		warnx(%s: %s, p1, strerror(ENAMETOOLONG));
+		snprintf(diff-errbuf, sizeof(diff-errbuf), %s: %s, p1, strerror(ENAMETOOLONG));
 		diff-status = 2;
 		return 0;
 	}
@@ -249,7 +248,7 @@ diff_dir(diff_t *diff, char *p1, char *p
 	}
 	dirlen2 = strlcpy(path2, *p2 ? p2 : ., sizeof(path2));
 	if (dirlen2 = sizeof(path2) - 1) {
-		warnx(%s: %s, p2, strerror(ENAMETOOLONG));
+		snprintf(diff-errbuf, sizeof(diff-errbuf), %s: %s, p2, strerror(ENAMETOOLONG));
 		diff-status = 2;
 		return 0;
 	}
Index: othersrc/external/bsd/netdiff/dist/qdiff.c
diff -u othersrc/external/bsd/netdiff/dist/qdiff.c:1.2 othersrc/external/bsd/netdiff/dist/qdiff.c:1.3
--- othersrc/external/bsd/netdiff/dist/qdiff.c:1.2	Sat Jan 12 01:31:21 2013
+++ othersrc/external/bsd/netdiff/dist/qdiff.c	Wed Jan 16 01:50:20 2013
@@ -526,5 +526,5 @@ main(int argc, char **argv)
 		fprintf(stdout, %.*s, (int)cc, s);
 	}
 	diff_fini(diff);
-	exit(diff.status);
+	exit(diff_get_var(diff, (int)status, NULL, 0));
 }

Index: othersrc/external/bsd/netdiff/dist/diff.c
diff -u othersrc/external/bsd/netdiff/dist/diff.c:1.4 othersrc/external/bsd/netdiff/dist/diff.c:1.5
--- othersrc/external/bsd/netdiff/dist/diff.c:1.4	Sun Jan 13 22:17:22 2013
+++ othersrc/external/bsd/netdiff/dist/diff.c	Wed Jan 16 01:50:19 2013
@@ -528,5 +528,5 @@ main(int argc, char **argv)
 	set_argstr(diff, oargv, argv);
 	difference(diff, argv[0], argv[1]);
 	diff_fini(diff);
-	exit(diff.status);
+	exit(diff_get_var(diff, (int)status, NULL, 0));
 }

Index: othersrc/external/bsd/netdiff/dist/diff_subr.c
diff -u othersrc/external/bsd/netdiff/dist/diff_subr.c:1.7 

CVS commit: othersrc/external/bsd/netdiff

2013-01-14 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jan 15 01:46:04 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/bin: Makefile
othersrc/external/bsd/netdiff/dist: diff_subr.c diffreg.c netdiff.h
netwdiff.1 netwdiff.c

Log Message:
Add support to netwdiff to specify the insert and delete region
character sequences from the command line via the -w, -x, -y and -z
args. The default is, as before, [- ... -] for deleted regions,
and {+ ... +} for inserted text.

With this in place, the arguments can be used to highlight word diffs
portably across shells:

csh/tcsh:
% set ansi_red = `printf '\e[31m'`
% set ansi_end = `printf '\e[0m'`
% set ansi_green = `printf '\e[32m'`

sh/ksh/bash/zsh:
$ ansi_red=$(printf '\e[31m')
$ ansi_end=$(printf '\e[0m')
$ ansi_green=$(printf '\e[32m')

and then in all shells:

netwdiff -w $ansi_red -x $ansi_end -y $ansi_green -z $ansi_end f1 f2

-- this will highlight deleted words in red, and added words in green,
on standard ANSI terminals.  This gets around bash's twee $'' idiom
for tputs sequences.  Thanks to Christos Zoulas for setting me
straight on this, and thanks also to Alan Barrett for the nudge to
implement the region arguments.

Thanks to all of the people who pointed me to comm(1)'s arguments as
being the model for wdiff's inhibit.  My apologies, I should have
thought of that.  I'm still trying to work out the model for the
choice of -w/-x/-y/-z; all suggestions gratefully received.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/netdiff/bin/Makefile
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/netdiff/dist/diff_subr.c
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/netdiff/dist/netdiff.h
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/netwdiff.1
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/netdiff/dist/netwdiff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/bin/Makefile
diff -u othersrc/external/bsd/netdiff/bin/Makefile:1.3 othersrc/external/bsd/netdiff/bin/Makefile:1.4
--- othersrc/external/bsd/netdiff/bin/Makefile:1.3	Sun Jan 13 22:17:21 2013
+++ othersrc/external/bsd/netdiff/bin/Makefile	Tue Jan 15 01:46:03 2013
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2013/01/13 22:17:21 agc Exp $
+# $NetBSD: Makefile,v 1.4 2013/01/15 01:46:03 agc Exp $
 
 SUBDIR=		netdiff
-SUBDIR=		wdiff
+SUBDIR+=	wdiff
+SUBDIR+=	cmp
 .if !make(install)
 SUBDIR+=	memdiff
 SUBDIR+=	qdiff
@@ -14,3 +15,4 @@ t:
 	cd qdiff  ${MAKE} t
 	cd memdiff  ${MAKE} t
 	cd wdiff  ${MAKE} t
+	cd cmp  ${MAKE} t

Index: othersrc/external/bsd/netdiff/dist/diff_subr.c
diff -u othersrc/external/bsd/netdiff/dist/diff_subr.c:1.5 othersrc/external/bsd/netdiff/dist/diff_subr.c:1.6
--- othersrc/external/bsd/netdiff/dist/diff_subr.c:1.5	Sun Jan 13 22:17:22 2013
+++ othersrc/external/bsd/netdiff/dist/diff_subr.c	Tue Jan 15 01:46:03 2013
@@ -350,7 +350,23 @@ diff_set_var(diff_t *diff, const char *k
 			return 1;
 		}
 	}
-	return 1;
+	if (strcasecmp(key, start-delete) == 0  value != NULL) {
+		asprintf(diff-deleteregion[0], %s, value);
+		return 1;
+	}
+	if (strcasecmp(key, end-delete) == 0  value != NULL) {
+		asprintf(diff-deleteregion[1], %s, value);
+		return 1;
+	}
+	if (strcasecmp(key, start-insert) == 0  value != NULL) {
+		asprintf(diff-insertregion[0], %s, value);
+		return 1;
+	}
+	if (strcasecmp(key, end-insert) == 0  value != NULL) {
+		asprintf(diff-insertregion[1], %s, value);
+		return 1;
+	}
+	return 0;
 }
 
 /* finished with structure, clean up */
@@ -384,6 +400,14 @@ diff_fini(diff_t *diff)
 			}
 			free(diff-excludes);
 		}
+		for (i = 0 ; i  2 ; i++) {
+			if (diff-insertregion[i]) {
+free(diff-insertregion[i]);
+			}
+			if (diff-deleteregion[i]) {
+free(diff-deleteregion[i]);
+			}
+		}
 	}
 	return 1;
 }

Index: othersrc/external/bsd/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.6 othersrc/external/bsd/netdiff/dist/diffreg.c:1.7
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.6	Mon Jan 14 05:20:40 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Tue Jan 15 01:46:03 2013
@@ -360,9 +360,9 @@ diff_fread(diff_t *diff, void *ptr, size
 	char	*p;
 
 	if (f-mapped) {
-		memcpy(ptr, f-mapped[f-curpos], c * size);
-		f-curpos += (c * size);
-		cc = c;
+		cc = MIN(c * size, (size_t)(f-size - (size_t)f-curpos));
+		memcpy(ptr, f-mapped[f-curpos], cc);
+		f-curpos += cc;
 	} else {
 		cc = fread(ptr, size, c, f-fp);
 	}
@@ -1492,19 +1492,6 @@ bdiff_encode_copy(diff_t *diff, int32_t 
 	return 1;
 }
 
-#if 0
-static int
-bdiff_encode_run(diff_t *diff, uint8_t ch, int32_t size)
-{
-	char	c = 'r';
-
-	diff_write(diff, c, 1);
-	diff_write(diff, ch, 1);
-	diff_write(diff, size, sizeof(size));
-	return 1;
-}

CVS commit: othersrc/external/bsd/netdiff

2013-01-14 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jan 15 01:49:23 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/bin: Makefile
Added Files:
othersrc/external/bsd/netdiff/bin/cmp: Makefile f1 f2
othersrc/external/bsd/netdiff/dist: cmp.c

Log Message:
Add rudimentary support for cmp(1) in the shape of netcmp(1). More to come
on this one, too.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/bin/Makefile
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/netdiff/bin/cmp/Makefile \
othersrc/external/bsd/netdiff/bin/cmp/f1 \
othersrc/external/bsd/netdiff/bin/cmp/f2
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/netdiff/dist/cmp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/bin/Makefile
diff -u othersrc/external/bsd/netdiff/bin/Makefile:1.4 othersrc/external/bsd/netdiff/bin/Makefile:1.5
--- othersrc/external/bsd/netdiff/bin/Makefile:1.4	Tue Jan 15 01:46:03 2013
+++ othersrc/external/bsd/netdiff/bin/Makefile	Tue Jan 15 01:49:23 2013
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.4 2013/01/15 01:46:03 agc Exp $
+# $NetBSD: Makefile,v 1.5 2013/01/15 01:49:23 agc Exp $
 
 SUBDIR=		netdiff
 SUBDIR+=	wdiff
-SUBDIR+=	cmp
 .if !make(install)
+SUBDIR+=	cmp
 SUBDIR+=	memdiff
 SUBDIR+=	qdiff
 .endif

Added files:

Index: othersrc/external/bsd/netdiff/bin/cmp/Makefile
diff -u /dev/null othersrc/external/bsd/netdiff/bin/cmp/Makefile:1.1
--- /dev/null	Tue Jan 15 01:49:23 2013
+++ othersrc/external/bsd/netdiff/bin/cmp/Makefile	Tue Jan 15 01:49:23 2013
@@ -0,0 +1,36 @@
+# $NetBSD: Makefile,v 1.1 2013/01/15 01:49:23 agc Exp $
+
+.include bsd.own.mk
+
+PROG=netcmp
+SRCS=cmp.c
+CPPFLAGS+=-I${DIST}
+
+LIB_NETDIFF_DIR!=	cd ${.CURDIR}/../../lib  ${PRINTOBJDIR}
+LDADD+=		-L${LIB_NETDIFF_DIR} -lnetdiff
+DPADD+=		${LIB_NETDIFF_DIR}/libnetdiff.a
+
+WARNS=5
+#MAN=netwdiff.1
+MKMAN=no
+
+DIST=${.CURDIR}/../../dist
+.PATH: ${DIST}
+
+BINDIR=/usr/bin
+
+.include bsd.prog.mk
+
+t: ${PROG}
+	-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} f1 f2  netcmp.out
+	-cmp f1 f2  cmp.out
+	-netdiff cmp.out netcmp.out
+	rm -f cmp.out netcmp.out
+	-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} -l f1 f2  netcmp.out
+	-cmp -l f1 f2  cmp.out
+	-netdiff cmp.out netcmp.out
+	rm -f cmp.out netcmp.out
+	-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} -i f1 f2  netcmp.out
+	-cmp f1 f2  cmp.out
+	-netdiff cmp.out netcmp.out
+	rm -f cmp.out netcmp.out
Index: othersrc/external/bsd/netdiff/bin/cmp/f1
diff -u /dev/null othersrc/external/bsd/netdiff/bin/cmp/f1:1.1
--- /dev/null	Tue Jan 15 01:49:23 2013
+++ othersrc/external/bsd/netdiff/bin/cmp/f1	Tue Jan 15 01:49:23 2013
@@ -0,0 +1,75 @@
+#include sys/types.h
+#include sys/stat.h
+#include sys/mman.h
+
+#include err.h
+#include inttypes.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+// bufgap
+
+typedef struct f_t {
+	char	*name;
+	char	*mapped;
+	FILE	*fp;
+	size_t	 size;
+} f_t;
+
+static int
+finit(f_t *file, const char *name)
+{
+	struct stat	st;
+
+	memset(file, 0x0, sizeof(*file));
+	if ((file-fp = fopen(name, r)) == NULL) {
+		return 0;
+	}
+	fstat(fileno(file-fp), st);
+	file-size = st.st_size;
+	file-mapped = mmap(NULL, file-size, PROT_READ, MAP_SHARED, fileno(file-fp), 0);
+	// xxx
+	file-name = strdup(name);
+	return 1;
+}
+
+static void
+fend(f_t *f)
+{
+	free(f-name);
+	munmap(f-mapped, f-size);
+	fclose(f-fp);
+	memset(f, 0x0, sizeof(*f));
+}
+
+static int
+diff(const char *filename1, const char *filename2)
+{
+	FILE	*pp;
+	char	 buf[2048]; // XXX
+	char	 cmd[2048]; // XXX
+	f_t	 f[2];
+
+	finit(f[0], filename1);
+	finit(f[1], filename2);
+	snprintf(cmd, sizeof(cmd), diff %s %s, filename1, filename2);
+	if ((pp = popen(cmd, r)) == NULL) {
+		return 0;
+	}
+	while (fgets(buf, sizeof(buf), pp) != NULL) {
+		printf(%s, buf);
+	}
+	pclose(pp);
+	fend(f[0]);
+	fend(f[1]);
+	return 1;
+}
+
+int
+main(int argc, char **argv)
+{
+	diff(argv[optind], argv[optind + 1]);
+	exit(EXIT_SUCCESS);
+}
Index: othersrc/external/bsd/netdiff/bin/cmp/f2
diff -u /dev/null othersrc/external/bsd/netdiff/bin/cmp/f2:1.1
--- /dev/null	Tue Jan 15 01:49:23 2013
+++ othersrc/external/bsd/netdiff/bin/cmp/f2	Tue Jan 15 01:49:23 2013
@@ -0,0 +1,75 @@
+#include sys/types.h
+#include sys/stat.h
+#include sys/mman.h
+
+#include err.h
+#include inttypes.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+// BUFGAP
+
+typedef struct f_t {
+	char	*name;
+	char	*mapped;
+	FILE	*fp;
+	size_t	 size;
+} f_t;
+
+static int
+finit(f_t *file, const char *name)
+{
+	struct stat	st;
+
+	memset(file, 0x0, sizeof(*file));
+	if ((file-fp = fopen(name, r)) == NULL) {
+		return 0;
+	}
+	fstat(fileno(file-fp), st);
+	file-size = st.st_size;
+	file-mapped = mmap(NULL, file-size, PROT_READ, MAP_SHARED, fileno(file-fp), 0);
+	// xxx
+	file-name = strdup(name);
+	return 1;
+}
+
+static void

CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-14 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jan 15 01:57:56 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: cmp.c diff_subr.c diffreg.c
netdiff.h

Log Message:
No need for a flags argument to the cmp_file() function.

Check that fp isn't NULL before trying to close it in diff_fini().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/netdiff/dist/cmp.c
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/netdiff/dist/diff_subr.c
cvs rdiff -u -r1.7 -r1.8 othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/netdiff.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/cmp.c
diff -u othersrc/external/bsd/netdiff/dist/cmp.c:1.1 othersrc/external/bsd/netdiff/dist/cmp.c:1.2
--- othersrc/external/bsd/netdiff/dist/cmp.c:1.1	Tue Jan 15 01:49:23 2013
+++ othersrc/external/bsd/netdiff/dist/cmp.c	Tue Jan 15 01:57:56 2013
@@ -51,7 +51,7 @@ main(int argc, char **argv)
 			break;
 		}
 	}
-	cmp_file(diff, argv[optind], argv[optind + 1], 0);
+	cmp_file(diff, argv[optind], argv[optind + 1]);
 	if (diff_get_diffs(diff, s, cc)) {
 		printf(%.*s, (int)cc, s);
 	}

Index: othersrc/external/bsd/netdiff/dist/diff_subr.c
diff -u othersrc/external/bsd/netdiff/dist/diff_subr.c:1.6 othersrc/external/bsd/netdiff/dist/diff_subr.c:1.7
--- othersrc/external/bsd/netdiff/dist/diff_subr.c:1.6	Tue Jan 15 01:46:03 2013
+++ othersrc/external/bsd/netdiff/dist/diff_subr.c	Tue Jan 15 01:57:56 2013
@@ -382,16 +382,10 @@ diff_fini(diff_t *diff)
 		if (diff-start) {
 			free(diff-start);
 		}
-		if (diff-label[0]) {
-			free(diff-label[0]);
-		}
-		if (diff-label[1]) {
-			free(diff-label[1]);
-		}
 		if (diff-ignore) {
 			regfree(diff-ignore);
 		}
-		if (diff-fp != stdout) {
+		if (diff-fp  diff-fp != stdout) {
 			fclose(diff-fp);
 		}
 		if (diff-exclc  0) {
@@ -401,6 +395,9 @@ diff_fini(diff_t *diff)
 			free(diff-excludes);
 		}
 		for (i = 0 ; i  2 ; i++) {
+			if (diff-label[i]) {
+free(diff-label[i]);
+			}
 			if (diff-insertregion[i]) {
 free(diff-insertregion[i]);
 			}

Index: othersrc/external/bsd/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.7 othersrc/external/bsd/netdiff/dist/diffreg.c:1.8
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.7	Tue Jan 15 01:46:03 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Tue Jan 15 01:57:56 2013
@@ -1928,7 +1928,7 @@ closem:
 
 /* byte by byte comparison a la cmp(1) */
 static int
-cmp(diff_t *diff, file_t *f, int flags)
+cmp(diff_t *diff, file_t *f)
 {
 	size_t	diffc;
 	size_t	line;
@@ -2336,7 +2336,7 @@ wdiff_mem(diff_t *diff, const char *m1, 
 
 /* compare two regular files byte by byte */
 int
-cmp_file(diff_t *diff, const char *ofile1, const char *ofile2, int flags)
+cmp_file(diff_t *diff, const char *ofile1, const char *ofile2)
 {
 	stone_t		 s;
 	file_t		 f[2];
@@ -2373,15 +2373,15 @@ cmp_file(diff_t *diff, const char *ofile
 		diff-status |= 2;
 		return D_MISMATCH1;
 	}
-	if ((f[0].fp = openfile(diff, f[0].name, 0, flags)) == NULL) {
+	if ((f[0].fp = openfile(diff, f[0].name, 0, 0)) == NULL) {
 		warn(%s, f[0].name);
 		diff-status |= 2;
 		return D_MISMATCH1;
 	}
-	if ((f[1].fp = openfile(diff, f[1].name, 1, flags)) == NULL) {
+	if ((f[1].fp = openfile(diff, f[1].name, 1, 0)) == NULL) {
 		warn(%s, f[1].name);
 		diff-status |= 2;
 		return D_MISMATCH1;
 	}
-	return cmp(diff, f, flags);
+	return cmp(diff, f);
 }

Index: othersrc/external/bsd/netdiff/dist/netdiff.h
diff -u othersrc/external/bsd/netdiff/dist/netdiff.h:1.4 othersrc/external/bsd/netdiff/dist/netdiff.h:1.5
--- othersrc/external/bsd/netdiff/dist/netdiff.h:1.4	Tue Jan 15 01:46:04 2013
+++ othersrc/external/bsd/netdiff/dist/netdiff.h	Tue Jan 15 01:57:56 2013
@@ -75,6 +75,6 @@ int	difference(diff_t */*diff*/, char */
 int	wdiff_file(diff_t */*diff*/, const char */*f1*/, const char */*f2*/);
 int	wdiff_mem(diff_t */*diff*/, const char */*m1*/, size_t /*size1*/, const char */*m2*/, size_t /*size2*/);
 
-int	cmp_file(diff_t */*diff*/, const char */*file1*/, const char */*file2*/, int /*flags*/);
+int	cmp_file(diff_t */*diff*/, const char */*file1*/, const char */*file2*/);
 
 #endif



CVS commit: othersrc/external/bsd/netdiff/bin/cmp

2013-01-14 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jan 15 02:02:54 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/bin/cmp: Makefile

Log Message:
proper test for case-insensitive netcmp(1).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/netdiff/bin/cmp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/bin/cmp/Makefile
diff -u othersrc/external/bsd/netdiff/bin/cmp/Makefile:1.1 othersrc/external/bsd/netdiff/bin/cmp/Makefile:1.2
--- othersrc/external/bsd/netdiff/bin/cmp/Makefile:1.1	Tue Jan 15 01:49:23 2013
+++ othersrc/external/bsd/netdiff/bin/cmp/Makefile	Tue Jan 15 02:02:53 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2013/01/15 01:49:23 agc Exp $
+# $NetBSD: Makefile,v 1.2 2013/01/15 02:02:53 agc Exp $
 
 .include bsd.own.mk
 
@@ -31,6 +31,9 @@ t: ${PROG}
 	-netdiff cmp.out netcmp.out
 	rm -f cmp.out netcmp.out
 	-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} -i f1 f2  netcmp.out
-	-cmp f1 f2  cmp.out
-	-netdiff cmp.out netcmp.out
-	rm -f cmp.out netcmp.out
+	@if [ -s netcmp.out ]; then	\
+		echo Case insensitive cmp failed;			\
+		ls -l netcmp.out;	\
+		exit 1;			\
+	fi
+	rm -f netcmp.out



CVS commit: othersrc/external/bsd/netdiff

2013-01-13 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sun Jan 13 22:17:22 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/bin: Makefile
othersrc/external/bsd/netdiff/bin/netdiff: Makefile
othersrc/external/bsd/netdiff/bin/qdiff: Makefile
othersrc/external/bsd/netdiff/dist: diff.c diff_subr.c diffreg.c
libnetdiff.3 netdiff.h
othersrc/external/bsd/netdiff/lib: Makefile
Added Files:
othersrc/external/bsd/netdiff/bin/wdiff: Makefile f1 f2
othersrc/external/bsd/netdiff/dist: netwdiff.1 netwdiff.c

Log Message:
Add wdiff functionality, which performs a word-by-word comparison
between two areas of memory, or between two files.  This is
accomplished using two new functions, wdiff_mem() or wdiff_file(), and
results can either be retrieved by displaying them to stdout, to an
output file, or by using diff_get_diffs() to retrieve the results
in-memory.

Internally, the two files/areas of memory are split into separate
areas of memory with a word on each line, and the two areas of memory
are compared using diff_mem().

Comparisons can also be made in a case-insensitive manner.

In the comparison output, added text is displayed in {+ ...  +}
delimiters, and deleted text is shown with [- ... -] delimiters.
Changes are displayed as a deletion and an addition.

+ Deleted text can be inhibited from display by using the -1 argument
  to netwdiff(1).
+ Added text can be inhibited from display by using the -2 argument to
  netwdiff(1).
+ Common text can be inhibited from display by using the -3 argument
  to netwdiff(1).

(Don't blame me, these flags are the ones used by GNU wdiff.)

With thanks to Thomas Klausner for the nudge to create this.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/bin/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 \
othersrc/external/bsd/netdiff/bin/netdiff/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/netdiff/bin/qdiff/Makefile
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/netdiff/bin/wdiff/Makefile \
othersrc/external/bsd/netdiff/bin/wdiff/f1 \
othersrc/external/bsd/netdiff/bin/wdiff/f2
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/netdiff/dist/diff.c \
othersrc/external/bsd/netdiff/dist/diffreg.c \
othersrc/external/bsd/netdiff/dist/libnetdiff.3
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/diff_subr.c
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/netdiff.h
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/netdiff/dist/netwdiff.1 \
othersrc/external/bsd/netdiff/dist/netwdiff.c
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/netdiff/lib/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/bin/Makefile
diff -u othersrc/external/bsd/netdiff/bin/Makefile:1.2 othersrc/external/bsd/netdiff/bin/Makefile:1.3
--- othersrc/external/bsd/netdiff/bin/Makefile:1.2	Sat Jan 12 01:31:20 2013
+++ othersrc/external/bsd/netdiff/bin/Makefile	Sun Jan 13 22:17:21 2013
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2013/01/12 01:31:20 agc Exp $
+# $NetBSD: Makefile,v 1.3 2013/01/13 22:17:21 agc Exp $
 
 SUBDIR=		netdiff
+SUBDIR=		wdiff
 .if !make(install)
 SUBDIR+=	memdiff
 SUBDIR+=	qdiff
@@ -12,3 +13,4 @@ t:
 	cd netdiff  ${MAKE} t
 	cd qdiff  ${MAKE} t
 	cd memdiff  ${MAKE} t
+	cd wdiff  ${MAKE} t

Index: othersrc/external/bsd/netdiff/bin/netdiff/Makefile
diff -u othersrc/external/bsd/netdiff/bin/netdiff/Makefile:1.1.1.1 othersrc/external/bsd/netdiff/bin/netdiff/Makefile:1.2
--- othersrc/external/bsd/netdiff/bin/netdiff/Makefile:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/bin/netdiff/Makefile	Sun Jan 13 22:17:21 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.1.1 2013/01/10 08:17:11 agc Exp $
+# $NetBSD: Makefile,v 1.2 2013/01/13 22:17:21 agc Exp $
 
 .include bsd.own.mk
 
@@ -30,9 +30,9 @@ t: ${PROG}
 	-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} -u f1 f2  003.out
 	diff 003.expected 003.out
 	rm -f 003.out
-	-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} /usr/src/sbin /d/thinfs-src/sbin  004.out
-	diff 004.expected 004.out
-	rm -f 004.out
+	#-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} /usr/src/sbin /d/thinfs-src/sbin  004.out
+	#diff 004.expected 004.out
+	#rm -f 004.out
 	-env LD_LIBRARY_PATH=${LIB_NETDIFF_DIR} ./${PROG} Makefile Makefile  005.out
 	diff 005.expected 005.out
 	rm -f 005.out

Index: othersrc/external/bsd/netdiff/bin/qdiff/Makefile
diff -u othersrc/external/bsd/netdiff/bin/qdiff/Makefile:1.1.1.1 othersrc/external/bsd/netdiff/bin/qdiff/Makefile:1.2
--- othersrc/external/bsd/netdiff/bin/qdiff/Makefile:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/bin/qdiff/Makefile	Sun Jan 13 22:17:21 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.1.1 2013/01/10 08:17:11 agc Exp $
+# $NetBSD: Makefile,v 1.2 2013/01/13 22:17:21 agc Exp $
 
 .include bsd.own.mk
 
@@ 

CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-13 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Mon Jan 14 01:54:23 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: diffreg.c netwdiff.1

Log Message:
Get rid of the pseudo 8-bit ASCII 4 EVAH! character translation
tables to perform case-insensitive comparisons.  For now, we just use
the ctype.h tolower(3) macro to obtain lower case.  Definitely an area
for future development.

No functional changes, all test s run to completion and pass, so there
are no regressions.

Sync the wdiff(1) man page with reality in the RETURN VALUES section.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/netdiff/dist/netwdiff.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.4 othersrc/external/bsd/netdiff/dist/diffreg.c:1.5
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.4	Sun Jan 13 22:17:22 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Mon Jan 14 01:54:23 2013
@@ -247,9 +247,8 @@ typedef struct stone_t {
 	int		 suff;		/* length of prefix and suffix */
 	int		 changec;	/* # of changes */
 	size_t		 candc;
-	candidate_t	*candlist;		/* merely a free storage pot for candidates */
+	candidate_t	*candlist;	/* merely a free storage pot for candidates */
 	size_t		 candlistlen;	/* the length of candlist */
-	uint8_t		*chrtran;	/* translation table for case-folding */
 	diffrange_t	*context_vec_start;
 	diffrange_t	*context_vec_end;
 	diffrange_t	*context_vec_ptr;
@@ -259,72 +258,15 @@ typedef struct stone_t {
 	size_t		 max_context;
 } stone_t;
 
-/*
- * chrtran points to one of 2 translation tables: cup2low if folding upper to
- * lower case clow2low if not folding case
- */
-static uint8_t clow2low[256] = {
-	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
-	0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
-	0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
-	0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
-	0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
-	0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
-	0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
-	0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
-	0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62,
-	0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
-	0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
-	0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
-	0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,
-	0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
-	0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4,
-	0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
-	0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,
-	0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5,
-	0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
-	0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
-	0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
-	0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1,
-	0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc,
-	0xfd, 0xfe, 0xff
-};
-
-static uint8_t cup2low[256] = {
-	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
-	0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
-	0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
-	0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
-	0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
-	0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x60, 0x61,
-	0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
-	0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
-	0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x60, 0x61, 0x62,
-	0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
-	0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
-	0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83,
-	0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,
-	0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
-	0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4,
-	0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
-	0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,
-	0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5,
-	0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
-	0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
-	0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 

CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-13 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Mon Jan 14 05:20:40 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: diffreg.c

Log Message:
minor cosmetics - also ignore case if we're using our (abstracted) fread()
eqivalent function, not just in the single character case. This wouldn't
have produced wrong results, but would have made it much more inefficient,
since the initial do files differ? question would have given a false
positive.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/netdiff/dist/diffreg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.5 othersrc/external/bsd/netdiff/dist/diffreg.c:1.6
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.5	Mon Jan 14 01:54:23 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Mon Jan 14 05:20:40 2013
@@ -353,15 +353,25 @@ diff_ftell(file_t *f)
 }
 
 static size_t
-diff_fread(void *ptr, size_t size, size_t c, file_t *f)
+diff_fread(diff_t *diff, void *ptr, size_t size, size_t c, file_t *f)
 {
+	size_t	cc;
+	size_t	i;
+	char	*p;
+
 	if (f-mapped) {
 		memcpy(ptr, f-mapped[f-curpos], c * size);
 		f-curpos += (c * size);
-		return c;
+		cc = c;
 	} else {
-		return fread(ptr, size, c, f-fp);
+		cc = fread(ptr, size, c, f-fp);
 	}
+	if (DIFF_GET_FLAG(diff, 'i')) {
+		for (i = 0, p = ptr ; i  cc ; i++) {
+			p[i] = tolower((uint8_t)p[i]);
+		}
+	}
+	return cc;
 }
 
 static int
@@ -420,27 +430,27 @@ diff_fsetpos(file_t *f, const fpos_t *po
 static int
 files_differ(diff_t *diff, file_t *f, int flags)
 {
-	char buf1[BUFSIZ], buf2[BUFSIZ];
-	size_t i, j;
+	size_t	cc[2];
+	char	buf1[BUFSIZ * 10];
+	char	buf2[BUFSIZ * 10];
 
 	if ((flags  (D_EMPTY1|D_EMPTY2)) || diff-st[0].st_size != diff-st[1].st_size ||
 	(diff-st[0].st_mode  S_IFMT) != (diff-st[1].st_mode  S_IFMT)) {
 		return 1;
 	}
 	for (;;) {
-		i = diff_fread(buf1, 1, sizeof(buf1), f[0]);
-		j = diff_fread(buf2, 1, sizeof(buf2), f[1]);
-		
-		if (i != j) {
+		cc[0] = diff_fread(diff, buf1, 1, sizeof(buf1), f[0]);
+		cc[1] = diff_fread(diff, buf2, 1, sizeof(buf2), f[1]);
+		if (cc[0] != cc[1]) {
 			return 1;
 		}
-		if (i == 0  j == 0) {
+		if (cc[0] == 0  cc[1] == 0) {
 			if (diff_ferror(f[0]) || diff_ferror(f[1])) {
 return 1;
 			}
 			return 0;
 		}
-		if (memcmp(buf1, buf2, i) != 0) {
+		if (memcmp(buf1, buf2, cc[0]) != 0) {
 			return 1;
 		}
 	}
@@ -1057,7 +1067,7 @@ print_context_header(diff_t *diff, const
 #define ISIDENT(x)	(isalpha((uint8_t)x) || (x) == '_' || (x) == '$')
 
 static char *
-match_function(stone_t *s, const long *offsets, int lineno, file_t *f)
+match_function(diff_t *diff, stone_t *s, const long *offsets, int lineno, file_t *f)
 {
 	const char	*state;
 	size_t		 nc;
@@ -1072,7 +1082,7 @@ match_function(stone_t *s, const long *o
 		if (nc = sizeof(buf)) {
 			nc = sizeof(buf) - 1;
 		}
-		nc = diff_fread(buf, 1, nc, f);
+		nc = diff_fread(diff, buf, 1, nc, f);
 		if (nc  0) {
 			buf[nc] = '\0';
 			buf[strcspn(buf, \n)] = '\0';
@@ -1241,7 +1251,7 @@ dump_context_vec(diff_t *diff, stone_t *
 
 	diff_printf(diff, ***);
 	if (SHOW_C_FUNCTION(diff)) {
-		func = match_function(s, f[0].offsets, lowa-1, f[0]);
+		func = match_function(diff, s, f[0].offsets, lowa-1, f[0]);
 		if (func != NULL) {
 			diff_printf(diff,  %s, func);
 		}
@@ -1343,7 +1353,7 @@ dump_unified_vec(diff_t *diff, stone_t *
 	uni_range(diff, lowc, upd);
 	diff_printf(diff,  @@);
 	if (SHOW_C_FUNCTION(diff)) {
-		func = match_function(s, f[0].offsets, lowa-1, f[0]);
+		func = match_function(diff, s, f[0].offsets, lowa-1, f[0]);
 		if (func != NULL) {
 			diff_printf(diff,  %s, func);
 		}



CVS commit: othersrc/external/bsd/netdiff

2013-01-10 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Jan 10 08:17:11 UTC 2013

Update of /cvsroot/othersrc/external/bsd/netdiff
In directory ivanova.netbsd.org:/tmp/cvs-serv19258

Log Message:
Import netdiff library and program, version 20130107, into othersrc.

This is the old BSD diff(1) program, rewritten and re-organised into a
library and a small program to call the functions in the library. 
There are no static variables, and so many comparisons can be
performed simultaneously.  Functionally, the netdiff(1) program is the
same as diff(1).

Standard diff output is produced by default.  Context and unified diff
output can be specified using the -c and -u command line switches, and
the amount of context can be specified in the usual way.

SCM programs usually use ed scripts (RCS and CVS) or binary diffs, and
these are produced using this program.  In addition, a simplified form
of VCDIFF output (RFC 3284) can be produced -- and a separate binary
patch program is used to reconstruct versions through this method.

As this is organised into a library interface, libnetdiff(3) is also
targetted at scripting languages.  Comparison output can be sent to a
file, or held in a buffer, and the buffer read using the API.  If
neither of these options is specified, then the comparsion output will
be sent to stdout.

qdiff(1) is a small program which uses the buffer interface to
retrieve the comparison information. It is provided as an illustration
of how to use the API, and is not installed by default.

Simple tests are in the two Makefiles in the netdiff and qdiff
sub-directories of bin in the reachover infrastructure.

Status:

Vendor Tag: NETDIFF
Release Tags:   netdiff-20130107-base

N othersrc/external/bsd/netdiff/Makefile
N othersrc/external/bsd/netdiff/bin/Makefile
N othersrc/external/bsd/netdiff/bin/netdiff/001.expected
N othersrc/external/bsd/netdiff/bin/netdiff/002.expected
N othersrc/external/bsd/netdiff/bin/netdiff/003.expected
N othersrc/external/bsd/netdiff/bin/netdiff/004.expected
N othersrc/external/bsd/netdiff/bin/netdiff/005.expected
N othersrc/external/bsd/netdiff/bin/netdiff/006.expected
N othersrc/external/bsd/netdiff/bin/netdiff/007.expected
N othersrc/external/bsd/netdiff/bin/netdiff/Makefile
N othersrc/external/bsd/netdiff/bin/netdiff/f1
N othersrc/external/bsd/netdiff/bin/netdiff/f2
N othersrc/external/bsd/netdiff/bin/qdiff/001.expected
N othersrc/external/bsd/netdiff/bin/qdiff/002.expected
N othersrc/external/bsd/netdiff/bin/qdiff/003.expected
N othersrc/external/bsd/netdiff/bin/qdiff/004.expected
N othersrc/external/bsd/netdiff/bin/qdiff/005.expected
N othersrc/external/bsd/netdiff/bin/qdiff/006.expected
N othersrc/external/bsd/netdiff/bin/qdiff/Makefile
N othersrc/external/bsd/netdiff/dist/Makefile
N othersrc/external/bsd/netdiff/dist/TODO
N othersrc/external/bsd/netdiff/dist/diff.c
N othersrc/external/bsd/netdiff/dist/diff_subr.c
N othersrc/external/bsd/netdiff/dist/diffdir.c
N othersrc/external/bsd/netdiff/dist/diffreg.c
N othersrc/external/bsd/netdiff/dist/internal.h
N othersrc/external/bsd/netdiff/dist/libnetdiff.3
N othersrc/external/bsd/netdiff/dist/netdiff.1
N othersrc/external/bsd/netdiff/dist/netdiff.h
N othersrc/external/bsd/netdiff/dist/pathnames.h
N othersrc/external/bsd/netdiff/dist/qdiff.c
N othersrc/external/bsd/netdiff/lib/Makefile
N othersrc/external/bsd/netdiff/lib/shlib_version

No conflicts created by this import



CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-10 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Thu Jan 10 08:51:28 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: netdiff.1

Log Message:
Fix date; add RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/netdiff/dist/netdiff.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/netdiff.1
diff -u othersrc/external/bsd/netdiff/dist/netdiff.1:1.1.1.1 othersrc/external/bsd/netdiff/dist/netdiff.1:1.2
--- othersrc/external/bsd/netdiff/dist/netdiff.1:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/dist/netdiff.1	Thu Jan 10 08:51:28 2013
@@ -1,3 +1,4 @@
+.\	$NetBSD: netdiff.1,v 1.2 2013/01/10 08:51:28 wiz Exp $
 .\	$FreeBSD$
 .\	$OpenBSD: diff.1,v 1.33 2007/05/31 19:20:09 jmc Exp $
 .\
@@ -30,7 +31,7 @@
 .\
 .\ @(#)diff.1	8.1 (Berkeley) 6/30/93
 .\
-.Dd Apr 7, 2008
+.Dd April 7, 2008
 .Dt DIFF 1
 .Os
 .Sh NAME



CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-10 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Thu Jan 10 08:51:44 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: libnetdiff.3

Log Message:
xref netdiff instead of bsddiff (I guess that was the intention).


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/netdiff/dist/libnetdiff.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/dist/libnetdiff.3
diff -u othersrc/external/bsd/netdiff/dist/libnetdiff.3:1.1.1.1 othersrc/external/bsd/netdiff/dist/libnetdiff.3:1.2
--- othersrc/external/bsd/netdiff/dist/libnetdiff.3:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/dist/libnetdiff.3	Thu Jan 10 08:51:44 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: libnetdiff.3,v 1.1.1.1 2013/01/10 08:17:11 agc Exp $
+.\ $NetBSD: libnetdiff.3,v 1.2 2013/01/10 08:51:44 wiz Exp $
 .\
 .\ Copyright (c) 2013 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -74,7 +74,7 @@ The
 .Nm
 library is a library interface to the
 BSD difference program
-.Xr bsddiff 1 ,
+.Xr netdiff 1 ,
 and is designed to be used either as an integral part of C programs,
 or as an interface to scripting languages, allowing them direct access to all
 of the features of the standard



CVS commit: othersrc/external/bsd/netdiff

2013-01-10 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Fri Jan 11 05:10:19 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/bin/netdiff: 002.expected 003.expected
004.expected 006.expected
othersrc/external/bsd/netdiff/bin/qdiff: 002.expected 003.expected
004.expected 006.expected
othersrc/external/bsd/netdiff/dist: diff_subr.c

Log Message:
Feedback from fuzz tests - check input arguments to exported functions

Modify the expected output files for mtimes on the tests after the import


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
othersrc/external/bsd/netdiff/bin/netdiff/002.expected \
othersrc/external/bsd/netdiff/bin/netdiff/003.expected \
othersrc/external/bsd/netdiff/bin/netdiff/004.expected \
othersrc/external/bsd/netdiff/bin/netdiff/006.expected
cvs rdiff -u -r1.1.1.1 -r1.2 \
othersrc/external/bsd/netdiff/bin/qdiff/002.expected \
othersrc/external/bsd/netdiff/bin/qdiff/003.expected \
othersrc/external/bsd/netdiff/bin/qdiff/004.expected \
othersrc/external/bsd/netdiff/bin/qdiff/006.expected
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/netdiff/dist/diff_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/bin/netdiff/002.expected
diff -u othersrc/external/bsd/netdiff/bin/netdiff/002.expected:1.1.1.1 othersrc/external/bsd/netdiff/bin/netdiff/002.expected:1.2
--- othersrc/external/bsd/netdiff/bin/netdiff/002.expected:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/bin/netdiff/002.expected	Fri Jan 11 05:10:19 2013
@@ -1,5 +1,5 @@
-*** f1	Sun Jan  6 21:29:26 2013
 f2	Sun Jan  6 21:29:26 2013
+*** f1	Thu Jan 10 00:17:11 2013
+--- f2	Thu Jan 10 00:17:11 2013
 ***
 *** 1,3 
 --- 1,27 
Index: othersrc/external/bsd/netdiff/bin/netdiff/003.expected
diff -u othersrc/external/bsd/netdiff/bin/netdiff/003.expected:1.1.1.1 othersrc/external/bsd/netdiff/bin/netdiff/003.expected:1.2
--- othersrc/external/bsd/netdiff/bin/netdiff/003.expected:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/bin/netdiff/003.expected	Fri Jan 11 05:10:19 2013
@@ -1,5 +1,5 @@
 f1	2013-01-06 21:29:26.0 -0800
-+++ f2	2013-01-06 21:29:26.0 -0800
+--- f1	2013-01-10 00:17:11.0 -0800
 f2	2013-01-10 00:17:11.0 -0800
 @@ -1,3 +1,27 @@
 +/*-
 + * Copyright (c) 2013 Alistair Crooks a...@netbsd.org
Index: othersrc/external/bsd/netdiff/bin/netdiff/004.expected
diff -u othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.1.1.1 othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.2
--- othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/bin/netdiff/004.expected	Fri Jan 11 05:10:19 2013
@@ -6,9 +6,9 @@ diff /usr/src/sbin/Makefile /d/thinfs-sr
  SUBDIR+= mount_thinfs
 diff /usr/src/sbin/Makefile.inc /d/thinfs-src/sbin/Makefile.inc
 1c1
- #	$NetBSD: 004.expected,v 1.1.1.1 2013/01/10 08:17:11 agc Exp $
+ #	$NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $
 ---
- #	$NetBSD: 004.expected,v 1.1.1.1 2013/01/10 08:17:11 agc Exp $
+ #	$NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $
 6c6
  WARNS?=		4
 ---
Index: othersrc/external/bsd/netdiff/bin/netdiff/006.expected
diff -u othersrc/external/bsd/netdiff/bin/netdiff/006.expected:1.1.1.1 othersrc/external/bsd/netdiff/bin/netdiff/006.expected:1.2
--- othersrc/external/bsd/netdiff/bin/netdiff/006.expected:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/bin/netdiff/006.expected	Fri Jan 11 05:10:19 2013
@@ -1,5 +1,5 @@
 f1	2013-01-06 21:29:26.0 -0800
-+++ f2	2013-01-06 21:29:26.0 -0800
+--- f1	2013-01-10 00:17:11.0 -0800
 f2	2013-01-10 00:17:11.0 -0800
 @@ -1,3 +1,27 @@
 +/*-
 + * Copyright (c) 2013 Alistair Crooks a...@netbsd.org

Index: othersrc/external/bsd/netdiff/bin/qdiff/002.expected
diff -u othersrc/external/bsd/netdiff/bin/qdiff/002.expected:1.1.1.1 othersrc/external/bsd/netdiff/bin/qdiff/002.expected:1.2
--- othersrc/external/bsd/netdiff/bin/qdiff/002.expected:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/bin/qdiff/002.expected	Fri Jan 11 05:10:19 2013
@@ -1,5 +1,5 @@
-*** /usr/othersrc/external/bsd/netdiff/bin/qdiff/../netdiff/f1	Sun Jan  6 21:29:26 2013
 /usr/othersrc/external/bsd/netdiff/bin/qdiff/../netdiff/f2	Sun Jan  6 21:29:26 2013
+*** /usr/othersrc/external/bsd/netdiff/bin/qdiff/../netdiff/f1	Thu Jan 10 00:17:11 2013
+--- /usr/othersrc/external/bsd/netdiff/bin/qdiff/../netdiff/f2	Thu Jan 10 00:17:11 2013
 ***
 *** 1,3 
 --- 1,27 
Index: othersrc/external/bsd/netdiff/bin/qdiff/003.expected
diff -u othersrc/external/bsd/netdiff/bin/qdiff/003.expected:1.1.1.1 othersrc/external/bsd/netdiff/bin/qdiff/003.expected:1.2
--- 

CVS commit: othersrc/external/bsd/netdiff

2013-01-10 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Fri Jan 11 05:19:46 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/bin/netdiff: 004.expected
othersrc/external/bsd/netdiff/bin/qdiff: 004.expected
othersrc/external/bsd/netdiff/dist: diff.c diff_subr.c diffdir.c
diffreg.c

Log Message:
avoid accessing fields in the struct from main() and other callers -
set defaults at the start of the 3 main functions - diff_file(),
diff_dir() and difference().


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
othersrc/external/bsd/netdiff/bin/netdiff/004.expected
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/bin/qdiff/004.expected
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/netdiff/dist/diff.c \
othersrc/external/bsd/netdiff/dist/diffdir.c \
othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/diff_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/external/bsd/netdiff/bin/netdiff/004.expected
diff -u othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.2 othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.3
--- othersrc/external/bsd/netdiff/bin/netdiff/004.expected:1.2	Fri Jan 11 05:10:19 2013
+++ othersrc/external/bsd/netdiff/bin/netdiff/004.expected	Fri Jan 11 05:19:46 2013
@@ -6,9 +6,9 @@ diff /usr/src/sbin/Makefile /d/thinfs-sr
  SUBDIR+= mount_thinfs
 diff /usr/src/sbin/Makefile.inc /d/thinfs-src/sbin/Makefile.inc
 1c1
- #	$NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $
+ #	$NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $
 ---
- #	$NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $
+ #	$NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $
 6c6
  WARNS?=		4
 ---

Index: othersrc/external/bsd/netdiff/bin/qdiff/004.expected
diff -u othersrc/external/bsd/netdiff/bin/qdiff/004.expected:1.2 othersrc/external/bsd/netdiff/bin/qdiff/004.expected:1.3
--- othersrc/external/bsd/netdiff/bin/qdiff/004.expected:1.2	Fri Jan 11 05:10:19 2013
+++ othersrc/external/bsd/netdiff/bin/qdiff/004.expected	Fri Jan 11 05:19:46 2013
@@ -6,9 +6,9 @@ diff /usr/src/sbin/Makefile /d/thinfs-sr
  SUBDIR+= mount_thinfs
 diff /usr/src/sbin/Makefile.inc /d/thinfs-src/sbin/Makefile.inc
 1c1
- #	$NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $
+ #	$NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $
 ---
- #	$NetBSD: 004.expected,v 1.2 2013/01/11 05:10:19 agc Exp $
+ #	$NetBSD: 004.expected,v 1.3 2013/01/11 05:19:46 agc Exp $
 6c6
  WARNS?=		4
 ---

Index: othersrc/external/bsd/netdiff/dist/diff.c
diff -u othersrc/external/bsd/netdiff/dist/diff.c:1.1.1.1 othersrc/external/bsd/netdiff/dist/diff.c:1.2
--- othersrc/external/bsd/netdiff/dist/diff.c:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/dist/diff.c	Fri Jan 11 05:19:46 2013
@@ -346,9 +346,6 @@ main(int argc, char **argv)
 	char		*prog;
 	
 	memset(diff, 0x0, sizeof(diff));
-	diff.tabsize = 8;
-	diff.fp = stdout;
-	diff.optfile = \0;
 	oargv = argv;
 	oargc = argc;
 	lastch = '\0';
Index: othersrc/external/bsd/netdiff/dist/diffdir.c
diff -u othersrc/external/bsd/netdiff/dist/diffdir.c:1.1.1.1 othersrc/external/bsd/netdiff/dist/diffdir.c:1.2
--- othersrc/external/bsd/netdiff/dist/diffdir.c:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/dist/diffdir.c	Fri Jan 11 05:19:46 2013
@@ -228,6 +228,15 @@ diff_dir(diff_t *diff, char *p1, char *p
 	if (diff == NULL || p1 == NULL || p2 == NULL) {
 		return 0;
 	}
+	if (diff-tabsize == 0) {
+		diff-tabsize = 8;
+	}
+	if (diff-fp == NULL) {
+		diff-fp = stdout;
+	}
+	if (diff-optfile == NULL) {
+		diff-optfile = \0;
+	}
 	dirlen1 = strlcpy(path1, *p1 ? p1 : ., sizeof(path1));
 	if (dirlen1 = sizeof(path1) - 1) {
 		warnx(%s: %s, p1, strerror(ENAMETOOLONG));
Index: othersrc/external/bsd/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.1.1.1 othersrc/external/bsd/netdiff/dist/diffreg.c:1.2
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.1.1.1	Thu Jan 10 08:17:11 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Fri Jan 11 05:19:46 2013
@@ -1763,6 +1763,15 @@ diff_file(diff_t *diff, const char *ofil
 	if (diff == NULL || ofile1 == NULL || ofile2 == NULL) {
 		return D_MISMATCH1;
 	}
+	if (diff-tabsize == 0) {
+		diff-tabsize = 8;
+	}
+	if (diff-fp == NULL) {
+		diff-fp = stdout;
+	}
+	if (diff-optfile == NULL) {
+		diff-optfile = \0;
+	}
 	memset(s, 0x0, sizeof(s));
 	memset(f[0], 0x0, sizeof(f[0]));
 	memset(f[1], 0x0, sizeof(f[1]));

Index: othersrc/external/bsd/netdiff/dist/diff_subr.c
diff -u othersrc/external/bsd/netdiff/dist/diff_subr.c:1.2 othersrc/external/bsd/netdiff/dist/diff_subr.c:1.3
--- othersrc/external/bsd/netdiff/dist/diff_subr.c:1.2	Fri Jan 11 05:10:19 2013
+++ othersrc/external/bsd/netdiff/dist/diff_subr.c	Fri Jan 11 05:19:46 2013
@@ -384,6 +384,15 @@ difference(diff_t *diff,