summaryrefslogtreecommitdiffstats
path: root/editors/nvi-devel/files/patch-vi-relative
blob: 735dc464c03dc06c1523311b687dac70c34d227a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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' &&			\
OpenPOWER on IntegriCloud