From owner-p4-projects@FreeBSD.ORG Tue Jun 22 01:36:16 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D44821065672; Tue, 22 Jun 2010 01:36:15 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80AED106566C for ; Tue, 22 Jun 2010 01:36:15 +0000 (UTC) (envelope-from bfiedler@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 66D1F8FC17 for ; Tue, 22 Jun 2010 01:36:15 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5M1aFvQ022027 for ; Tue, 22 Jun 2010 01:36:15 GMT (envelope-from bfiedler@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5M1aFr8022025 for perforce@freebsd.org; Tue, 22 Jun 2010 01:36:15 GMT (envelope-from bfiedler@FreeBSD.org) Date: Tue, 22 Jun 2010 01:36:15 GMT Message-Id: <201006220136.o5M1aFr8022025@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bfiedler@FreeBSD.org using -f From: Benjamin Fiedler To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180087 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2010 01:36:16 -0000 http://p4web.freebsd.org/@@180087?ac=10 Change 180087 by bfiedler@freebsd-7803 on 2010/06/22 01:36:13 Add --horizon-lines option Affected files ... .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#3 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#3 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#3 edit Differences ... ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#3 (text+ko) ==== @@ -48,6 +48,7 @@ int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; int sflag, tflag, Tflag, wflag, uniflag, yflag, strip_cr, tabsize=8; +int horizon; int format, status; int fcase_behave = FCASE_SENSITIVE; unsigned long long context; @@ -65,6 +66,7 @@ TOFILE_OPT, UNIDIR_OPT, STRIPCR_OPT, + HORIZ_OPT, NOOP_OPT, LEFTC_OPT, @@ -89,6 +91,7 @@ { "from-file", required_argument, NULL, FROMFILE_OPT }, { "to-file", required_argument, NULL, TOFILE_OPT }, { "help", no_argument, NULL, HELP_OPT }, + { "horizon-lines", required_argument, NULL, HORIZ_OPT}, { "text", no_argument, NULL, 'a' }, { "ignore-blank-lines", no_argument, NULL, 'B' }, { "ignore-space-change", no_argument, NULL, 'b' }, @@ -124,7 +127,6 @@ /* XXX: the following are not very well documented and rarely used. If we need them at all, we will need to dig into the code to see what do they do actually. - { "horizon-lines", required_argument, NULL, NOOP_OPT }, { "left-column", no_argument, NULL, NOOP_OPT }, { "line-format", required_argument, NULL, NOOP_OPT }, { "show-function-line", required_argument, NULL, 'F' }, @@ -323,6 +325,15 @@ } else tabsize = 8; break; + case HORIZ_OPT: + if (optarg != NULL) { + context = strtol(optarg, &ep, 10); + if (*ep != '\0' || context < 1 || context >=ULLONG_MAX) + err(2, "context out of range\n"); + horizon= (int)context; + } + break; + case NOOP_OPT: /* noop, compatibility */ break; ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#3 (text+ko) ==== @@ -84,7 +84,7 @@ extern int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, sflag, tflag, Tflag, wflag, uniflag, strip_cr, tabsize; -extern int format, status; +extern int format, status, horizon; extern int fcase_behave; extern unsigned long long context; extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#3 (text+ko) ==== @@ -529,6 +529,12 @@ file[0][len[0] - suff].value == file[1][len[1] - suff].value; suff++) ; + + if(horizon) { + suff = (suff - horizon) < 0 ? 0 : suff - horizon; + pref = (pref - horizon) < 0 ? 0 : pref - horizon; + } + for (j = 0; j < 2; j++) { sfile[j] = file[j] + pref; slen[j] = len[j] - pref - suff;