diff options
-rw-r--r-- | usr.bin/cvs/commit.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.1 | 12 | ||||
-rw-r--r-- | usr.bin/cvs/diff.c | 25 | ||||
-rw-r--r-- | usr.bin/cvs/diff.h | 15 | ||||
-rw-r--r-- | usr.bin/cvs/diff3.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/diff_internals.c | 144 | ||||
-rw-r--r-- | usr.bin/cvs/import.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 4 |
8 files changed, 120 insertions, 96 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index 6accad5063a..36f2b606c56 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.147 2009/03/26 22:54:37 joris Exp $ */ +/* $OpenBSD: commit.c,v 1.148 2009/06/06 14:17:27 ray Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -760,7 +760,7 @@ commit_diff(struct cvs_file *cf, RCSNUM *rev, int reverse) fd2 = f; } - if (cvs_diffreg(p1, p2, fd1, fd2, b) == D_ERROR) + if (cvs_diffreg(p1, p2, fd1, fd2, b, D_FORCEASCII) == D_ERROR) fatal("commit_diff: failed to get RCS patch"); close(fd1); diff --git a/usr.bin/cvs/cvs.1 b/usr.bin/cvs/cvs.1 index 92b6f35e39c..84c7112de17 100644 --- a/usr.bin/cvs/cvs.1 +++ b/usr.bin/cvs/cvs.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cvs.1,v 1.124 2009/04/28 11:43:43 jmc Exp $ +.\" $OpenBSD: cvs.1,v 1.125 2009/06/06 14:17:27 ray Exp $ .\" .\" Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> .\" Copyright (c) 2004-2008 Xavier Santolaria <xsa@openbsd.org> @@ -24,7 +24,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: April 28 2009 $ +.Dd $Mdocdate: June 6 2009 $ .Dt CVS 1 .Os .Sh NAME @@ -591,6 +591,14 @@ and the working copy or and .Ar rev2 (if specified). +.It Fl t +Will expand tabs in output lines. +Normal or +.Fl c +output adds character(s) to the front of each line which may screw up +the indentation of the original source lines and make the output listing +difficult to interpret. +This option will preserve the original source's indentation. .It Fl u Produces a unified diff with three lines of context. See diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index eebd662b742..89bd7206255 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.153 2009/04/29 12:56:15 joris Exp $ */ +/* $OpenBSD: diff.c,v 1.154 2009/06/06 14:17:27 ray Exp $ */ /* * Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org> * Copyright (c) 2006 Joris Vink <joris@openbsd.org> @@ -32,6 +32,7 @@ void cvs_diff_local(struct cvs_file *); +static int dflags = 0; static int Nflag = 0; static int force_head = 0; static char *koptstr; @@ -80,11 +81,11 @@ cvs_diff(int argc, char **argv) switch (ch) { case 'a': strlcat(diffargs, " -a", sizeof(diffargs)); - diff_aflag = 1; + dflags |= D_FORCEASCII; break; case 'b': strlcat(diffargs, " -b", sizeof(diffargs)); - diff_bflag = 1; + dflags |= D_FOLDBLANKS; break; case 'c': strlcat(diffargs, " -c", sizeof(diffargs)); @@ -92,7 +93,7 @@ cvs_diff(int argc, char **argv) break; case 'd': strlcat(diffargs, " -d", sizeof(diffargs)); - diff_dflag = 1; + dflags |= D_MINIMAL; break; case 'D': if (date1 == -1 && rev1 == NULL) { @@ -111,7 +112,7 @@ cvs_diff(int argc, char **argv) break; case 'i': strlcat(diffargs, " -i", sizeof(diffargs)); - diff_iflag = 1; + dflags |= D_IGNORECASE; break; case 'k': koptstr = optarg; @@ -137,7 +138,7 @@ cvs_diff(int argc, char **argv) break; case 'p': strlcat(diffargs, " -p", sizeof(diffargs)); - diff_pflag = 1; + dflags |= D_PROTOTYPE; break; case 'R': flags |= CR_RECURSE_DIRS; @@ -152,6 +153,10 @@ cvs_diff(int argc, char **argv) " be specified"); } break; + case 't': + strlcat(diffargs, " -t", sizeof(diffargs)); + dflags |= D_EXPANDTABS; + break; case 'u': strlcat(diffargs, " -u", sizeof(diffargs)); diff_format = D_UNIFIED; @@ -161,7 +166,7 @@ cvs_diff(int argc, char **argv) "and should not be used"); case 'w': strlcat(diffargs, " -w", sizeof(diffargs)); - diff_wflag = 1; + dflags |= D_IGNOREBLANKS; break; default: fatal("%s", cvs_cmdop == CVS_OP_DIFF ? @@ -219,7 +224,7 @@ cvs_diff(int argc, char **argv) if (Nflag == 1) cvs_client_send_request("Argument -N"); - if (diff_pflag == 1) + if (dflags & D_PROTOTYPE) cvs_client_send_request("Argument -p"); if (rev1 != NULL) @@ -562,8 +567,8 @@ cvs_diff_local(struct cvs_file *cf) } if (cvs_diffreg(p1 != NULL ? cf->file_path : CVS_PATH_DEVNULL, - p2 != NULL ? cf->file_path : CVS_PATH_DEVNULL, fd1, fd2, NULL) - == D_ERROR) + p2 != NULL ? cf->file_path : CVS_PATH_DEVNULL, fd1, fd2, NULL, + dflags) == D_ERROR) fatal("cvs_diff_local: failed to get RCS patch"); close(fd1); diff --git a/usr.bin/cvs/diff.h b/usr.bin/cvs/diff.h index afedf4a7021..8d0fb37d330 100644 --- a/usr.bin/cvs/diff.h +++ b/usr.bin/cvs/diff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.h,v 1.18 2009/04/28 09:05:40 sthen Exp $ */ +/* $OpenBSD: diff.h,v 1.19 2009/06/06 14:17:27 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -78,6 +78,17 @@ #define D_RCSDIFF 5 /* Reverse editor output: RCS format */ /* + * Command line flags + */ +#define D_FORCEASCII 0x01 /* Treat file as ascii regardless of content */ +#define D_FOLDBLANKS 0x02 /* Treat all white space as equal */ +#define D_MINIMAL 0x04 /* Make diff as small as possible */ +#define D_IGNORECASE 0x08 /* Case-insensitive matching */ +#define D_PROTOTYPE 0x10 /* Display C function prototype */ +#define D_EXPANDTABS 0x20 /* Expand tabs to spaces */ +#define D_IGNOREBLANKS 0x40 /* Ignore white space changes */ + +/* * Status values for cvs_diffreg() return values */ #define D_SAME 0 /* Files are the same */ @@ -93,7 +104,7 @@ void cvs_merge_file(struct cvs_file *, int); void diff_output(const char *, ...); -int cvs_diffreg(const char *, const char *, int, int, BUF *); +int cvs_diffreg(const char *, const char *, int, int, BUF *, int); int ed_patch_lines(struct cvs_lines *, struct cvs_lines *); extern int diff_format; diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c index 30871960396..87fb9f329d6 100644 --- a/usr.bin/cvs/diff3.c +++ b/usr.bin/cvs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.48 2008/03/09 01:52:55 joris Exp $ */ +/* $OpenBSD: diff3.c,v 1.49 2009/06/06 14:17:27 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -72,7 +72,7 @@ static const char copyright[] = #ifndef lint static const char rcsid[] = - "$OpenBSD: diff3.c,v 1.48 2008/03/09 01:52:55 joris Exp $"; + "$OpenBSD: diff3.c,v 1.49 2009/06/06 14:17:27 ray Exp $"; #endif /* not lint */ #include <ctype.h> @@ -199,8 +199,8 @@ cvs_merge_file(struct cvs_file *cf, int verbose) cvs_printf("Retrieving revision %s\n", r2); fds[4] = rcs_rev_write_stmp(cf->file_rcs, d3rev2, path3, 0); - cvs_diffreg(path1, path3, fds[2], fds[4], d1); - cvs_diffreg(path2, path3, fds[3], fds[4], d2); + cvs_diffreg(path1, path3, fds[2], fds[4], d1, D_FORCEASCII); + cvs_diffreg(path2, path3, fds[3], fds[4], d2, D_FORCEASCII); (void)xasprintf(&dp13, "%s/d13.XXXXXXXXXX", cvs_tmpdir); fds[0] = cvs_buf_write_stmp(d1, dp13, NULL); diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c index 77fea52e6ff..1745ff32c44 100644 --- a/usr.bin/cvs/diff_internals.c +++ b/usr.bin/cvs/diff_internals.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff_internals.c,v 1.26 2009/04/28 09:05:40 sthen Exp $ */ +/* $OpenBSD: diff_internals.c,v 1.27 2009/06/06 14:17:27 ray Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -169,43 +169,37 @@ struct context_vec { int d; /* end line in new file */ }; -static void output(FILE *, FILE *); -static void check(FILE *, FILE *); +static void output(FILE *, FILE *, int); +static void check(FILE *, FILE *, int); static void range(int, int, char *); static void uni_range(int, int); -static void dump_context_vec(FILE *, FILE *); -static void dump_unified_vec(FILE *, FILE *); -static void prepare(int, FILE *, off_t); +static void dump_context_vec(FILE *, FILE *, int); +static void dump_unified_vec(FILE *, FILE *, int); +static void prepare(int, FILE *, off_t, int); static void prune(void); static void equiv(struct line *, int, struct line *, int, int *); static void unravel(int); static void unsort(struct line *, int, int *); static void diff_head(void); static void rdiff_head(void); -static void change(FILE *, FILE *, int, int, int, int); +static void change(FILE *, FILE *, int, int, int, int, int); static void sort(struct line *, int); static int ignoreline(char *); static int asciifile(FILE *); -static void fetch(long *, int, int, FILE *, int, int); +static void fetch(long *, int, int, FILE *, int, int, int); static int newcand(int, int, int); static int search(int *, int, int); static int skipline(FILE *); static int isqrt(int); -static int stone(int *, int, int *, int *); -static int readhash(FILE *); +static int stone(int *, int, int *, int *, int); +static int readhash(FILE *, int); static int files_differ(FILE *, FILE *); static char *match_function(const long *, int, FILE *); static char *preadline(int, size_t, off_t); -static int tflag, Tflag; +static int Tflag; static int context = 3; int diff_format = D_NORMAL; -int diff_aflag = 0; -int diff_bflag = 0; -int diff_dflag = 0; -int diff_iflag = 0; -int diff_pflag = 0; -int diff_wflag = 0; const char *diff_file1 = NULL; const char *diff_file2 = NULL; RCSNUM *diff_rev1 = NULL; @@ -301,7 +295,8 @@ u_char cup2low[256] = { }; int -cvs_diffreg(const char *file1, const char *file2, int _fd1, int _fd2, BUF *out) +cvs_diffreg(const char *file1, const char *file2, int _fd1, int _fd2, + BUF *out, int flags) { FILE *f1, *f2; int i, rval, fd1, fd2; @@ -314,7 +309,10 @@ cvs_diffreg(const char *file1, const char *file2, int _fd1, int _fd2, BUF *out) lastline = 0; lastmatchline = 0; context_vec_ptr = context_vec_start - 1; - chrtran = (diff_iflag ? cup2low : clow2low); + if (flags & D_IGNORECASE) + chrtran = cup2low; + else + chrtran = clow2low; if (out != NULL) diffbuf = out; @@ -364,13 +362,14 @@ cvs_diffreg(const char *file1, const char *file2, int _fd1, int _fd2, BUF *out) goto closem; } - if (!asciifile(f1) || !asciifile(f2)) { + if ((flags & D_FORCEASCII) == 0 && + (!asciifile(f1) || !asciifile(f2))) { rval = D_BINARY; goto closem; } - prepare(0, f1, stb1.st_size); - prepare(1, f2, stb2.st_size); + prepare(0, f1, stb1.st_size, flags); + prepare(1, f2, stb2.st_size, flags); prune(); sort(sfile[0], slen[0]); @@ -388,7 +387,7 @@ cvs_diffreg(const char *file1, const char *file2, int _fd1, int _fd2, BUF *out) clen = 0; clistlen = 100; clist = xcalloc(clistlen, sizeof(*clist)); - i = stone(class, slen[0], member, klist); + i = stone(class, slen[0], member, klist, flags); xfree(member); xfree(class); @@ -399,8 +398,8 @@ cvs_diffreg(const char *file1, const char *file2, int _fd1, int _fd2, BUF *out) ixold = xrealloc(ixold, len[0] + 2, sizeof(*ixold)); ixnew = xrealloc(ixnew, len[1] + 2, sizeof(*ixnew)); - check(f1, f2); - output(f1, f2); + check(f1, f2, flags); + output(f1, f2, flags); closem: if (anychange) { @@ -409,7 +408,6 @@ closem: } if (f1 != NULL) fclose(f1); - if (f2 != NULL) fclose(f2); @@ -445,7 +443,7 @@ files_differ(FILE *f1, FILE *f2) } static void -prepare(int i, FILE *fd, off_t filesize) +prepare(int i, FILE *fd, off_t filesize, int flags) { struct line *p; int j, h; @@ -458,7 +456,7 @@ prepare(int i, FILE *fd, off_t filesize) sz = 100; p = xcalloc(sz + 3, sizeof(*p)); - for (j = 0; (h = readhash(fd));) { + for (j = 0; (h = readhash(fd, flags));) { if (j == sz) { sz = sz * 3 / 2; p = xrealloc(p, sz + 3, sizeof(*p)); @@ -538,14 +536,15 @@ isqrt(int n) } static int -stone(int *a, int n, int *b, int *c) +stone(int *a, int n, int *b, int *c, int flags) { int i, k, y, j, l; int oldc, tc, oldl; u_int numtries; /* XXX move the isqrt() out of the macro to avoid multiple calls */ - const u_int bound = diff_dflag ? UINT_MAX : MAX(256, (u_int)isqrt(n)); + const u_int bound = (flags & D_MINIMAL) ? UINT_MAX : + MAX(256, (u_int)isqrt(n)); k = 0; c[0] = newcand(0, 0, 0); @@ -641,7 +640,7 @@ unravel(int p) * 2. collect random access indexes to the two files */ static void -check(FILE *f1, FILE *f2) +check(FILE *f1, FILE *f2, int flags) { int i, j, jackpot, c, d; long ctold, ctnew; @@ -661,7 +660,7 @@ check(FILE *f1, FILE *f2) ixnew[j] = ctnew += skipline(f2); j++; } - if (diff_bflag == 1 || diff_wflag == 1 || diff_iflag == 1) { + if (flags & (D_FOLDBLANKS|D_IGNOREBLANKS|D_IGNORECASE)) { for (;;) { c = getc(f1); d = getc(f2); @@ -669,14 +668,15 @@ check(FILE *f1, FILE *f2) * GNU diff ignores a missing newline * in one file for -b or -w. */ - if ((diff_bflag == 1 || diff_wflag == 1) && + if ((flags & (D_FOLDBLANKS|D_IGNOREBLANKS)) && ((c == EOF && d == '\n') || (c == '\n' && d == EOF))) { break; } ctold++; ctnew++; - if (diff_bflag == 1 && isspace(c) && isspace(d)) { + if ((flags & D_FOLDBLANKS) && isspace(c) && + isspace(d)) { do { if (c == '\n') break; @@ -687,7 +687,7 @@ check(FILE *f1, FILE *f2) break; ctnew++; } while (isspace(d = getc(f2))); - } else if (diff_wflag == 1) { + } else if ((flags & D_IGNOREBLANKS)) { while (isspace(c) && c != '\n') { c = getc(f1); ctold++; @@ -795,7 +795,7 @@ skipline(FILE *f) } static void -output(FILE *f1, FILE *f2) +output(FILE *f1, FILE *f2, int flags) { int m, i0, i1, j0, j1; @@ -813,10 +813,10 @@ output(FILE *f1, FILE *f2) i1++; j1 = J[i1 + 1] - 1; J[i1] = j1; - change(f1, f2, i0, i1, j0, j1); + change(f1, f2, i0, i1, j0, j1, flags); } if (m == 0) - change(f1, f2, 1, 0, 1, len[1]); + change(f1, f2, 1, 0, 1, len[1], flags); if (diff_format == D_IFDEF) { for (;;) { #define c i0 @@ -828,9 +828,9 @@ output(FILE *f1, FILE *f2) } if (anychange != 0) { if (diff_format == D_CONTEXT) - dump_context_vec(f1, f2); + dump_context_vec(f1, f2, flags); else if (diff_format == D_UNIFIED) - dump_unified_vec(f1, f2); + dump_unified_vec(f1, f2, flags); } } @@ -960,7 +960,7 @@ rdiff_head(void) * lines missing from the to file. */ static void -change(FILE *f1, FILE *f2, int a, int b, int c, int d) +change(FILE *f1, FILE *f2, int a, int b, int c, int d, int flags) { static size_t max_context = 64; int i; @@ -1022,9 +1022,9 @@ proceed: * previous change, dump the record and reset it. */ if (diff_format == D_CONTEXT) - dump_context_vec(f1, f2); + dump_context_vec(f1, f2, flags); else - dump_unified_vec(f1, f2); + dump_unified_vec(f1, f2, flags); } context_vec_ptr++; context_vec_ptr->a = a; @@ -1057,11 +1057,11 @@ proceed: break; } if (diff_format == D_NORMAL || diff_format == D_IFDEF) { - fetch(ixold, a, b, f1, '<', 1); + fetch(ixold, a, b, f1, '<', 1, flags); if (a <= b && c <= d && diff_format == D_NORMAL) diff_output("---\n"); } - fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0); + fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, flags); if (inifdef) { diff_output("#endif /* %s */\n", ifdefname); inifdef = 0; @@ -1069,7 +1069,7 @@ proceed: } static void -fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) +fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) { long j, nc; int i, c, col; @@ -1122,7 +1122,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) "file\n"); return; } - if (c == '\t' && tflag == 1) { + if (c == '\t' && (flags & D_EXPANDTABS)) { do { diff_output(" "); } while (++col & 7); @@ -1138,15 +1138,15 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) * Hash function taken from Robert Sedgewick, Algorithms in C, 3d ed., p 578. */ static int -readhash(FILE *f) +readhash(FILE *f, int flags) { int i, t, space; int sum; sum = 1; space = 0; - if (diff_bflag != 1 && diff_wflag != 1) { - if (diff_iflag == 1) + if ((flags & (D_FOLDBLANKS|D_IGNOREBLANKS)) == 0) { + if (flags & D_IGNORECASE) for (i = 0; (t = getc(f)) != '\n'; i++) { if (t == EOF) { if (i == 0) @@ -1175,7 +1175,7 @@ readhash(FILE *f) space++; continue; default: - if (space != 0 && diff_wflag != 1) { + if (space && (flags & D_IGNOREBLANKS) == 0) { i++; space = 0; } @@ -1205,7 +1205,7 @@ asciifile(FILE *f) unsigned char buf[BUFSIZ]; size_t i, cnt; - if (diff_aflag == 1 || f == NULL) + if (f == NULL) return (1); rewind(f); @@ -1267,7 +1267,7 @@ match_function(const long *f, int pos, FILE *fp) /* dump accumulated "context" diff changes */ static void -dump_context_vec(FILE *f1, FILE *f2) +dump_context_vec(FILE *f1, FILE *f2, int flags) { struct context_vec *cvp = context_vec_start; int lowa, upb, lowc, upd, do_output; @@ -1284,7 +1284,7 @@ dump_context_vec(FILE *f1, FILE *f2) upd = MIN(len[1], context_vec_ptr->d + context); diff_output("***************"); - if (diff_pflag == 1) { + if ((flags & D_PROTOTYPE)) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { diff_output(" "); @@ -1320,16 +1320,16 @@ dump_context_vec(FILE *f1, FILE *f2) ch = (a <= b) ? 'd' : 'a'; if (ch == 'a') - fetch(ixold, lowa, b, f1, ' ', 0); + fetch(ixold, lowa, b, f1, ' ', 0, flags); else { - fetch(ixold, lowa, a - 1, f1, ' ', 0); + fetch(ixold, lowa, a - 1, f1, ' ', 0, flags); fetch(ixold, a, b, f1, - ch == 'c' ? '!' : '-', 0); + ch == 'c' ? '!' : '-', 0, flags); } lowa = b + 1; cvp++; } - fetch(ixold, b + 1, upb, f1, ' ', 0); + fetch(ixold, b + 1, upb, f1, ' ', 0, flags); } /* output changes to the "new" file */ diff_output("--- "); @@ -1356,23 +1356,23 @@ dump_context_vec(FILE *f1, FILE *f2) ch = (a <= b) ? 'd' : 'a'; if (ch == 'd') - fetch(ixnew, lowc, d, f2, ' ', 0); + fetch(ixnew, lowc, d, f2, ' ', 0, flags); else { - fetch(ixnew, lowc, c - 1, f2, ' ', 0); + fetch(ixnew, lowc, c - 1, f2, ' ', 0, flags); fetch(ixnew, c, d, f2, - ch == 'c' ? '!' : '+', 0); + ch == 'c' ? '!' : '+', 0, flags); } lowc = d + 1; cvp++; } - fetch(ixnew, d + 1, upd, f2, ' ', 0); + fetch(ixnew, d + 1, upd, f2, ' ', 0, flags); } context_vec_ptr = context_vec_start - 1; } /* dump accumulated "unified" diff changes */ static void -dump_unified_vec(FILE *f1, FILE *f2) +dump_unified_vec(FILE *f1, FILE *f2, int flags) { struct context_vec *cvp = context_vec_start; int lowa, upb, lowc, upd; @@ -1393,7 +1393,7 @@ dump_unified_vec(FILE *f1, FILE *f2) diff_output(" +"); uni_range(lowc, upd); diff_output(" @@"); - if (diff_pflag == 1) { + if ((flags & D_PROTOTYPE)) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { diff_output(" "); @@ -1424,23 +1424,23 @@ dump_unified_vec(FILE *f1, FILE *f2) switch (ch) { case 'c': - fetch(ixold, lowa, a - 1, f1, ' ', 0); - fetch(ixold, a, b, f1, '-', 0); - fetch(ixnew, c, d, f2, '+', 0); + fetch(ixold, lowa, a - 1, f1, ' ', 0, flags); + fetch(ixold, a, b, f1, '-', 0, flags); + fetch(ixnew, c, d, f2, '+', 0, flags); break; case 'd': - fetch(ixold, lowa, a - 1, f1, ' ', 0); - fetch(ixold, a, b, f1, '-', 0); + fetch(ixold, lowa, a - 1, f1, ' ', 0, flags); + fetch(ixold, a, b, f1, '-', 0, flags); break; case 'a': - fetch(ixnew, lowc, c - 1, f2, ' ', 0); - fetch(ixnew, c, d, f2, '+', 0); + fetch(ixnew, lowc, c - 1, f2, ' ', 0, flags); + fetch(ixnew, c, d, f2, '+', 0, flags); break; } lowa = b + 1; lowc = d + 1; } - fetch(ixnew, d + 1, upd, f2, ' ', 0); + fetch(ixnew, d + 1, upd, f2, ' ', 0, flags); context_vec_ptr = context_vec_start - 1; } diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c index aa4779d6dd1..4b3ce28fb67 100644 --- a/usr.bin/cvs/import.c +++ b/usr.bin/cvs/import.c @@ -1,4 +1,4 @@ -/* $OpenBSD: import.c,v 1.98 2009/01/02 00:11:01 canacar Exp $ */ +/* $OpenBSD: import.c,v 1.99 2009/06/06 14:17:27 ray Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -473,7 +473,7 @@ import_get_rcsdiff(struct cvs_file *cf, RCSNUM *rev) fd2 = rcs_rev_write_stmp(cf->file_rcs, rev, p2, RCS_KWEXP_NONE); diff_format = D_RCSDIFF; - if (cvs_diffreg(p2, p1, fd2, fd1, b2) == D_ERROR) + if (cvs_diffreg(p2, p1, fd2, fd1, b2, D_FORCEASCII) == D_ERROR) fatal("import_get_rcsdiff: failed to get RCS patch"); close(fd1); diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index da57a21878c..00afc8215e7 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.289 2009/03/30 21:45:33 joris Exp $ */ +/* $OpenBSD: rcs.c,v 1.290 2009/06/06 14:17:27 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -1361,7 +1361,7 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev) diff_format = D_RCSDIFF; if (cvs_diffreg(path_tmp1, path_tmp2, - fd1, fd2, newdiff) == D_ERROR) + fd1, fd2, newdiff, D_FORCEASCII) == D_ERROR) fatal("rcs_diffreg failed"); close(fd1); |