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 first 40 characters of the last line before the context beginning