Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vi/vi Finally apply a fix from nvi 1.81.x to replace...
details: https://anonhg.NetBSD.org/src/rev/b20b937df6ca
branches: trunk
changeset: 519241:b20b937df6ca
user: aymeric <aymeric%NetBSD.org@localhost>
date: Thu Dec 13 20:51:36 2001 +0000
description:
Finally apply a fix from nvi 1.81.x to replace a fix committed by
Simon Burge which came from the Debian project.
This is still not TRT, but it's correct, and it gets us closer to future
versions of nvi.
I'll do ART (A Right Thing) when I have time... That's why I'm committing
this now. :-/
This fixes FreeBSD PR#23912
diffstat:
usr.bin/vi/vi/vs_relative.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diffs (52 lines):
diff -r 33132bb755b3 -r b20b937df6ca usr.bin/vi/vi/vs_relative.c
--- a/usr.bin/vi/vi/vs_relative.c Thu Dec 13 20:41:05 2001 +0000
+++ b/usr.bin/vi/vi/vs_relative.c Thu Dec 13 20:51:36 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vs_relative.c,v 1.2 1998/01/09 08:08:53 perry Exp $ */
+/* $NetBSD: vs_relative.c,v 1.3 2001/12/13 20:51:36 aymeric Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -113,6 +113,15 @@
int ch, leftright, listset;
char *p;
+ /*
+ * Initialize the screen offset.
+ */
+ scno = 0;
+
+ /* Leading number if O_NUMBER option set. */
+ if (O_ISSET(sp, O_NUMBER))
+ scno += O_NUMBER_LENGTH;
+
/* Need the line to go any further. */
if (lp == NULL) {
(void)db_get(sp, lno, 0, &lp, &len);
@@ -124,7 +133,7 @@
if (lp == NULL) {
done: if (diffp != NULL) /* XXX */
*diffp = 0;
- return (0);
+ return scno;
}
/* Store away the values of the list and leftright edit options. */
@@ -132,15 +141,10 @@
leftright = O_ISSET(sp, O_LEFTRIGHT);
/*
- * Initialize the pointer into the buffer and screen and current
- * offsets.
+ * Initialize the pointer into the buffer and current offset.
*/
p = lp;
- curoff = scno = 0;
-
- /* Leading number if O_NUMBER option set. */
- if (O_ISSET(sp, O_NUMBER))
- scno += O_NUMBER_LENGTH;
+ curoff = 0;
/* Macro to return the display length of any signal character. */
#define CHLEN(val) (ch = *(u_char *)p++) == '\t' && \
Home |
Main Index |
Thread Index |
Old Index