# Vendor patch to fix FreeBSD PR 28687.

diff -ru nvi-1.81.4.orig/vi/vs_relative.c nvi-1.81.4/vi/vs_relative.c
--- nvi-1.81.4.orig/vi/vs_relative.c	Wed Jul 19 10:05:20 2000
+++ nvi-1.81.4/vi/vs_relative.c	Mon Jul  9 15:26:39 2001
@@ -10,7 +10,7 @@
 #include "config.h"
 
 #ifndef lint
-static const char sccsid[] = "$Id: vs_relative.c,v 10.16 2000/07/19 17:05:20 skimo Exp $ (Berkeley) $Date: 2000/07/19 17:05:20 $";
+static const char sccsid[] = "$Id: vs_relative.c,v 10.18 2001/07/08 13:02:48 skimo Exp $ (Berkeley) $Date: 2001/07/08 13:02:48 $";
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -111,6 +111,15 @@
 	int ch, leftright, listset;
 	CHAR_T *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);
@@ -122,7 +131,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. */
@@ -130,15 +139,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 = *(UCHAR_T *)p++) == '\t' &&			\
