svn commit: r281373 - in head: contrib/nvi contrib/nvi/catalog contrib/nvi/cl contrib/nvi/common contrib/nvi/docs contrib/nvi/docs/USD.doc contrib/nvi/docs/internals contrib/nvi/docs/interp contrib...
Baptiste Daroussin
bapt at FreeBSD.org
Fri Apr 10 17:50:33 UTC 2015
Author: bapt
Date: Fri Apr 10 17:50:28 2015
New Revision: 281373
URL: https://svnweb.freebsd.org/changeset/base/281373
Log:
Update nvi to 2.1.3 which fixes the data corruption when locale conversion
failed
Added:
head/contrib/nvi/docs/man/
- copied from r281368, vendor/nvi/dist/docs/man/
Deleted:
head/contrib/nvi/catalog/spell.ok
head/contrib/nvi/docs/TODO
head/contrib/nvi/docs/USD.doc/
head/contrib/nvi/docs/changelog
head/contrib/nvi/docs/ev
head/contrib/nvi/docs/features
head/contrib/nvi/docs/help
head/contrib/nvi/docs/internals/
head/contrib/nvi/docs/interp/
head/contrib/nvi/docs/spell.ok
head/contrib/nvi/docs/tutorial/
Modified:
head/contrib/nvi/README
head/contrib/nvi/catalog/dump.c
head/contrib/nvi/cl/cl.h
head/contrib/nvi/cl/cl_funcs.c
head/contrib/nvi/cl/cl_main.c
head/contrib/nvi/cl/cl_read.c
head/contrib/nvi/cl/cl_screen.c
head/contrib/nvi/cl/cl_term.c
head/contrib/nvi/cl/extern.h
head/contrib/nvi/common/common.h
head/contrib/nvi/common/conv.c
head/contrib/nvi/common/cut.c
head/contrib/nvi/common/delete.c
head/contrib/nvi/common/encoding.c
head/contrib/nvi/common/exf.c
head/contrib/nvi/common/extern.h
head/contrib/nvi/common/gs.h
head/contrib/nvi/common/key.c
head/contrib/nvi/common/line.c
head/contrib/nvi/common/log.c
head/contrib/nvi/common/main.c
head/contrib/nvi/common/mark.c
head/contrib/nvi/common/msg.c
head/contrib/nvi/common/options.c
head/contrib/nvi/common/options.h
head/contrib/nvi/common/options_f.c
head/contrib/nvi/common/put.c
head/contrib/nvi/common/recover.c
head/contrib/nvi/common/screen.c
head/contrib/nvi/common/search.c
head/contrib/nvi/common/seq.c
head/contrib/nvi/common/util.c
head/contrib/nvi/ex/ex.c
head/contrib/nvi/ex/ex.h
head/contrib/nvi/ex/ex_abbrev.c
head/contrib/nvi/ex/ex_append.c
head/contrib/nvi/ex/ex_args.c
head/contrib/nvi/ex/ex_argv.c
head/contrib/nvi/ex/ex_at.c
head/contrib/nvi/ex/ex_bang.c
head/contrib/nvi/ex/ex_cd.c
head/contrib/nvi/ex/ex_cscope.c
head/contrib/nvi/ex/ex_delete.c
head/contrib/nvi/ex/ex_display.c
head/contrib/nvi/ex/ex_edit.c
head/contrib/nvi/ex/ex_equal.c
head/contrib/nvi/ex/ex_file.c
head/contrib/nvi/ex/ex_filter.c
head/contrib/nvi/ex/ex_global.c
head/contrib/nvi/ex/ex_init.c
head/contrib/nvi/ex/ex_join.c
head/contrib/nvi/ex/ex_map.c
head/contrib/nvi/ex/ex_mark.c
head/contrib/nvi/ex/ex_mkexrc.c
head/contrib/nvi/ex/ex_move.c
head/contrib/nvi/ex/ex_open.c
head/contrib/nvi/ex/ex_preserve.c
head/contrib/nvi/ex/ex_print.c
head/contrib/nvi/ex/ex_put.c
head/contrib/nvi/ex/ex_quit.c
head/contrib/nvi/ex/ex_read.c
head/contrib/nvi/ex/ex_screen.c
head/contrib/nvi/ex/ex_script.c
head/contrib/nvi/ex/ex_set.c
head/contrib/nvi/ex/ex_shell.c
head/contrib/nvi/ex/ex_shift.c
head/contrib/nvi/ex/ex_source.c
head/contrib/nvi/ex/ex_stop.c
head/contrib/nvi/ex/ex_subst.c
head/contrib/nvi/ex/ex_tag.c
head/contrib/nvi/ex/ex_txt.c
head/contrib/nvi/ex/ex_undo.c
head/contrib/nvi/ex/ex_usage.c
head/contrib/nvi/ex/ex_util.c
head/contrib/nvi/ex/ex_version.c
head/contrib/nvi/ex/ex_visual.c
head/contrib/nvi/ex/ex_write.c
head/contrib/nvi/ex/ex_yank.c
head/contrib/nvi/ex/ex_z.c
head/contrib/nvi/ex/extern.h
head/contrib/nvi/ex/version.h
head/contrib/nvi/regex/COPYRIGHT
head/contrib/nvi/regex/cclass.h
head/contrib/nvi/regex/cname.h
head/contrib/nvi/regex/engine.c
head/contrib/nvi/regex/re_format.7
head/contrib/nvi/regex/regcomp.c
head/contrib/nvi/regex/regerror.c
head/contrib/nvi/regex/regex.3
head/contrib/nvi/regex/regex.h
head/contrib/nvi/regex/regex2.h
head/contrib/nvi/regex/regexec.c
head/contrib/nvi/regex/regfree.c
head/contrib/nvi/regex/utils.h
head/contrib/nvi/vi/extern.h
head/contrib/nvi/vi/getc.c
head/contrib/nvi/vi/v_at.c
head/contrib/nvi/vi/v_ch.c
head/contrib/nvi/vi/v_delete.c
head/contrib/nvi/vi/v_ex.c
head/contrib/nvi/vi/v_increment.c
head/contrib/nvi/vi/v_init.c
head/contrib/nvi/vi/v_itxt.c
head/contrib/nvi/vi/v_left.c
head/contrib/nvi/vi/v_mark.c
head/contrib/nvi/vi/v_match.c
head/contrib/nvi/vi/v_paragraph.c
head/contrib/nvi/vi/v_put.c
head/contrib/nvi/vi/v_redraw.c
head/contrib/nvi/vi/v_replace.c
head/contrib/nvi/vi/v_right.c
head/contrib/nvi/vi/v_screen.c
head/contrib/nvi/vi/v_scroll.c
head/contrib/nvi/vi/v_search.c
head/contrib/nvi/vi/v_section.c
head/contrib/nvi/vi/v_sentence.c
head/contrib/nvi/vi/v_status.c
head/contrib/nvi/vi/v_txt.c
head/contrib/nvi/vi/v_ulcase.c
head/contrib/nvi/vi/v_undo.c
head/contrib/nvi/vi/v_util.c
head/contrib/nvi/vi/v_word.c
head/contrib/nvi/vi/v_xchar.c
head/contrib/nvi/vi/v_yank.c
head/contrib/nvi/vi/v_z.c
head/contrib/nvi/vi/v_zexit.c
head/contrib/nvi/vi/vi.c
head/contrib/nvi/vi/vi.h
head/contrib/nvi/vi/vs_line.c
head/contrib/nvi/vi/vs_msg.c
head/contrib/nvi/vi/vs_refresh.c
head/contrib/nvi/vi/vs_relative.c
head/contrib/nvi/vi/vs_smap.c
head/contrib/nvi/vi/vs_split.c
head/usr.bin/vi/Makefile
Directory Properties:
head/contrib/nvi/ (props changed)
Modified: head/contrib/nvi/README
==============================================================================
--- head/contrib/nvi/README Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/README Fri Apr 10 17:50:28 2015 (r281373)
@@ -1,6 +1,6 @@
-# $Id: README,v 9.1 2013/11/02 02:50:23 zy Exp $
+# $Id: README,v 9.2 2015/04/08 17:18:56 zy Exp $
-This is version 2.1.2 (2012-11-02) of nex/nvi, a reimplementation of the ex/vi
+This is version 2.1.3 (2015-04-08) of nex/nvi, a reimplementation of the ex/vi
text editors originally distributed as part of the Fourth Berkeley
Software Distribution (4BSD), by the University of California, Berkeley.
Modified: head/contrib/nvi/catalog/dump.c
==============================================================================
--- head/contrib/nvi/catalog/dump.c Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/catalog/dump.c Fri Apr 10 17:50:28 2015 (r281373)
@@ -10,11 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,12 +28,6 @@
*/
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1992, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
static char sccsid[] = "@(#)dump.c 8.1 (Berkeley) 8/31/94";
#endif /* not lint */
@@ -45,8 +35,7 @@ static char sccsid[] = "@(#)dump.c 8.1 (
#include <stdio.h>
static void
-parse(fp)
- FILE *fp;
+parse(FILE *fp)
{
int ch, s1, s2, s3;
@@ -96,9 +85,7 @@ parse(fp)
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
FILE *fp;
Modified: head/contrib/nvi/cl/cl.h
==============================================================================
--- head/contrib/nvi/cl/cl.h Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/cl/cl.h Fri Apr 10 17:50:28 2015 (r281373)
@@ -80,16 +80,4 @@ typedef enum { INP_OK=0, INP_EOF, INP_ER
#define RCNO(sp, cno) (cno)
#define RLNO(sp, lno) (lno)
-/*
- * XXX
- * Some implementations of curses.h don't define these for us. Used for
- * compatibility only.
- */
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
#include "extern.h"
Modified: head/contrib/nvi/cl/cl_funcs.c
==============================================================================
--- head/contrib/nvi/cl/cl_funcs.c Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/cl/cl_funcs.c Fri Apr 10 17:50:28 2015 (r281373)
@@ -33,7 +33,7 @@ static const char sccsid[] = "$Id: cl_fu
#include "../vi/vi.h"
#include "cl.h"
-static void cl_rdiv __P((SCR *));
+static void cl_rdiv(SCR *);
static int
addstr4(SCR *sp, void *str, size_t len, int wide)
@@ -76,31 +76,31 @@ addstr4(SCR *sp, void *str, size_t len,
* cl_waddstr --
* Add len bytes from the string at the cursor, advancing the cursor.
*
- * PUBLIC: int cl_waddstr __P((SCR *, const CHAR_T *, size_t));
+ * PUBLIC: int cl_waddstr(SCR *, const CHAR_T *, size_t);
*/
int
cl_waddstr(SCR *sp, const CHAR_T *str, size_t len)
{
- return addstr4(sp, (void *)str, len, 1);
+ return addstr4(sp, (void *)str, len, 1);
}
/*
* cl_addstr --
* Add len bytes from the string at the cursor, advancing the cursor.
*
- * PUBLIC: int cl_addstr __P((SCR *, const char *, size_t));
+ * PUBLIC: int cl_addstr(SCR *, const char *, size_t);
*/
int
cl_addstr(SCR *sp, const char *str, size_t len)
{
- return addstr4(sp, (void *)str, len, 0);
+ return addstr4(sp, (void *)str, len, 0);
}
/*
* cl_attr --
* Toggle a screen attribute on/off.
*
- * PUBLIC: int cl_attr __P((SCR *, scr_attr_t, int));
+ * PUBLIC: int cl_attr(SCR *, scr_attr_t, int);
*/
int
cl_attr(SCR *sp, scr_attr_t attribute, int on)
@@ -187,7 +187,7 @@ cl_attr(SCR *sp, scr_attr_t attribute, i
* cl_baud --
* Return the baud rate.
*
- * PUBLIC: int cl_baud __P((SCR *, u_long *));
+ * PUBLIC: int cl_baud(SCR *, u_long *);
*/
int
cl_baud(SCR *sp, u_long *ratep)
@@ -228,7 +228,7 @@ cl_baud(SCR *sp, u_long *ratep)
* cl_bell --
* Ring the bell/flash the screen.
*
- * PUBLIC: int cl_bell __P((SCR *));
+ * PUBLIC: int cl_bell(SCR *);
*/
int
cl_bell(SCR *sp)
@@ -252,7 +252,7 @@ cl_bell(SCR *sp)
* cl_clrtoeol --
* Clear from the current cursor to the end of the line.
*
- * PUBLIC: int cl_clrtoeol __P((SCR *));
+ * PUBLIC: int cl_clrtoeol(SCR *);
*/
int
cl_clrtoeol(SCR *sp)
@@ -281,7 +281,7 @@ cl_clrtoeol(SCR *sp)
* cl_cursor --
* Return the current cursor position.
*
- * PUBLIC: int cl_cursor __P((SCR *, size_t *, size_t *));
+ * PUBLIC: int cl_cursor(SCR *, size_t *, size_t *);
*/
int
cl_cursor(SCR *sp, size_t *yp, size_t *xp)
@@ -307,7 +307,7 @@ cl_cursor(SCR *sp, size_t *yp, size_t *x
* cl_deleteln --
* Delete the current line, scrolling all lines below it.
*
- * PUBLIC: int cl_deleteln __P((SCR *));
+ * PUBLIC: int cl_deleteln(SCR *);
*/
int
cl_deleteln(SCR *sp)
@@ -344,7 +344,7 @@ cl_deleteln(SCR *sp)
* cl_discard --
* Discard a screen.
*
- * PUBLIC: int cl_discard __P((SCR *, SCR **));
+ * PUBLIC: int cl_discard(SCR *, SCR **);
*/
int
cl_discard(SCR *discardp, SCR **acquirep)
@@ -385,7 +385,7 @@ cl_discard(SCR *discardp, SCR **acquirep
* Adjust the screen for ex. This routine is purely for standalone
* ex programs. All special purpose, all special case.
*
- * PUBLIC: int cl_ex_adjust __P((SCR *, exadj_t));
+ * PUBLIC: int cl_ex_adjust(SCR *, exadj_t);
*/
int
cl_ex_adjust(SCR *sp, exadj_t action)
@@ -440,7 +440,7 @@ cl_ex_adjust(SCR *sp, exadj_t action)
* cl_insertln --
* Push down the current line, discarding the bottom line.
*
- * PUBLIC: int cl_insertln __P((SCR *));
+ * PUBLIC: int cl_insertln(SCR *);
*/
int
cl_insertln(SCR *sp)
@@ -458,7 +458,7 @@ cl_insertln(SCR *sp)
* cl_keyval --
* Return the value for a special key.
*
- * PUBLIC: int cl_keyval __P((SCR *, scr_keyval_t, CHAR_T *, int *));
+ * PUBLIC: int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *);
*/
int
cl_keyval(SCR *sp, scr_keyval_t val, CHAR_T *chp, int *dnep)
@@ -496,7 +496,7 @@ cl_keyval(SCR *sp, scr_keyval_t val, CHA
* cl_move --
* Move the cursor.
*
- * PUBLIC: int cl_move __P((SCR *, size_t, size_t));
+ * PUBLIC: int cl_move(SCR *, size_t, size_t);
*/
int
cl_move(SCR *sp, size_t lno, size_t cno)
@@ -516,7 +516,7 @@ cl_move(SCR *sp, size_t lno, size_t cno)
* cl_refresh --
* Refresh the screen.
*
- * PUBLIC: int cl_refresh __P((SCR *, int));
+ * PUBLIC: int cl_refresh(SCR *, int);
*/
int
cl_refresh(SCR *sp, int repaint)
@@ -599,7 +599,7 @@ cl_rdiv(SCR *sp)
* cl_rename --
* Rename the file.
*
- * PUBLIC: int cl_rename __P((SCR *, char *, int));
+ * PUBLIC: int cl_rename(SCR *, char *, int);
*/
int
cl_rename(SCR *sp, char *name, int on)
@@ -621,7 +621,7 @@ cl_rename(SCR *sp, char *name, int on)
if (on) {
clp->focus = sp;
if (!F_ISSET(clp, CL_RENAME_OK) ||
- strncmp(OG_STR(gp, GO_TERM), "xterm", 5))
+ strncmp(OG_STR(gp, GO_TERM), "xterm", 5))
return (0);
if (clp->oname == NULL && (wid = getenv("WINDOWID"))) {
@@ -654,7 +654,7 @@ rename: cl_setname(gp, name);
* cl_setname --
* Set a X11 icon/window name.
*
- * PUBLIC: void cl_setname __P((GS *, char *));
+ * PUBLIC: void cl_setname(GS *, char *);
*/
void
cl_setname(GS *gp, char *name)
@@ -671,7 +671,7 @@ cl_setname(GS *gp, char *name)
* cl_split --
* Split a screen.
*
- * PUBLIC: int cl_split __P((SCR *, SCR *));
+ * PUBLIC: int cl_split(SCR *, SCR *);
*/
int
cl_split(SCR *origp, SCR *newp)
@@ -697,7 +697,7 @@ cl_split(SCR *origp, SCR *newp)
* cl_suspend --
* Suspend a screen.
*
- * PUBLIC: int cl_suspend __P((SCR *, int *));
+ * PUBLIC: int cl_suspend(SCR *, int *);
*/
int
cl_suspend(SCR *sp, int *allowedp)
@@ -825,7 +825,7 @@ cl_suspend(SCR *sp, int *allowedp)
* cl_usage --
* Print out the curses usage messages.
*
- * PUBLIC: void cl_usage __P((void));
+ * PUBLIC: void cl_usage(void);
*/
void
cl_usage(void)
Modified: head/contrib/nvi/cl/cl_main.c
==============================================================================
--- head/contrib/nvi/cl/cl_main.c Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/cl/cl_main.c Fri Apr 10 17:50:28 2015 (r281373)
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: cl_main.c,v 10.55 2011/08/15 19:52:28 zy Exp $";
+static const char sccsid[] = "$Id: cl_main.c,v 10.56 2015/04/05 06:20:53 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -36,20 +36,20 @@ static const char sccsid[] = "$Id: cl_ma
GS *__global_list; /* GLOBAL: List of screens. */
sigset_t __sigblockset; /* GLOBAL: Blocked signals. */
-static void cl_func_std __P((GS *));
-static CL_PRIVATE *cl_init __P((GS *));
-static GS *gs_init __P((char *));
-static void perr __P((char *, char *));
-static int setsig __P((int, struct sigaction *, void (*)(int)));
-static void sig_end __P((GS *));
-static void term_init __P((char *, char *));
+static void cl_func_std(GS *);
+static CL_PRIVATE *cl_init(GS *);
+static GS *gs_init(char *);
+static void perr(char *, char *);
+static int setsig(int, struct sigaction *, void (*)(int));
+static void sig_end(GS *);
+static void term_init(char *, char *);
/*
* main --
* This is the main loop for the standalone curses editor.
*/
int
-main(int argc, char **argv)
+main(int argc, char *argv[])
{
static int reenter;
CL_PRIVATE *clp;
@@ -92,7 +92,7 @@ main(int argc, char **argv)
* have to use termcap/terminfo to find out how big the screen is.
*/
if ((ttype = getenv("TERM")) == NULL)
- ttype = "unknown";
+ ttype = "ansi";
term_init(gp->progname, ttype);
/* Add the terminal type to the global structure. */
@@ -146,7 +146,7 @@ main(int argc, char **argv)
}
/* Free the global and CL private areas. */
-#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
+#if defined(DEBUG) || defined(PURIFY)
if (clp->oname != NULL)
free(clp->oname);
free(clp);
@@ -292,7 +292,7 @@ h_winch(int signo)
* sig_init --
* Initialize signals.
*
- * PUBLIC: int sig_init __P((GS *, SCR *));
+ * PUBLIC: int sig_init(GS *, SCR *);
*/
int
sig_init(GS *gp, SCR *sp)
@@ -337,7 +337,7 @@ sig_init(GS *gp, SCR *sp)
* Set a signal handler.
*/
static int
-setsig(int signo, struct sigaction *oactp, void (*handler) (int))
+setsig(int signo, struct sigaction *oactp, void (*handler)(int))
{
struct sigaction act;
@@ -345,21 +345,12 @@ setsig(int signo, struct sigaction *oact
* Use sigaction(2), not signal(3), since we don't always want to
* restart system calls. The example is when waiting for a command
* mode keystroke and SIGWINCH arrives. Besides, you can't portably
- * restart system calls (thanks, POSIX!). On the other hand, you
- * can't portably NOT restart system calls (thanks, Sun!). SunOS
- * used SA_INTERRUPT as their extension to NOT restart read calls.
- * We sure hope nobody else used it for anything else. Mom told me
- * there'd be days like this. She just never told me that there'd
- * be so many.
+ * restart system calls (thanks, POSIX!).
*/
act.sa_handler = handler;
sigemptyset(&act.sa_mask);
-#ifdef SA_INTERRUPT
- act.sa_flags = SA_INTERRUPT;
-#else
act.sa_flags = 0;
-#endif
return (sigaction(signo, &act, oactp));
}
Modified: head/contrib/nvi/cl/cl_read.c
==============================================================================
--- head/contrib/nvi/cl/cl_read.c Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/cl/cl_read.c Fri Apr 10 17:50:28 2015 (r281373)
@@ -35,15 +35,15 @@ static const char sccsid[] = "$Id: cl_re
#undef columns
#undef lines
-static input_t cl_read __P((SCR *,
- u_int32_t, char *, size_t, int *, struct timeval *));
-static int cl_resize __P((SCR *, size_t, size_t));
+static input_t cl_read(SCR *,
+ u_int32_t, char *, size_t, int *, struct timeval *);
+static int cl_resize(SCR *, size_t, size_t);
/*
* cl_event --
* Return a single event.
*
- * PUBLIC: int cl_event __P((SCR *, EVENT *, u_int32_t, int));
+ * PUBLIC: int cl_event(SCR *, EVENT *, u_int32_t, int);
*/
int
cl_event(SCR *sp, EVENT *evp, u_int32_t flags, int ms)
@@ -143,7 +143,8 @@ read:
* Read characters from the input.
*/
static input_t
-cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp, struct timeval *tp)
+cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp,
+ struct timeval *tp)
{
struct termios term1, term2;
CL_PRIVATE *clp;
Modified: head/contrib/nvi/cl/cl_screen.c
==============================================================================
--- head/contrib/nvi/cl/cl_screen.c Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/cl/cl_screen.c Fri Apr 10 17:50:28 2015 (r281373)
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp $";
+static const char sccsid[] = "$Id: cl_screen.c,v 10.58 2015/04/08 02:12:11 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -32,18 +32,18 @@ static const char sccsid[] = "$Id: cl_sc
#include "../common/common.h"
#include "cl.h"
-static int cl_ex_end __P((GS *));
-static int cl_ex_init __P((SCR *));
-static void cl_freecap __P((CL_PRIVATE *));
-static int cl_vi_end __P((GS *));
-static int cl_vi_init __P((SCR *));
-static int cl_putenv __P((char *, char *, u_long));
+static int cl_ex_end(GS *);
+static int cl_ex_init(SCR *);
+static void cl_freecap(CL_PRIVATE *);
+static int cl_vi_end(GS *);
+static int cl_vi_init(SCR *);
+static int cl_putenv(char *, char *, u_long);
/*
* cl_screen --
* Switch screen types.
*
- * PUBLIC: int cl_screen __P((SCR *, u_int32_t));
+ * PUBLIC: int cl_screen(SCR *, u_int32_t);
*/
int
cl_screen(SCR *sp, u_int32_t flags)
@@ -58,11 +58,9 @@ cl_screen(SCR *sp, u_int32_t flags)
/* See if the current information is incorrect. */
if (F_ISSET(gp, G_SRESTART)) {
- if (CLSP(sp)) {
- delwin(CLSP(sp));
- sp->cl_private = NULL;
- }
- if (cl_quit(gp))
+ if ((!F_ISSET(sp, SC_SCR_EX | SC_SCR_VI) ||
+ resizeterm(O_VAL(sp, O_LINES), O_VAL(sp, O_COLUMNS))) &&
+ cl_quit(gp))
return (1);
F_CLR(gp, G_SRESTART);
}
@@ -131,7 +129,7 @@ cl_screen(SCR *sp, u_int32_t flags)
* cl_quit --
* Shutdown the screens.
*
- * PUBLIC: int cl_quit __P((GS *));
+ * PUBLIC: int cl_quit(GS *);
*/
int
cl_quit(GS *gp)
@@ -234,20 +232,15 @@ cl_vi_init(SCR *sp)
cl_putenv("COLUMNS", NULL, (u_long)O_VAL(sp, O_COLUMNS));
/*
- * We don't care about the SCREEN reference returned by newterm, we
- * never have more than one SCREEN at a time.
- *
- * XXX
- * The SunOS initscr() can't be called twice. Don't even think about
- * using it. It fails in subtle ways (e.g. select(2) on fileno(stdin)
- * stops working). (The SVID notes that applications should only call
- * initscr() once.)
- *
- * XXX
- * The HP/UX newterm doesn't support the NULL first argument, so we
- * have to specify the terminal type.
+ * The terminal is aways initialized, either in `main`, or by a
+ * previous call to newterm(3X).
*/
(void)del_curterm(cur_term);
+
+ /*
+ * We never have more than one SCREEN at a time, so set_term(NULL) will
+ * give us the last SCREEN.
+ */
errno = 0;
if (newterm(ttype, stdout, stdin) == NULL) {
if (errno)
@@ -416,6 +409,9 @@ cl_vi_end(GS *gp)
/* End curses window. */
(void)endwin();
+ /* Free the SCREEN created by newterm(3X). */
+ delscreen(set_term(NULL));
+
/*
* XXX
* The screen TE sequence just got sent. See the comment in
@@ -520,7 +516,7 @@ cl_ex_end(GS *gp)
* cl_getcap --
* Retrieve termcap/terminfo strings.
*
- * PUBLIC: int cl_getcap __P((SCR *, char *, char **));
+ * PUBLIC: int cl_getcap(SCR *, char *, char **);
*/
int
cl_getcap(SCR *sp, char *name, char **elementp)
Modified: head/contrib/nvi/cl/cl_term.c
==============================================================================
--- head/contrib/nvi/cl/cl_term.c Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/cl/cl_term.c Fri Apr 10 17:50:28 2015 (r281373)
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: cl_term.c,v 10.34 2013/12/07 16:21:14 wjenkner Exp $";
+static const char sccsid[] = "$Id: cl_term.c,v 10.35 2015/04/08 02:12:11 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -34,7 +34,7 @@ static const char sccsid[] = "$Id: cl_te
#include "../common/common.h"
#include "cl.h"
-static int cl_pfmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
+static int cl_pfmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
/*
* XXX
@@ -81,7 +81,7 @@ static TKLIST const m2_tklist[] = { /* I
* cl_term_init --
* Initialize the special keys defined by the termcap/terminfo entry.
*
- * PUBLIC: int cl_term_init __P((SCR *));
+ * PUBLIC: int cl_term_init(SCR *);
*/
int
cl_term_init(SCR *sp)
@@ -182,7 +182,7 @@ cl_term_init(SCR *sp)
* cl_term_end --
* End the special keys defined by the termcap/terminfo entry.
*
- * PUBLIC: int cl_term_end __P((GS *));
+ * PUBLIC: int cl_term_end(GS *);
*/
int
cl_term_end(GS *gp)
@@ -206,7 +206,7 @@ cl_term_end(GS *gp)
* cl_fmap --
* Map a function key.
*
- * PUBLIC: int cl_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
+ * PUBLIC: int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
*/
int
cl_fmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to, size_t tlen)
@@ -258,7 +258,7 @@ cl_pfmap(SCR *sp, seq_t stype, CHAR_T *f
* cl_optchange --
* Curses screen specific "option changed" routine.
*
- * PUBLIC: int cl_optchange __P((SCR *, int, char *, u_long *));
+ * PUBLIC: int cl_optchange(SCR *, int, char *, u_long *);
*/
int
cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
@@ -268,15 +268,16 @@ cl_optchange(SCR *sp, int opt, char *str
clp = CLP(sp);
switch (opt) {
+ case O_TERM:
+ F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
+ /* FALLTHROUGH */
case O_COLUMNS:
case O_LINES:
- case O_TERM:
/*
- * Changing the columns, lines or terminal require that
- * we restart the screen.
+ * Changing the terminal type requires that we reinitialize
+ * curses, while resizing does not.
*/
F_SET(sp->gp, G_SRESTART);
- F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
break;
case O_MESG:
(void)cl_omesg(sp, clp, *valp);
@@ -305,7 +306,7 @@ cl_optchange(SCR *sp, int opt, char *str
* cl_omesg --
* Turn the tty write permission on or off.
*
- * PUBLIC: int cl_omesg __P((SCR *, CL_PRIVATE *, int));
+ * PUBLIC: int cl_omesg(SCR *, CL_PRIVATE *, int);
*/
int
cl_omesg(SCR *sp, CL_PRIVATE *clp, int on)
@@ -351,7 +352,7 @@ cl_omesg(SCR *sp, CL_PRIVATE *clp, int o
* cl_ssize --
* Return the terminal size.
*
- * PUBLIC: int cl_ssize __P((SCR *, int, size_t *, size_t *, int *));
+ * PUBLIC: int cl_ssize(SCR *, int, size_t *, size_t *, int *);
*/
int
cl_ssize(SCR *sp, int sigwinch, size_t *rowp, size_t *colp, int *changedp)
@@ -467,7 +468,7 @@ noterm: if (row == 0)
* cl_putchar --
* Function version of putchar, for tputs.
*
- * PUBLIC: int cl_putchar __P((int));
+ * PUBLIC: int cl_putchar(int);
*/
int
cl_putchar(int ch)
Modified: head/contrib/nvi/cl/extern.h
==============================================================================
--- head/contrib/nvi/cl/extern.h Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/cl/extern.h Fri Apr 10 17:50:28 2015 (r281373)
@@ -1,31 +1,31 @@
-int cl_waddstr __P((SCR *, const CHAR_T *, size_t));
-int cl_addstr __P((SCR *, const char *, size_t));
-int cl_attr __P((SCR *, scr_attr_t, int));
-int cl_baud __P((SCR *, u_long *));
-int cl_bell __P((SCR *));
-int cl_clrtoeol __P((SCR *));
-int cl_cursor __P((SCR *, size_t *, size_t *));
-int cl_deleteln __P((SCR *));
-int cl_discard __P((SCR *, SCR **));
-int cl_ex_adjust __P((SCR *, exadj_t));
-int cl_insertln __P((SCR *));
-int cl_keyval __P((SCR *, scr_keyval_t, CHAR_T *, int *));
-int cl_move __P((SCR *, size_t, size_t));
-int cl_refresh __P((SCR *, int));
-int cl_rename __P((SCR *, char *, int));
-void cl_setname __P((GS *, char *));
-int cl_split __P((SCR *, SCR *));
-int cl_suspend __P((SCR *, int *));
-void cl_usage __P((void));
-int sig_init __P((GS *, SCR *));
-int cl_event __P((SCR *, EVENT *, u_int32_t, int));
-int cl_screen __P((SCR *, u_int32_t));
-int cl_quit __P((GS *));
-int cl_getcap __P((SCR *, char *, char **));
-int cl_term_init __P((SCR *));
-int cl_term_end __P((GS *));
-int cl_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
-int cl_optchange __P((SCR *, int, char *, u_long *));
-int cl_omesg __P((SCR *, CL_PRIVATE *, int));
-int cl_ssize __P((SCR *, int, size_t *, size_t *, int *));
-int cl_putchar __P((int));
+int cl_waddstr(SCR *, const CHAR_T *, size_t);
+int cl_addstr(SCR *, const char *, size_t);
+int cl_attr(SCR *, scr_attr_t, int);
+int cl_baud(SCR *, u_long *);
+int cl_bell(SCR *);
+int cl_clrtoeol(SCR *);
+int cl_cursor(SCR *, size_t *, size_t *);
+int cl_deleteln(SCR *);
+int cl_discard(SCR *, SCR **);
+int cl_ex_adjust(SCR *, exadj_t);
+int cl_insertln(SCR *);
+int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *);
+int cl_move(SCR *, size_t, size_t);
+int cl_refresh(SCR *, int);
+int cl_rename(SCR *, char *, int);
+void cl_setname(GS *, char *);
+int cl_split(SCR *, SCR *);
+int cl_suspend(SCR *, int *);
+void cl_usage(void);
+int sig_init(GS *, SCR *);
+int cl_event(SCR *, EVENT *, u_int32_t, int);
+int cl_screen(SCR *, u_int32_t);
+int cl_quit(GS *);
+int cl_getcap(SCR *, char *, char **);
+int cl_term_init(SCR *);
+int cl_term_end(GS *);
+int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+int cl_optchange(SCR *, int, char *, u_long *);
+int cl_omesg(SCR *, CL_PRIVATE *, int);
+int cl_ssize(SCR *, int, size_t *, size_t *, int *);
+int cl_putchar(int);
Modified: head/contrib/nvi/common/common.h
==============================================================================
--- head/contrib/nvi/common/common.h Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/common/common.h Fri Apr 10 17:50:28 2015 (r281373)
@@ -23,8 +23,8 @@
*/
typedef struct _cb CB;
typedef struct _csc CSC;
-typedef struct _conv CONV;
-typedef struct _conv_win CONVWIN;
+typedef struct _conv CONV;
+typedef struct _conv_win CONVWIN;
typedef struct _event EVENT;
typedef struct _excmd EXCMD;
typedef struct _exf EXF;
Modified: head/contrib/nvi/common/conv.c
==============================================================================
--- head/contrib/nvi/common/conv.c Fri Apr 10 17:21:47 2015 (r281372)
+++ head/contrib/nvi/common/conv.c Fri Apr 10 17:50:28 2015 (r281373)
@@ -12,7 +12,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: conv.c,v 2.39 2013/07/01 23:28:13 zy Exp $";
+static const char sccsid[] = "$Id: conv.c,v 2.40 2014/02/27 16:25:29 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -36,35 +36,37 @@ static const char sccsid[] = "$Id: conv.
* codeset --
* Get the locale encoding.
*
- * PUBLIC: char * codeset __P((void));
+ * PUBLIC: char * codeset(void);
*/
char *
-codeset(void) {
- static char *cs;
+codeset(void)
+{
+ static char *cs;
+
+ if (cs == NULL)
+ cs = nl_langinfo(CODESET);
- if (cs == NULL)
- cs = nl_langinfo(CODESET);
- return cs;
+ return cs;
}
#ifdef USE_WIDECHAR
static int
-raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- int i;
- CHAR_T **tostr = &cw->bp1.wc;
- size_t *blen = &cw->blen1;
+ int i;
+ CHAR_T **tostr = &cw->bp1.wc;
+ size_t *blen = &cw->blen1;
- BINC_RETW(NULL, *tostr, *blen, len);
+ BINC_RETW(NULL, *tostr, *blen, len);
- *tolen = len;
- for (i = 0; i < len; ++i)
- (*tostr)[i] = (u_char) str[i];
+ *tolen = len;
+ for (i = 0; i < len; ++i)
+ (*tostr)[i] = (u_char) str[i];
- *dst = cw->bp1.wc;
+ *dst = cw->bp1.wc;
- return 0;
+ return 0;
}
#define CONV_BUFFER_SIZE 512
@@ -73,27 +75,27 @@ raw2int(SCR *sp, const char * str, ssize
* len contains the number of bytes put in the buffer
*/
#ifdef USE_ICONV
-#define CONVERT(str, left, src, len) \
- do { \
- size_t outleft; \
- char *bp = buffer; \
- outleft = CONV_BUFFER_SIZE; \
- errno = 0; \
- if (iconv(id, (iconv_src_t)&str, &left, &bp, &outleft) == -1 && \
- errno != E2BIG) \
- goto err; \
- if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
- error = -left; \
- goto err; \
- } \
- src = buffer; \
- } while (0)
+#define CONVERT(str, left, src, len) \
+ do { \
+ size_t outleft; \
+ char *bp = buffer; \
+ outleft = CONV_BUFFER_SIZE; \
+ errno = 0; \
+ if (iconv(id, (iconv_src_t)&str, &left, &bp, &outleft) \
+ == -1 && errno != E2BIG) \
+ goto err; \
+ if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
+ error = -left; \
+ goto err; \
+ } \
+ src = buffer; \
+ } while (0)
#define IC_RESET() \
- do { \
- if (id != (iconv_t)-1) \
- iconv(id, NULL, NULL, NULL, NULL); \
- } while(0)
+ do { \
+ if (id != (iconv_t)-1) \
+ iconv(id, NULL, NULL, NULL, NULL); \
+ } while(0)
#else
#define CONVERT(str, left, src, len)
#define IC_RESET()
@@ -101,114 +103,116 @@ raw2int(SCR *sp, const char * str, ssize
static int
default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst, iconv_t id)
+ size_t *tolen, CHAR_T **dst, iconv_t id)
{
- size_t i = 0, j;
- CHAR_T **tostr = &cw->bp1.wc;
- size_t *blen = &cw->blen1;
- mbstate_t mbs;
- size_t n;
- ssize_t nlen = len;
- char *src = (char *)str;
+ size_t i = 0, j;
+ CHAR_T **tostr = &cw->bp1.wc;
+ size_t *blen = &cw->blen1;
+ mbstate_t mbs;
+ size_t n;
+ ssize_t nlen = len;
+ char *src = (char *)str;
#ifdef USE_ICONV
- char buffer[CONV_BUFFER_SIZE];
+ char buffer[CONV_BUFFER_SIZE];
#endif
- size_t left = len;
- int error = 1;
+ size_t left = len;
+ int error = 1;
- BZERO(&mbs, 1);
- BINC_RETW(NULL, *tostr, *blen, nlen);
+ BZERO(&mbs, 1);
+ BINC_RETW(NULL, *tostr, *blen, nlen);
#ifdef USE_ICONV
- if (id != (iconv_t)-1)
- CONVERT(str, left, src, len);
+ if (id != (iconv_t)-1)
+ CONVERT(str, left, src, len);
#endif
- for (i = 0, j = 0; j < len; ) {
- n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
- /* NULL character converted */
- if (n == -2) error = -(len-j);
- if (n == -1 || n == -2) goto err;
- if (n == 0) n = 1;
- j += n;
- if (++i >= *blen) {
- nlen += 256;
- BINC_RETW(NULL, *tostr, *blen, nlen);
- }
- if (id != (iconv_t)-1 && j == len && left) {
- CONVERT(str, left, src, len);
- j = 0;
+ for (i = 0, j = 0; j < len; ) {
+ n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
+ /* NULL character converted */
+ if (n == -2)
+ error = -(len-j);
+ if (n == -1 || n == -2)
+ goto err;
+ if (n == 0)
+ n = 1;
+ j += n;
+ if (++i >= *blen) {
+ nlen += 256;
+ BINC_RETW(NULL, *tostr, *blen, nlen);
+ }
+ if (id != (iconv_t)-1 && j == len && left) {
+ CONVERT(str, left, src, len);
+ j = 0;
+ }
}
- }
- error = 0;
+ error = 0;
err:
- *tolen = i;
- *dst = cw->bp1.wc;
- IC_RESET();
+ *tolen = i;
+ *dst = cw->bp1.wc;
+ IC_RESET();
- return error;
+ return error;
}
static int
-fe_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+fe_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- return default_char2int(sp, str, len, cw, tolen, dst,
- sp->conv.id[IC_FE_CHAR2INT]);
+ return default_char2int(sp, str, len, cw, tolen, dst,
+ sp->conv.id[IC_FE_CHAR2INT]);
}
static int
-ie_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+ie_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- return default_char2int(sp, str, len, cw, tolen, dst,
- sp->conv.id[IC_IE_CHAR2INT]);
+ return default_char2int(sp, str, len, cw, tolen, dst,
+ sp->conv.id[IC_IE_CHAR2INT]);
}
static int
-cs_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+cs_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- return default_char2int(sp, str, len, cw, tolen, dst,
- (iconv_t)-1);
+ return default_char2int(sp, str, len, cw, tolen, dst, (iconv_t)-1);
}
static int
-int2raw(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, char **dst)
+int2raw(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ char **dst)
{
- int i;
- char **tostr = &cw->bp1.c;
- size_t *blen = &cw->blen1;
+ int i;
+ char **tostr = &cw->bp1.c;
+ size_t *blen = &cw->blen1;
- BINC_RETC(NULL, *tostr, *blen, len);
+ BINC_RETC(NULL, *tostr, *blen, len);
- *tolen = len;
- for (i = 0; i < len; ++i)
- (*tostr)[i] = str[i];
+ *tolen = len;
+ for (i = 0; i < len; ++i)
+ (*tostr)[i] = str[i];
- *dst = cw->bp1.c;
+ *dst = cw->bp1.c;
- return 0;
+ return 0;
}
static int
default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, char **pdst, iconv_t id)
+ size_t *tolen, char **pdst, iconv_t id)
{
- size_t i, j, offset = 0;
- char **tostr = &cw->bp1.c;
- size_t *blen = &cw->blen1;
- mbstate_t mbs;
- size_t n;
- ssize_t nlen = len + MB_CUR_MAX;
- char *dst;
- size_t buflen;
+ size_t i, j, offset = 0;
+ char **tostr = &cw->bp1.c;
+ size_t *blen = &cw->blen1;
+ mbstate_t mbs;
+ size_t n;
+ ssize_t nlen = len + MB_CUR_MAX;
+ char *dst;
+ size_t buflen;
#ifdef USE_ICONV
- char buffer[CONV_BUFFER_SIZE];
+ char buffer[CONV_BUFFER_SIZE];
#endif
- int error = 1;
+ int error = 1;
/* convert first len bytes of buffer and append it to cw->bp
* len is adjusted => 0
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-head
mailing list