From 184bf0c4485793e104c9bf4074197d14c4589a6d Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Wed, 25 Feb 2009 23:16:21 +0000 Subject: Checking if a file is ASCII should only be done when diffing, because the non-ASCII characters could be printed to the screen. For checking in files, checking out files, merging files, and removing revisions of files, we do so regardless of whether the files are ASCII or binary. Fixes PR6031. OK joris and deraadt. --- usr.bin/rcs/ci.c | 4 ++-- usr.bin/rcs/co.c | 4 ++-- usr.bin/rcs/diff3.c | 12 ++++++------ usr.bin/rcs/rcs.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c index 03233c9cedc..c88f6b5536d 100644 --- a/usr.bin/rcs/ci.c +++ b/usr.bin/rcs/ci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.204 2008/03/22 21:15:54 millert Exp $ */ +/* $OpenBSD: ci.c,v 1.205 2009/02/25 23:16:20 ray Exp $ */ /* * Copyright (c) 2005, 2006 Niall O'Higgins * All rights reserved. @@ -378,7 +378,7 @@ checkin_diff_file(struct checkin_params *pb) b2 = NULL; diff_format = D_RCSDIFF; - if (diffreg(path1, path2, b3, 0) == D_ERROR) + if (diffreg(path1, path2, b3, D_FORCEASCII) == D_ERROR) goto out; return (b3); diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c index 12b62905dad..3619d149de7 100644 --- a/usr.bin/rcs/co.c +++ b/usr.bin/rcs/co.c @@ -1,4 +1,4 @@ -/* $OpenBSD: co.c,v 1.109 2007/07/03 00:56:23 ray Exp $ */ +/* $OpenBSD: co.c,v 1.110 2009/02/25 23:16:20 ray Exp $ */ /* * Copyright (c) 2005 Joris Vink * All rights reserved. @@ -550,7 +550,7 @@ checkout_file_has_diffs(RCSFILE *rfp, RCSNUM *frev, const char *dst) rcs_buf_empty(bp); diff_format = D_RCSDIFF; - ret = diffreg(dst, tempfile, bp, 0); + ret = diffreg(dst, tempfile, bp, D_FORCEASCII); rcs_buf_free(bp); unlink(tempfile); diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c index a9b5300d083..ffbc73c3dc4 100644 --- a/usr.bin/rcs/diff3.c +++ b/usr.bin/rcs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.26 2008/03/02 19:40:58 tobias Exp $ */ +/* $OpenBSD: diff3.c,v 1.27 2009/02/25 23:16:20 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.26 2008/03/02 19:40:58 tobias Exp $"; + "$OpenBSD: diff3.c,v 1.27 2009/02/25 23:16:20 ray Exp $"; #endif /* not lint */ #include @@ -199,8 +199,8 @@ merge_diff3(char **av, int flags) rcs_buf_free(b2); b2 = NULL; - if ((diffreg(path1, path3, d1, 0) == D_ERROR) || - (diffreg(path2, path3, d2, 0) == D_ERROR)) { + if ((diffreg(path1, path3, d1, D_FORCEASCII) == D_ERROR) || + (diffreg(path2, path3, d2, D_FORCEASCII) == D_ERROR)) { rcs_buf_free(diffb); diffb = NULL; goto out; @@ -326,8 +326,8 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int flags) rcs_buf_free(b2); b2 = NULL; - if ((diffreg(path1, path3, d1, 0) == D_ERROR) || - (diffreg(path2, path3, d2, 0) == D_ERROR)) { + if ((diffreg(path1, path3, d1, D_FORCEASCII) == D_ERROR) || + (diffreg(path2, path3, d2, D_FORCEASCII) == D_ERROR)) { rcs_buf_free(diffb); diffb = NULL; goto out; diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c index 9b5864ffeb3..eadf7b576c6 100644 --- a/usr.bin/rcs/rcs.c +++ b/usr.bin/rcs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.52 2009/02/15 13:40:33 joris Exp $ */ +/* $OpenBSD: rcs.c,v 1.53 2009/02/25 23:16:20 ray Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -1472,7 +1472,7 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev) rcs_buf_free(prevbuf); diff_format = D_RCSDIFF; - if (diffreg(path_tmp1, path_tmp2, newdiff, 0) == D_ERROR) + if (diffreg(path_tmp1, path_tmp2, newdiff, D_FORCEASCII) == D_ERROR) errx(1, "diffreg failed"); newdeltatext = newdiff; -- cgit v1.2.3