summaryrefslogtreecommitdiffstats
path: root/usr.bin/more
diff options
context:
space:
mode:
authorhoek <hoek@FreeBSD.org>1999-12-27 20:53:35 +0000
committerhoek <hoek@FreeBSD.org>1999-12-27 20:53:35 +0000
commit83843a44a4f7ba061906588ceae18db10c46859c (patch)
treea0c1bb9aacb4bf548ebe7afd9055ed8fc43bd3ee /usr.bin/more
parent9c7b85f0e8b2338ab49e23e4837cfbd4a58798d7 (diff)
downloadFreeBSD-src-83843a44a4f7ba061906588ceae18db10c46859c.zip
FreeBSD-src-83843a44a4f7ba061906588ceae18db10c46859c.tar.gz
Correctly maintain state when manipulating linked lists. This fixes a
bug that prevented the line-number buffer from working correctly. AFAIK the bug is still present in other derivatives of more(1).
Diffstat (limited to 'usr.bin/more')
-rw-r--r--usr.bin/more/linenum.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/more/linenum.c b/usr.bin/more/linenum.c
index dd3d82d..c0d2816 100644
--- a/usr.bin/more/linenum.c
+++ b/usr.bin/more/linenum.c
@@ -36,6 +36,11 @@
static char sccsid[] = "@(#)linenum.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
+#ifndef lint
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif /* not lint */
+
/*
* Code to handle displaying line numbers.
*
@@ -121,7 +126,7 @@ clr_linenum()
* Initialize the anchor.
*/
anchor.next = anchor.prev = &anchor;
- anchor.gap = 0;
+ anchor.gap = (off_t)0;
anchor.pos = (off_t)0;
anchor.line = 1;
}
@@ -227,8 +232,8 @@ add_lnum(line, pos)
mingap = p->gap;
}
}
- spare->next->prev = spare->prev;
- spare->prev->next = spare->next;
+ calcgap(spare->next->prev = spare->prev);
+ calcgap(spare->prev->next = spare->next);
}
}
OpenPOWER on IntegriCloud