CVS commit: src/external/bsd/nvi/dist/cl

2017-12-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Dec  6 17:16:14 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_main.c

Log Message:
When testing to see if a signal handler was previously installed in
h_winch, test sa_handler against all SIG_* actions defined in sys/signal.h
instead of just 0. Corrects an issue where vi crashes after a window is
resized.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/nvi/dist/cl/cl_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/nvi/dist/cl

2017-12-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Dec  6 17:16:14 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_main.c

Log Message:
When testing to see if a signal handler was previously installed in
h_winch, test sa_handler against all SIG_* actions defined in sys/signal.h
instead of just 0. Corrects an issue where vi crashes after a window is
resized.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/nvi/dist/cl/cl_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.8 src/external/bsd/nvi/dist/cl/cl_main.c:1.9
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.8	Mon Nov  6 03:27:34 2017
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Wed Dec  6 17:16:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.8 2017/11/06 03:27:34 rin Exp $ */
+/*	$NetBSD: cl_main.c,v 1.9 2017/12/06 17:16:14 jmcneill Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.8 2017/11/06 03:27:34 rin Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.9 2017/12/06 17:16:14 jmcneill Exp $");
 #endif
 
 #include 
@@ -314,8 +314,12 @@ h_winch(int signo)
 	F_SET(clp, CL_SIGWINCH);
 
 	/* If there was a previous handler, call that. */
-	if (clp->oact[INDX_WINCH].sa_handler)
+	if (clp->oact[INDX_WINCH].sa_handler != SIG_DFL &&
+	clp->oact[INDX_WINCH].sa_handler != SIG_IGN &&
+	clp->oact[INDX_WINCH].sa_handler != SIG_ERR &&
+	clp->oact[INDX_WINCH].sa_handler != SIG_HOLD) {
 		clp->oact[INDX_WINCH].sa_handler(signo);
+	}
 }
 #undef	GLOBAL_CLP
 



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov 13 01:37:48 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_funcs.c

Log Message:
Use ISBLANK macro instead of isblank(3).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/cl/cl_funcs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_funcs.c
diff -u src/external/bsd/nvi/dist/cl/cl_funcs.c:1.5 src/external/bsd/nvi/dist/cl/cl_funcs.c:1.6
--- src/external/bsd/nvi/dist/cl/cl_funcs.c:1.5	Sun Nov 12 15:33:03 2017
+++ src/external/bsd/nvi/dist/cl/cl_funcs.c	Mon Nov 13 01:37:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_funcs.c,v 1.5 2017/11/12 15:33:03 rin Exp $ */
+/*	$NetBSD: cl_funcs.c,v 1.6 2017/11/13 01:37:48 rin Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_funcs.c,v 10.72 2002/03/02 23:18:33 skimo Exp  (Berkeley) Date: 2002/03/02 23:18:33 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_funcs.c,v 1.5 2017/11/12 15:33:03 rin Exp $");
+__RCSID("$NetBSD: cl_funcs.c,v 1.6 2017/11/13 01:37:48 rin Exp $");
 #endif
 
 #include 
@@ -346,7 +346,7 @@ cl_deleteln(SCR *sp)
 		for (lno = RLNO(sp, LASTLINE(sp)), col = spcnt = 0;;) {
 			(void)wmove(win, lno, col);
 			ch = winch(win);
-			if (isblank(ch))
+			if (ISBLANK(ch))
 ++spcnt;
 			else {
 (void)wmove(win, lno, col - spcnt);



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov 13 01:37:48 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_funcs.c

Log Message:
Use ISBLANK macro instead of isblank(3).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/cl/cl_funcs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov 12 15:33:03 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_funcs.c

Log Message:
_POSIX_VDISABLE exceeds CHAR_MAX. We thus need to cast it to CHAR_T for the
case where USE_WIDECHAR != "yes", i.e., CHAR_T is char.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nvi/dist/cl/cl_funcs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov 12 15:33:03 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_funcs.c

Log Message:
_POSIX_VDISABLE exceeds CHAR_MAX. We thus need to cast it to CHAR_T for the
case where USE_WIDECHAR != "yes", i.e., CHAR_T is char.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nvi/dist/cl/cl_funcs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_funcs.c
diff -u src/external/bsd/nvi/dist/cl/cl_funcs.c:1.4 src/external/bsd/nvi/dist/cl/cl_funcs.c:1.5
--- src/external/bsd/nvi/dist/cl/cl_funcs.c:1.4	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/cl/cl_funcs.c	Sun Nov 12 15:33:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_funcs.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: cl_funcs.c,v 1.5 2017/11/12 15:33:03 rin Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_funcs.c,v 10.72 2002/03/02 23:18:33 skimo Exp  (Berkeley) Date: 2002/03/02 23:18:33 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_funcs.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: cl_funcs.c,v 1.5 2017/11/12 15:33:03 rin Exp $");
 #endif
 
 #include 
@@ -500,17 +500,21 @@ cl_keyval(SCR *sp, scr_keyval_t val, CHA
 	clp = CLP(sp);
 	switch (val) {
 	case KEY_VEOF:
-		*dnep = (*chp = clp->orig.c_cc[VEOF]) == _POSIX_VDISABLE;
+		*dnep =
+		(*chp = clp->orig.c_cc[VEOF]) == (CHAR_T)_POSIX_VDISABLE;
 		break;
 	case KEY_VERASE:
-		*dnep = (*chp = clp->orig.c_cc[VERASE]) == _POSIX_VDISABLE;
+		*dnep =
+		(*chp = clp->orig.c_cc[VERASE]) == (CHAR_T)_POSIX_VDISABLE;
 		break;
 	case KEY_VKILL:
-		*dnep = (*chp = clp->orig.c_cc[VKILL]) == _POSIX_VDISABLE;
+		*dnep = 
+		(*chp = clp->orig.c_cc[VKILL]) == (CHAR_T)_POSIX_VDISABLE;
 		break;
 #ifdef VWERASE
 	case KEY_VWERASE:
-		*dnep = (*chp = clp->orig.c_cc[VWERASE]) == _POSIX_VDISABLE;
+		*dnep =
+		(*chp = clp->orig.c_cc[VWERASE]) == (CHAR_T)_POSIX_VDISABLE;
 		break;
 #endif
 	default:



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 03:10:26 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_main.c

Log Message:
No need to include ip_extern.h here.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/nvi/dist/cl/cl_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.6 src/external/bsd/nvi/dist/cl/cl_main.c:1.7
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.6	Fri Sep  1 07:21:01 2017
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Mon Nov  6 03:10:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $ */
+/*	$NetBSD: cl_main.c,v 1.7 2017/11/06 03:10:26 rin Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.7 2017/11/06 03:10:26 rin Exp $");
 #endif
 
 #include 
@@ -33,7 +33,6 @@ __RCSID("$NetBSD: cl_main.c,v 1.6 2017/0
 #include 
 
 #include "../common/common.h"
-#include "ip_extern.h"
 #include "cl.h"
 #include "pathnames.h"
 



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 03:10:26 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_main.c

Log Message:
No need to include ip_extern.h here.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/nvi/dist/cl/cl_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 03:08:41 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_bsd.c

Log Message:
Remove a hack which declares tigetstr(9) in cl_extern.h.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/cl/cl_bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_bsd.c
diff -u src/external/bsd/nvi/dist/cl/cl_bsd.c:1.3 src/external/bsd/nvi/dist/cl/cl_bsd.c:1.4
--- src/external/bsd/nvi/dist/cl/cl_bsd.c:1.3	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/cl/cl_bsd.c	Mon Nov  6 03:08:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_bsd.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: cl_bsd.c,v 1.4 2017/11/06 03:08:41 rin Exp $ */
 /*-
  * Copyright (c) 1995, 1996
  *	Keith Bostic.  All rights reserved.
@@ -14,7 +14,7 @@
 static const char sccsid[] = "Id: cl_bsd.c,v 8.32 2000/12/01 13:56:17 skimo Exp  (Berkeley) Date: 2000/12/01 13:56:17 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_bsd.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: cl_bsd.c,v 1.4 2017/11/06 03:08:41 rin Exp $");
 #endif
 
 #include 
@@ -287,7 +287,9 @@ lcmp(const void *a, const void *b)
  * Try and work around the problem, since we only care about the return value.
  *
  * PUBLIC: #ifdef HAVE_CURSES_TIGETSTR
+ * PUBLIC: #if 0
  * PUBLIC: char *tigetstr __P((const char *));
+ * PUBLIC: #endif
  * PUBLIC: #else
  * PUBLIC: char *tigetstr __P((char *));
  * PUBLIC: #endif



CVS commit: src/external/bsd/nvi/dist/cl

2017-11-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Nov  6 03:08:41 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_bsd.c

Log Message:
Remove a hack which declares tigetstr(9) in cl_extern.h.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/cl/cl_bsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/nvi/dist/cl

2017-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Sep  1 07:21:01 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_main.c cl_screen.c

Log Message:
When resizing nvi in xterm, a scroll region is set with the old size
which garbles the display.

The scroll region is set for a terminfo scroll operation and then
reset to the current window size. While xterm lets you clear a
scroll region, there is no way to do this in terminfo except by
resetting the terminal which has a visual side effect.

Xterm actually clears the scroll region as part of the resize but
that happens before a program gets the SIGWINCH signal. When nvi sees
the SIGWINCH signal, it exits the vi mode using a scroll operation to
tidy up the display before it reenters vi mode with the new window size.

This patch does two things:
- make nvi also invoke a previous SIGWINCH handler (not sufficient,
  but that's how curses wants it).
- skip the tidy up in case of a restart (avoids the scroll region)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/cl/cl_main.c \
src/external/bsd/nvi/dist/cl/cl_screen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.5 src/external/bsd/nvi/dist/cl/cl_main.c:1.6
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.5	Wed Nov 25 20:25:20 2015
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Fri Sep  1 07:21:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.5 2015/11/25 20:25:20 christos Exp $ */
+/*	$NetBSD: cl_main.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.5 2015/11/25 20:25:20 christos Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $");
 #endif
 
 #include 
@@ -311,6 +311,10 @@ h_winch(int signo)
 		continue;
 
 	F_SET(clp, CL_SIGWINCH);
+
+	/* If there was a previous handler, call that. */
+	if (clp->oact[INDX_WINCH].sa_handler)
+		clp->oact[INDX_WINCH].sa_handler(signo);
 }
 #undef	GLOBAL_CLP
 
Index: src/external/bsd/nvi/dist/cl/cl_screen.c
diff -u src/external/bsd/nvi/dist/cl/cl_screen.c:1.5 src/external/bsd/nvi/dist/cl/cl_screen.c:1.6
--- src/external/bsd/nvi/dist/cl/cl_screen.c:1.5	Wed Nov 25 20:25:20 2015
+++ src/external/bsd/nvi/dist/cl/cl_screen.c	Fri Sep  1 07:21:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_screen.c,v 1.5 2015/11/25 20:25:20 christos Exp $ */
+/*	$NetBSD: cl_screen.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp  (Berkeley) Date: 2002/05/03 19:59:44 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_screen.c,v 1.5 2015/11/25 20:25:20 christos Exp $");
+__RCSID("$NetBSD: cl_screen.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $");
 #endif
 
 #include 
@@ -430,7 +430,7 @@ cl_vi_end(GS *gp)
 	 * Move to the bottom of the window (some endwin implementations don't
 	 * do this for you).
 	 */
-	if (!F_ISSET(clp, CL_IN_EX)) {
+	if (!F_ISSET(clp, CL_IN_EX) && !F_ISSET(gp, G_SRESTART)) {
 		(void)move(0, 0);
 		(void)deleteln();
 		(void)move(LINES - 1, 0);



CVS commit: src/external/bsd/nvi/dist/cl

2017-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Sep  1 07:21:01 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl: cl_main.c cl_screen.c

Log Message:
When resizing nvi in xterm, a scroll region is set with the old size
which garbles the display.

The scroll region is set for a terminfo scroll operation and then
reset to the current window size. While xterm lets you clear a
scroll region, there is no way to do this in terminfo except by
resetting the terminal which has a visual side effect.

Xterm actually clears the scroll region as part of the resize but
that happens before a program gets the SIGWINCH signal. When nvi sees
the SIGWINCH signal, it exits the vi mode using a scroll operation to
tidy up the display before it reenters vi mode with the new window size.

This patch does two things:
- make nvi also invoke a previous SIGWINCH handler (not sufficient,
  but that's how curses wants it).
- skip the tidy up in case of a restart (avoids the scroll region)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/cl/cl_main.c \
src/external/bsd/nvi/dist/cl/cl_screen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.