diff --git a/contrib/nvi/vi/vs_relative.c b/contrib/nvi/vi/vs_relative.c index c92c10c43e2e..878fc4f944ad 100644 --- a/contrib/nvi/vi/vs_relative.c +++ b/contrib/nvi/vi/vs_relative.c @@ -111,6 +111,15 @@ vs_columns(sp, lp, lno, cnop, diffp) 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); @@ -122,7 +131,7 @@ vs_columns(sp, lp, lno, cnop, diffp) 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 @@ done: if (diffp != NULL) /* XXX */ 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' && \