From owner-svn-src-stable-11@freebsd.org Sat Oct 22 20:46:58 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A84F5C1D7AC; Sat, 22 Oct 2016 20:46:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FCCD65F; Sat, 22 Oct 2016 20:46:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9MKkvC2010478; Sat, 22 Oct 2016 20:46:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9MKkvmW010477; Sat, 22 Oct 2016 20:46:57 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610222046.u9MKkvmW010477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 22 Oct 2016 20:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307789 - stable/11/usr.bin/sdiff X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 20:46:58 -0000 Author: bapt Date: Sat Oct 22 20:46:57 2016 New Revision: 307789 URL: https://svnweb.freebsd.org/changeset/base/307789 Log: MFC r303783, r305927: r303783: sdiff: remove non finish/function code 2 extra options not available neither on other BSD nor in GNU sdiff: --diff-pid and --pipe-fd were present in the SoC code, none were usable Just remove it r305927: Remove reference of z(s)diff which was dropped before importing Modified: stable/11/usr.bin/sdiff/sdiff.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/sdiff/sdiff.c ============================================================================== --- stable/11/usr.bin/sdiff/sdiff.c Sat Oct 22 20:39:18 2016 (r307788) +++ stable/11/usr.bin/sdiff/sdiff.c Sat Oct 22 20:46:57 2016 (r307789) @@ -104,9 +104,6 @@ enum { HLINES_OPT, LFILES_OPT, DIFFPROG_OPT, - PIPE_FD, - /* pid from the diff parent (if applicable) */ - DIFF_PID, NOOP_OPT, }; @@ -120,8 +117,6 @@ static struct option longopts[] = { { "output", required_argument, NULL, 'o' }, { "diff-program", required_argument, NULL, DIFFPROG_OPT }, - { "pipe-fd", required_argument, NULL, PIPE_FD }, - { "diff-pid", required_argument, NULL, DIFF_PID }, /* Options processed by diff. */ { "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT }, { "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT }, @@ -237,7 +232,7 @@ main(int argc, char **argv) FILE *diffpipe=NULL, *file1, *file2; size_t diffargc = 0, wflag = WIDTH; int ch, fd[2] = {-1}, status; - pid_t pid=0; pid_t ppid =-1; + pid_t pid=0; const char *outfile = NULL; struct option *popt; char **diffargv, *diffprog = DIFF_PATH, *filename1, *filename2, @@ -320,11 +315,6 @@ main(int argc, char **argv) if (errstr) errx(2, "width is %s: %s", errstr, optarg); break; - case DIFF_PID: - ppid = strtonum(optarg, 0, INT_MAX, &errstr); - if (errstr) - errx(2, "diff pid value is %s: %s", errstr, optarg); - break; case HELP_OPT: for (i = 0; help_msg[i] != NULL; i++) printf("%s\n", help_msg[i]); @@ -393,35 +383,34 @@ main(int argc, char **argv) errx(2, "width is too large: %zu", width); line_width = width * 2 + 3; - if (ppid == -1 ) { - if (pipe(fd)) - err(2, "pipe"); - - switch (pid = fork()) { - case 0: - /* child */ - /* We don't read from the pipe. */ - close(fd[0]); - if (dup2(fd[1], STDOUT_FILENO) == -1) - err(2, "child could not duplicate descriptor"); - /* Free unused descriptor. */ - close(fd[1]); - execvp(diffprog, diffargv); - err(2, "could not execute diff: %s", diffprog); - break; - case -1: - err(2, "could not fork"); - break; - } + if (pipe(fd)) + err(2, "pipe"); - /* parent */ - /* We don't write to the pipe. */ + switch (pid = fork()) { + case 0: + /* child */ + /* We don't read from the pipe. */ + close(fd[0]); + if (dup2(fd[1], STDOUT_FILENO) == -1) + err(2, "child could not duplicate descriptor"); + /* Free unused descriptor. */ close(fd[1]); - - /* Open pipe to diff command. */ - if ((diffpipe = fdopen(fd[0], "r")) == NULL) - err(2, "could not open diff pipe"); + execvp(diffprog, diffargv); + err(2, "could not execute diff: %s", diffprog); + break; + case -1: + err(2, "could not fork"); + break; } + + /* parent */ + /* We don't write to the pipe. */ + close(fd[1]); + + /* Open pipe to diff command. */ + if ((diffpipe = fdopen(fd[0], "r")) == NULL) + err(2, "could not open diff pipe"); + if ((file1 = fopen(filename1, "r")) == NULL) err(2, "could not open %s", filename1); if ((file2 = fopen(filename2, "r")) == NULL) @@ -489,8 +478,8 @@ main(int argc, char **argv) } /* - * When sdiff/zsdiff detects a binary file as input, executes them with - * diff/zdiff to maintain the same behavior as GNU sdiff with binary input. + * When sdiff detects a binary file as input, executes them with + * diff to maintain the same behavior as GNU sdiff with binary input. */ static void binexec(char *diffprog, char *f1, char *f2)