summaryrefslogtreecommitdiff
path: root/usr.bin/diff/diffreg.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-10-05 20:15:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-10-05 20:15:01 +0000
commit36eed06dd9be4b7d8dbb9e2b35ba1039917dfbab (patch)
treedfbc373a47ad99f5b5750def9ff8b6c54b304f27 /usr.bin/diff/diffreg.c
parent775cd0daa9a5cd1526bb295c074248d0da5f1b97 (diff)
Remove the non-standard -l flag that pipes the output through pr(1).
Based on a diff from and OK deraadt@
Diffstat (limited to 'usr.bin/diff/diffreg.c')
-rw-r--r--usr.bin/diff/diffreg.c59
1 files changed, 3 insertions, 56 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 446fa359b22..8226ff803c8 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffreg.c,v 1.87 2015/09/25 16:16:26 tedu Exp $ */
+/* $OpenBSD: diffreg.c,v 1.88 2015/10/05 20:15:00 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -71,6 +71,7 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <paths.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
@@ -80,7 +81,6 @@
#include <limits.h>
#include "diff.h"
-#include "pathnames.h"
#include "xmalloc.h"
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
@@ -293,8 +293,7 @@ int
diffreg(char *file1, char *file2, int flags)
{
FILE *f1, *f2;
- int i, rval, ostdout = -1;
- pid_t pid = -1;
+ int i, rval;
f1 = f2 = NULL;
rval = D_SAME;
@@ -370,45 +369,6 @@ diffreg(char *file1, char *file2, int flags)
status |= 1;
goto closem;
}
- if (lflag) {
- /* redirect stdout to pr */
- int pfd[2];
- char *header;
- char *prargv[] = { "pr", "-h", NULL, "-f", NULL };
-
- xasprintf(&header, "%s %s %s", diffargs, file1, file2);
- prargv[2] = header;
- fflush(stdout);
- rewind(stdout);
- pipe(pfd);
- switch ((pid = fork())) {
- case -1:
- warnx("No more processes");
- status |= 2;
- free(header);
- rval = D_ERROR;
- goto closem;
- case 0:
- /* child */
- if (pfd[0] != STDIN_FILENO) {
- dup2(pfd[0], STDIN_FILENO);
- close(pfd[0]);
- }
- close(pfd[1]);
- execv(_PATH_PR, prargv);
- _exit(127);
- 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(0, f1, stb1.st_size, flags);
prepare(1, f2, stb2.st_size, flags);
@@ -441,19 +401,6 @@ diffreg(char *file1, char *file2, int flags)
ixnew = xreallocarray(ixnew, len[1] + 2, sizeof(*ixnew));
check(f1, f2, flags);
output(file1, f1, file2, f2, flags);
- 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 (anychange) {
status |= 1;