diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2002-01-31 11:10:40 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2002-01-31 11:10:40 +0000 |
commit | dcaed1ff788646822c9766b540e7f0912e8ed9df (patch) | |
tree | 47af4f19f9be9b02cbd8bd9d2cc86d9c8c3de9d2 /usr.bin/vi/common/cut.c | |
parent | f6153cf2525bd3462f8042875b43b84f28cc9450 (diff) |
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 <kanaoka@ann.hi-ho.ne.jp>
: diagnosed by Bang Jun-Young <bjy@mogua.org>,
: quick-fixed by Robert Elz <kre@munnari.OZ.AU>.
Diffstat (limited to 'usr.bin/vi/common/cut.c')
-rw-r--r-- | usr.bin/vi/common/cut.c | 15 |
1 files changed, 7 insertions, 8 deletions
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; |