From dcaed1ff788646822c9766b540e7f0912e8ed9df Mon Sep 17 00:00:00 2001 From: Hugh Graham Date: Thu, 31 Jan 2002 11:10:40 +0000 Subject: Bugfix picked up from NetBSD, and checked by pval: : date: 2001/10/20 10:04:50; author: aymeric : Fix a cut_line() caller not using the right value for (former) ENTIRE_LINE, : by defining the (newer) CUT_LINE_TO_EOL define in common/cut.h and using it : where due. : Bug reported on current-users by Masanori Kanaoka : diagnosed by Bang Jun-Young , : quick-fixed by Robert Elz . --- usr.bin/vi/common/cut.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'usr.bin/vi/common/cut.c') diff --git a/usr.bin/vi/common/cut.c b/usr.bin/vi/common/cut.c index 2d4dd7c39e2..b952db5e334 100644 --- a/usr.bin/vi/common/cut.c +++ b/usr.bin/vi/common/cut.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cut.c,v 1.5 2001/09/19 02:43:19 pvalchev Exp $ */ +/* $OpenBSD: cut.c,v 1.6 2002/01/31 11:10:39 hugh Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -138,25 +138,24 @@ copyloop: } -#define ENTIRE_LINE -1 /* In line mode, it's pretty easy, just cut the lines. */ if (LF_ISSET(CUT_LINEMODE)) { cbp->flags |= CB_LMODE; for (lno = fm->lno; lno <= tm->lno; ++lno) - if (cut_line(sp, lno, 0, ENTIRE_LINE, cbp)) + if (cut_line(sp, lno, 0, CUT_LINE_TO_EOL, cbp)) goto cut_line_err; } else { /* - * Get the first line. A length of ENTIRE_LINE causes cut_line - * to cut from the MARK to the end of the line. + * Get the first line. A length of CUT_LINE_TO_EOL causes + * cut_line() to cut from the MARK to the end of the line. */ if (cut_line(sp, fm->lno, fm->cno, fm->lno != tm->lno ? - ENTIRE_LINE : (tm->cno - fm->cno) + 1, cbp)) + CUT_LINE_TO_EOL : (tm->cno - fm->cno) + 1, cbp)) goto cut_line_err; /* Get the intermediate lines. */ for (lno = fm->lno; ++lno < tm->lno;) - if (cut_line(sp, lno, 0, ENTIRE_LINE, cbp)) + if (cut_line(sp, lno, 0, CUT_LINE_TO_EOL, cbp)) goto cut_line_err; /* Get the last line. */ @@ -266,7 +265,7 @@ cut_line(sp, lno, fcno, clen, cbp) * copy the portion we want, and reset the TEXT length. */ if (len != 0) { - if (clen == ENTIRE_LINE) + if (clen == CUT_LINE_TO_EOL) clen = len - fcno; memcpy(tp->lb, p + fcno, clen); tp->len = clen; -- cgit v1.2.3