socsvn commit: r224180 - in soc2011/zy/nvi-iconv/head/contrib/nvi2: . build cl common ex include include/sys vi

zy at FreeBSD.org zy at FreeBSD.org
Wed Jul 13 13:24:42 UTC 2011


Author: zy
Date: Wed Jul 13 13:24:40 2011
New Revision: 224180
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=224180

Log:
  Pull nvi2 as a vendor source.

Added:
  soc2011/zy/nvi-iconv/head/contrib/nvi2/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/LICENSE
  soc2011/zy/nvi-iconv/head/contrib/nvi2/README
  soc2011/zy/nvi-iconv/head/contrib/nvi2/build/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/build/distrib   (contents, props changed)
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_bsd.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_read.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_screen.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_term.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/extern.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/args.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/common.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/delete.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/gs.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/key.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/key.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/line.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/log.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/log.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/main.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mem.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/msg.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/msg.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/multibyte.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.awk
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options_def.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options_f.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/put.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/recover.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/search.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/seq.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/seq.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/util.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/common/util.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.awk
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_abbrev.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_append.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_args.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_argv.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_at.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_bang.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_cd.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_cmd.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_cscope.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_def.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_delete.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_display.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_edit.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_equal.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_file.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_filter.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_global.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_init.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_join.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_map.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_mark.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_mkexrc.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_move.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_open.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_perl.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_preserve.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_print.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_put.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_quit.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_read.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_screen.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_script.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_set.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_shell.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_shift.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_source.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_stop.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_subst.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_tag.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_tcl.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_txt.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_undo.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_usage.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_util.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_version.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_visual.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_yank.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_z.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/extern.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/script.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/tag.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/version.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/include/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/include/bitstring.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/include/sys/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/include/sys/queue.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/extern.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/getc.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_at.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_ch.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_cmd.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_delete.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_ex.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_increment.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_init.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_itxt.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_left.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_mark.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_match.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_paragraph.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_put.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_redraw.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_replace.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_right.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_screen.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_scroll.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_search.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_section.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_sentence.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_status.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_txt.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_ulcase.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_undo.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_util.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_word.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_xchar.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_yank.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_z.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_zexit.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.h
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_line.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_msg.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_refresh.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_relative.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_smap.c
  soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_split.c

Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/LICENSE
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2011/zy/nvi-iconv/head/contrib/nvi2/LICENSE	Wed Jul 13 13:24:40 2011	(r224180)
@@ -0,0 +1,41 @@
+/*-
+ * $Id: LICENSE,v 8.18 2011/07/10 11:58:35 zy Exp $ (Berkeley) $Date: 2011/07/10 11:58:35 $
+ */
+
+The following are the copyrights and redistribution conditions that apply
+to this copy of the Vi software.
+
+/*
+ * Copyright (c) 1991, 1992, 1993, 1994
+ *      The Regents of the University of California.  All rights reserved.
+ *  Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ *	Keith Bostic.  All rights reserved.
+ *  Copyright (c) 1999, 2000
+ *	Sven Verdoolaege.  All rights reserved.
+ *  Copyright (c) 2011
+ *	Zhihao Yuan.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 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. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */

Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/README
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2011/zy/nvi-iconv/head/contrib/nvi2/README	Wed Jul 13 13:24:40 2011	(r224180)
@@ -0,0 +1,55 @@
+#	$Id: README,v 8.154 2011/06/26 13:11:10 zy Exp $ (Berkeley) $Date: 2011/06/26 13:11:10 $
+
+This is version 2.0.0 (2011-06-26) 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.
+
+The directory layout is as follows:
+
+    LICENSE ....... Copyright, use and redistribution information.
+    README ........ This file.
+    build ......... Build directory.
+    catalog ....... Message catalogs; see catalog/README.
+    cl ............ Vi interface to the curses(3) library.
+    common ........ Code shared by ex and vi.
+    docs .......... Ex/vi documentation, both current and historic.
+    ex ............ Ex source code.
+    include ....... Replacement include files.
+    vi ............ Vi source code.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+o This software is several years old and is the product of many folks' work.  
+
+	This software was originally derived from software contributed to
+	the University of California, Berkeley by Steve Kirkendall, the
+	author of the vi clone elvis.  Without his work, this work would
+	have been far more difficult.
+
+	IEEE POSIX 1003.2 style regular expression support is courtesy of
+	Henry Spencer, for which I am *very* grateful.
+
+	Elan Amir did the original 4BSD curses work that made it possible
+	to support a full-screen editor using curses.
+
+	George Neville-Neil added the Tcl interpreter, and the initial
+	interpreter design was his.
+
+	Sven Verdoolaege added the Perl interpreter.
+
+	Rob Mayoff provided the original Cscope support.
+
+o Many, many people suggested enhancements, and provided bug reports and
+  testing, far too many to individually thank.
+
+o From the original vi acknowledgements, by William Joy and Mark Horton:
+
+	Bruce Englar encouraged the early development of this display
+	editor.  Peter Kessler helped bring sanity to version 2's
+	command layout.  Bill Joy wrote versions 1 and 2.0 through 2.7,
+	and created the framework that users see in the present editor.
+	Mark Horton added macros and other features and made the editor
+	work on a large number of terminals and Unix systems.
+
+o And...
+	The financial support of UUNET Communications Services is gratefully
+	acknowledged.

Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/build/distrib
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2011/zy/nvi-iconv/head/contrib/nvi2/build/distrib	Wed Jul 13 13:24:40 2011	(r224180)
@@ -0,0 +1,39 @@
+#! /bin/sh
+# $Id: distrib,v 8.26 2011/07/13 07:45:14 zy Exp $ (Berkeley) $Date: 2011/07/13 07:45:14 $
+
+# Build include files.
+f=../cl/extern.h
+echo "Building $f"
+rm -f $f
+sed -n "s/^ \* PUBLIC: \(.*\)/\1/p" ../cl/*.c > $f
+chmod 444 $f
+
+f=../common/extern.h
+echo "Building $f"
+rm -f $f
+sed -n "s/^ \* PUBLIC: \(.*\)/\1/p" ../common/*.c > $f
+chmod 444 $f
+
+f=../ex/ex_def.h
+echo "Building $f"
+rm -f $f
+awk -f ../ex/ex.awk ../ex/ex_cmd.c > $f
+chmod 444 $f
+
+f=../ex/extern.h
+echo "Building $f"
+rm -f $f
+sed -n "s/^ \* PUBLIC: \(.*\)/\1/p" ../ex/*.c > $f
+chmod 444 $f
+
+f=../common/options_def.h
+echo "Building $f"
+rm -f $f
+awk -f ../common/options.awk ../common/options.c > $f
+chmod 444 $f
+
+f=../vi/extern.h
+echo "Building $f"
+rm -f $f
+sed -n "s/^ \* PUBLIC: \(.*\)/\1/p" ../vi/*.c > $f
+chmod 444 $f

Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl.h	Wed Jul 13 13:24:40 2011	(r224180)
@@ -0,0 +1,110 @@
+/*-
+ * Copyright (c) 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 1993, 1994, 1995, 1996
+ *	Keith Bostic.  All rights reserved.
+ *
+ * See the LICENSE file for redistribution information.
+ *
+ *	$Id: cl.h,v 10.32 2001/08/28 11:33:40 skimo Exp $ (Berkeley) $Date: 2001/08/28 11:33:40 $
+ */
+
+#ifdef USE_SLANG_CURSES
+#include <slcurses.h>
+#else
+#ifdef HAVE_NCURSESW_NCURSES_H /* { */
+#include <ncursesw/ncurses.h>
+#else /* } { */
+#ifdef HAVE_NCURSES_H /* { */
+#include <ncurses.h>
+#else /* } { */
+#include <curses.h>
+#endif /* } */
+#endif
+#endif
+
+typedef struct _cl_private {
+	char	 ibuf[256];	/* Input keys. */
+
+	size_t	 skip;		/* Remaining keys. */
+
+	CONVWIN cw;		/* Conversion buffer. */
+
+	int	 eof_count;	/* EOF count. */
+
+	struct termios orig;	/* Original terminal values. */
+	struct termios ex_enter;/* Terminal values to enter ex. */
+	struct termios vi_enter;/* Terminal values to enter vi. */
+
+	char	*el;		/* Clear to EOL terminal string. */
+	char	*cup;		/* Cursor movement terminal string. */
+	char	*cuu1;		/* Cursor up terminal string. */
+	char	*rmso, *smso;	/* Inverse video terminal strings. */
+	char	*smcup, *rmcup;	/* Terminal start/stop strings. */
+
+	SCR	*focus;		/* Screen that has the "focus". */
+
+	int	 killersig;	/* Killer signal. */
+#define	INDX_HUP	0
+#define	INDX_INT	1
+#define	INDX_TERM	2
+#define	INDX_WINCH	3
+#define	INDX_MAX	4	/* Original signal information. */
+	struct sigaction oact[INDX_MAX];
+
+	enum {			/* Tty group write mode. */
+	    TGW_UNKNOWN=0, TGW_SET, TGW_UNSET } tgw;
+
+	enum {			/* Terminal initialization strings. */
+	    TE_SENT=0, TI_SENT } ti_te;
+
+#define	CL_IN_EX	0x0001	/* Currently running ex. */
+#define	CL_LAYOUT	0x0002	/* Screen layout changed. */
+#define	CL_RENAME	0x0004	/* X11 xterm icon/window renamed. */
+#define	CL_RENAME_OK	0x0008	/* User wants the windows renamed. */
+#define	CL_SCR_EX_INIT	0x0010	/* Ex screen initialized. */
+#define	CL_SCR_VI_INIT	0x0020	/* Vi screen initialized. */
+#define	CL_SIGHUP	0x0040	/* SIGHUP arrived. */
+#define	CL_SIGINT	0x0080	/* SIGINT arrived. */
+#define	CL_SIGTERM	0x0100	/* SIGTERM arrived. */
+#define	CL_SIGWINCH	0x0200	/* SIGWINCH arrived. */
+#define	CL_STDIN_TTY	0x0400	/* Talking to a terminal. */
+	u_int32_t flags;
+} CL_PRIVATE;
+
+#define	CLP(sp)		((CL_PRIVATE *)((sp)->gp->cl_private))
+#define	GCLP(gp)	((CL_PRIVATE *)gp->cl_private)
+#define	CLSP(sp)	((WINDOW *)((sp)->cl_private))
+
+/* Return possibilities from the keyboard read routine. */
+typedef enum { INP_OK=0, INP_EOF, INP_ERR, INP_INTR, INP_TIMEOUT } input_t;
+
+/* The screen position relative to a specific window. */
+#define	RCNO(sp, cno)	(cno)
+#define	RLNO(sp, lno)	(lno)
+
+/* X11 xterm escape sequence to rename the icon/window. */
+#define	XTERM_RENAME	"\033]0;%s\007"
+
+/*
+ * 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"
+
+#ifdef USE_PERL_SETENV
+#include "../perl_api/extern.h"
+#define cl_setenv(sp,name,val)	perl_setenv(sp,name,val)
+#define cl_unsetenv(sp,name)	perl_setenv(sp,name,NULL)
+#else
+#define cl_setenv(sp,name,val)	setenv(name,val,1)
+#define cl_unsetenv(sp,name)	unsetenv(name)
+#endif

Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_bsd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_bsd.c	Wed Jul 13 13:24:40 2011	(r224180)
@@ -0,0 +1,346 @@
+/*-
+ * Copyright (c) 1995, 1996
+ *	Keith Bostic.  All rights reserved.
+ *
+ * See the LICENSE file for redistribution information.
+ */
+
+#include "config.h"
+
+#ifndef lint
+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 */
+
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/time.h>
+
+#include <bitstring.h>
+#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <unistd.h>
+
+#include "../common/common.h"
+#include "../vi/vi.h"
+#include "cl.h"
+
+static char	*ke;				/* Keypad on. */
+static char	*ks;				/* Keypad off. */
+static char	*vb;				/* Visible bell string. */
+
+/*
+ * HP's support the entire System V curses package except for the tigetstr
+ * and tigetnum functions.  Ultrix supports the BSD curses package except
+ * for the idlok function.  Cthulu only knows why.  Break things up into a
+ * minimal set of functions.
+ */
+
+#ifndef HAVE_CURSES_WADDNSTR
+/*
+ * waddnstr --
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_WADDNSTR
+ * PUBLIC: int waddnstr __P((WINDOW*, char *, int));
+ * PUBLIC: #endif
+ */
+int
+waddnstr(w, s, n)
+	WINDOW *w;
+	char *s;
+	int n;
+{
+	int ch;
+
+	while (n-- && (ch = *s++))
+		waddch(w, ch);
+	return (OK);
+}
+#endif
+
+#ifndef	HAVE_CURSES_BEEP
+/*
+ * beep --
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_BEEP
+ * PUBLIC: void beep __P((void));
+ * PUBLIC: #endif
+ */
+void
+beep()
+{
+	(void)write(1, "\007", 1);	/* '\a' */
+}
+#endif /* !HAVE_CURSES_BEEP */
+
+#ifndef	HAVE_CURSES_FLASH
+/*
+ * flash --
+ *	Flash the screen.
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_FLASH
+ * PUBLIC: void flash __P((void));
+ * PUBLIC: #endif
+ */
+void
+flash()
+{
+	if (vb != NULL) {
+		(void)tputs(vb, 1, cl_putchar);
+		(void)fflush(stdout);
+	} else
+		beep();
+}
+#endif /* !HAVE_CURSES_FLASH */
+
+#ifndef	HAVE_CURSES_IDLOK
+/*
+ * idlok --
+ *	Turn on/off hardware line insert/delete.
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_IDLOK
+ * PUBLIC: void idlok __P((WINDOW *, int));
+ * PUBLIC: #endif
+ */
+void
+idlok(win, bf)
+	WINDOW *win;
+	int bf;
+{
+	return;
+}
+#endif /* !HAVE_CURSES_IDLOK */
+
+#ifndef	HAVE_CURSES_KEYPAD
+/*
+ * keypad --
+ *	Put the keypad/cursor arrows into or out of application mode.
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_KEYPAD
+ * PUBLIC: int keypad __P((void *, int));
+ * PUBLIC: #endif
+ */
+int
+keypad(a, on)
+	void *a;
+	int on;
+{
+	char *p;
+
+	if ((p = tigetstr(on ? "smkx" : "rmkx")) != (char *)-1) {
+		(void)tputs(p, 0, cl_putchar);
+		(void)fflush(stdout);
+	}
+	return (0);
+}
+#endif /* !HAVE_CURSES_KEYPAD */
+
+#ifndef	HAVE_CURSES_NEWTERM
+/*
+ * newterm --
+ *	Create a new curses screen.
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_NEWTERM
+ * PUBLIC: void *newterm __P((const char *, FILE *, FILE *));
+ * PUBLIC: #endif
+ */
+void *
+newterm(a, b, c)
+	const char *a;
+	FILE *b, *c;
+{
+	return (initscr());
+}
+#endif /* !HAVE_CURSES_NEWTERM */
+
+#ifndef	HAVE_CURSES_SETUPTERM
+/*
+ * setupterm --
+ *	Set up terminal.
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_SETUPTERM
+ * PUBLIC: void setupterm __P((char *, int, int *));
+ * PUBLIC: #endif
+ */
+void
+setupterm(ttype, fno, errp)
+	char *ttype;
+	int fno, *errp;
+{
+	static char buf[2048];
+	char *p;
+
+	if ((*errp = tgetent(buf, ttype)) > 0) {
+		if (ke != NULL)
+			free(ke);
+		ke = ((p = tigetstr("rmkx")) == (char *)-1) ?
+		    NULL : strdup(p);
+		if (ks != NULL)
+			free(ks);
+		ks = ((p = tigetstr("smkx")) == (char *)-1) ?
+		    NULL : strdup(p);
+		if (vb != NULL)
+			free(vb);
+		vb = ((p = tigetstr("flash")) == (char *)-1) ?
+		    NULL : strdup(p);
+	}
+}
+#endif /* !HAVE_CURSES_SETUPTERM */
+
+#ifndef	HAVE_CURSES_TIGETSTR
+/* Terminfo-to-termcap translation table. */
+typedef struct _tl {
+	char *terminfo;			/* Terminfo name. */
+	char *termcap;			/* Termcap name. */
+} TL;
+static const TL list[] = {
+	"cols",		"co",		/* Terminal columns. */
+	"cup",		"cm",		/* Cursor up. */
+	"cuu1",		"up",		/* Cursor up. */
+	"el",		"ce",		/* Clear to end-of-line. */
+	"flash",	"vb",		/* Visible bell. */
+	"kcub1",  	"kl",		/* Cursor left. */
+	"kcud1",	"kd",		/* Cursor down. */
+	"kcuf1",	"kr",		/* Cursor right. */
+	"kcuu1",  	"ku",		/* Cursor up. */
+	"kdch1",	"kD",		/* Delete character. */
+	"kdl1",		"kL",		/* Delete line. */
+	"ked",		"kS",		/* Delete to end of screen. */
+	"kel",		"kE",		/* Delete to eol. */
+	"kend",		"@7",		/* Go to eol. */
+	"khome",	"kh",		/* Go to sol. */
+	"kich1",	"kI",		/* Insert at cursor. */
+	"kil1",		"kA",		/* Insert line. */
+	"kind",		"kF",		/* Scroll down. */
+	"kll",		"kH",		/* Go to eol. */
+	"knp",		"kN",		/* Page down. */
+	"kpp",		"kP",		/* Page up. */
+	"kri",		"kR",		/* Scroll up. */
+	"lines",	"li",		/* Terminal lines. */
+	"rmcup",	"te",		/* Terminal end string. */
+	"rmkx",		"ke",		/* Exit "keypad-transmit" mode. */
+	"rmso",		"se",		/* Standout end. */
+	"smcup",	"ti",		/* Terminal initialization string. */
+	"smkx",		"ks",		/* Enter "keypad-transmit" mode. */
+	"smso",		"so",		/* Standout begin. */
+};
+
+#ifdef _AIX
+/*
+ * AIX's implementation for function keys greater than 10 is different and
+ * only goes as far as 36.
+ */
+static const char codes[] = {
+/*  0-10 */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';',
+/* 11-20 */ '<', '>', '!', '@', '#', '$', '%', '^', '&', '*',
+/* 21-30 */ '(', ')', '-', '_', '+', ',', ':', '?', '[', ']',
+/* 31-36 */ '{', '}', '|', '~', '/', '='
+};
+
+#else
+
+/*
+ * !!!
+ * Historically, the 4BSD termcap code didn't support functions keys greater
+ * than 9.  This was silently enforced -- asking for key k12 would return the
+ * value for k1.  We try and get around this by using the tables specified in
+ * the terminfo(TI_ENV) man page from the 3rd Edition SVID.  This assumes the
+ * implementors of any System V compatibility code or an extended termcap used
+ * those codes.
+ */
+static const char codes[] = {
+/*  0-10 */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';',
+/* 11-19 */ '1', '2', '3', '4', '5', '6', '7', '8', '9',
+/* 20-63 */ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+	    'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+	    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+	    'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+};
+#endif /* _AIX */
+
+/*
+ * lcmp --
+ *	list comparison routine for bsearch.
+ */
+static int
+lcmp(a, b)
+	const void *a, *b;
+{
+	return (strcmp(a, ((TL *)b)->terminfo));
+}
+
+/*
+ * tigetstr --
+ *
+ * Vendors put the prototype for tigetstr into random include files, including
+ * <term.h>, which we can't include because it makes other systems unhappy.
+ * Try and work around the problem, since we only care about the return value.
+ *
+ * PUBLIC: #ifdef HAVE_CURSES_TIGETSTR
+ * PUBLIC: char *tigetstr();
+ * PUBLIC: #else
+ * PUBLIC: char *tigetstr __P((char *));
+ * PUBLIC: #endif
+ */
+char *
+tigetstr(name)
+	char *name;
+{
+	static char sbuf[256];
+	TL *tlp;
+	int n;
+	char *p, keyname[3];
+
+	if ((tlp = bsearch(name,
+	    list, sizeof(list) / sizeof(TL), sizeof(TL), lcmp)) == NULL) {
+#ifdef _AIX
+		if (name[0] == 'k' &&
+		    name[1] == 'f' && (n = atoi(name + 2)) <= 36) {
+			keyname[0] = 'k';
+			keyname[1] = codes[n];
+			keyname[2] = '\0';
+#else
+		if (name[0] == 'k' &&
+		    name[1] == 'f' && (n = atoi(name + 2)) <= 63) {
+			keyname[0] = n <= 10 ? 'k' : 'F';
+			keyname[1] = codes[n];
+			keyname[2] = '\0';
+#endif
+			name = keyname;
+		}
+	} else
+		name = tlp->termcap;
+
+	p = sbuf;
+#ifdef _AIX
+	return ((p = tgetstr(name, &p)) == NULL ? (char *)-1 : strcpy(sbuf, p));
+#else
+	return (tgetstr(name, &p) == NULL ? (char *)-1 : sbuf);
+#endif
+}
+
+/*
+ * tigetnum --
+ *
+ * PUBLIC: #ifndef HAVE_CURSES_TIGETSTR
+ * PUBLIC: int tigetnum __P((char *));
+ * PUBLIC: #endif
+ */
+int
+tigetnum(name)
+	char *name;
+{
+	TL *tlp;
+	int val;
+
+	if ((tlp = bsearch(name,
+	    list, sizeof(list) / sizeof(TL), sizeof(TL), lcmp)) != NULL) {
+		name = tlp->termcap;
+	}
+
+	return ((val = tgetnum(name)) == -1 ? -2 : val);
+}
+#endif /* !HAVE_CURSES_TIGETSTR */

Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c	Wed Jul 13 13:24:40 2011	(r224180)
@@ -0,0 +1,855 @@
+/*-
+ * Copyright (c) 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 1993, 1994, 1995, 1996
+ *	Keith Bostic.  All rights reserved.
+ *
+ * See the LICENSE file for redistribution information.
+ */
+
+#include "config.h"
+
+#ifndef lint
+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 */
+
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/time.h>
+
+#include <bitstring.h>
+#include <ctype.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_TERM_H
+#include <term.h>
+#else
+#include <termios.h>
+#endif
+#include <unistd.h>
+
+#include "../common/common.h"
+#include "../vi/vi.h"
+#include "cl.h"
+
+static void cl_rdiv __P((SCR *));
+
+static int 
+addstr4(SCR *sp, void *str, size_t len, int wide)
+{
+	CL_PRIVATE *clp;
+	WINDOW *win;
+	size_t y, x;
+	int iv;
+
+	clp = CLP(sp);
+	win = CLSP(sp) ? CLSP(sp) : stdscr;
+
+	/*
+	 * If ex isn't in control, it's the last line of the screen and
+	 * it's a split screen, use inverse video.
+	 */
+	iv = 0;
+	getyx(win, y, x);
+	if (!F_ISSET(sp, SC_SCR_EXWROTE) &&
+	    y == RLNO(sp, LASTLINE(sp)) && IS_SPLIT(sp)) {
+		iv = 1;
+		(void)wstandout(win);
+	}
+
+#ifdef USE_WIDECHAR
+	if (wide) {
+	    if (waddnwstr(win, str, len) == ERR)
+		return (1);
+	} else 
+#endif
+	    if (waddnstr(win, str, len) == ERR)
+		    return (1);
+
+	if (iv)
+		(void)wstandend(win);
+	return (0);
+}
+
+/*
+ * 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));
+ */
+int
+cl_waddstr(SCR *sp, const CHAR_T *str, size_t len)
+{
+    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));
+ */
+int
+cl_addstr(SCR *sp, const char *str, size_t len)
+{
+    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));
+ */
+int
+cl_attr(SCR *sp, scr_attr_t attribute, int on)
+{
+	CL_PRIVATE *clp;
+	WINDOW *win;
+
+	clp = CLP(sp);
+	win = CLSP(sp) ? CLSP(sp) : stdscr;
+
+	switch (attribute) {
+	case SA_ALTERNATE:
+	/*
+	 * !!!
+	 * There's a major layering violation here.  The problem is that the
+	 * X11 xterm screen has what's known as an "alternate" screen.  Some
+	 * xterm termcap/terminfo entries include sequences to switch to/from
+	 * that alternate screen as part of the ti/te (smcup/rmcup) strings.
+	 * Vi runs in the alternate screen, so that you are returned to the
+	 * same screen contents on exit from vi that you had when you entered
+	 * vi.  Further, when you run :shell, or :!date or similar ex commands,
+	 * you also see the original screen contents.  This wasn't deliberate
+	 * on vi's part, it's just that it historically sent terminal init/end
+	 * sequences at those times, and the addition of the alternate screen
+	 * sequences to the strings changed the behavior of vi.  The problem
+	 * caused by this is that we don't want to switch back to the alternate
+	 * screen while getting a new command from the user, when the user is
+	 * continuing to enter ex commands, e.g.:
+	 *
+	 *	:!date				<<< switch to original screen
+	 *	[Hit return to continue]	<<< prompt user to continue
+	 *	:command			<<< get command from user
+	 *
+	 * Note that the :command input is a true vi input mode, e.g., input
+	 * maps and abbreviations are being done.  So, we need to be able to
+	 * switch back into the vi screen mode, without flashing the screen. 
+	 *
+	 * To make matters worse, the curses initscr() and endwin() calls will
+	 * do this automatically -- so, this attribute isn't as controlled by
+	 * the higher level screen as closely as one might like.
+	 */
+	if (on) {
+		if (clp->ti_te != TI_SENT) {
+			clp->ti_te = TI_SENT;
+			if (clp->smcup == NULL)
+				(void)cl_getcap(sp, "smcup", &clp->smcup);
+			if (clp->smcup != NULL)
+				(void)tputs(clp->smcup, 1, cl_putchar);
+		}
+	} else
+		if (clp->ti_te != TE_SENT) {
+			clp->ti_te = TE_SENT;
+			if (clp->rmcup == NULL)
+				(void)cl_getcap(sp, "rmcup", &clp->rmcup);
+			if (clp->rmcup != NULL)
+				(void)tputs(clp->rmcup, 1, cl_putchar);
+			(void)fflush(stdout);
+		}
+		(void)fflush(stdout);
+		break;
+	case SA_INVERSE:
+		if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)) {
+			if (clp->smso == NULL)
+				return (1);
+			if (on)
+				(void)tputs(clp->smso, 1, cl_putchar);
+			else
+				(void)tputs(clp->rmso, 1, cl_putchar);
+			(void)fflush(stdout);
+		} else {
+			if (on)
+				(void)wstandout(win);
+			else
+				(void)wstandend(win);
+		}
+		break;
+	default:
+		abort();
+	}
+	return (0);
+}
+
+/*
+ * cl_baud --
+ *	Return the baud rate.
+ *
+ * PUBLIC: int cl_baud __P((SCR *, u_long *));
+ */
+int
+cl_baud(SCR *sp, u_long *ratep)
+{
+	CL_PRIVATE *clp;
+
+	/*
+	 * XXX
+	 * There's no portable way to get a "baud rate" -- cfgetospeed(3)
+	 * returns the value associated with some #define, which we may
+	 * never have heard of, or which may be a purely local speed.  Vi
+	 * only cares if it's SLOW (w300), slow (w1200) or fast (w9600).
+	 * Try and detect the slow ones, and default to fast.
+	 */
+	clp = CLP(sp);
+	switch (cfgetospeed(&clp->orig)) {
+	case B50:
+	case B75:
+	case B110:
+	case B134:
+	case B150:
+	case B200:
+	case B300:
+	case B600:
+		*ratep = 600;
+		break;
+	case B1200:
+		*ratep = 1200;
+		break;
+	default:
+		*ratep = 9600;
+		break;
+	}
+	return (0);
+}
+
+/*
+ * cl_bell --
+ *	Ring the bell/flash the screen.
+ *
+ * PUBLIC: int cl_bell __P((SCR *));
+ */
+int
+cl_bell(SCR *sp)
+{
+	if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE | SC_SCR_EX))
+		(void)write(STDOUT_FILENO, "\07", 1);		/* \a */
+	else {
+		/*
+		 * Vi has an edit option which determines if the terminal
+		 * should be beeped or the screen flashed.
+		 */
+		if (O_ISSET(sp, O_FLASH))
+			(void)flash();
+		else
+			(void)beep();
+	}
+	return (0);
+}
+
+/*
+ * cl_clrtoeol --
+ *	Clear from the current cursor to the end of the line.
+ *
+ * PUBLIC: int cl_clrtoeol __P((SCR *));
+ */
+int
+cl_clrtoeol(SCR *sp)
+{
+	WINDOW *win;
+	size_t spcnt, y, x;
+
+	win = CLSP(sp) ? CLSP(sp) : stdscr;
+
+#if 0
+	if (IS_VSPLIT(sp)) {
+		/* The cursor must be returned to its original position. */
+		getyx(win, y, x);
+		for (spcnt = (sp->coff + sp->cols) - x; spcnt > 0; --spcnt)
+			(void)waddch(win, ' ');
+		(void)wmove(win, y, x);
+		return (0);
+	} else
+#endif
+		return (wclrtoeol(win) == ERR);
+}
+
+/*
+ * cl_cursor --
+ *	Return the current cursor position.
+ *
+ * PUBLIC: int cl_cursor __P((SCR *, size_t *, size_t *));
+ */
+int
+cl_cursor(SCR *sp, size_t *yp, size_t *xp)
+{
+	WINDOW *win;
+	win = CLSP(sp) ? CLSP(sp) : stdscr;
+	/*
+	 * The curses screen support splits a single underlying curses screen
+	 * into multiple screens to support split screen semantics.  For this
+	 * reason the returned value must be adjusted to be relative to the
+	 * current screen, and not absolute.  Screens that implement the split
+	 * using physically distinct screens won't need this hack.
+	 */
+	getyx(win, *yp, *xp);
+	/*
+	*yp -= sp->roff;
+	*xp -= sp->coff;
+	*/
+	return (0);
+}
+
+/*
+ * cl_deleteln --
+ *	Delete the current line, scrolling all lines below it.
+ *
+ * PUBLIC: int cl_deleteln __P((SCR *));
+ */
+int
+cl_deleteln(SCR *sp)
+{
+	CHAR_T ch;
+	CL_PRIVATE *clp;
+	WINDOW *win;
+	size_t col, lno, spcnt, y, x;
+
+	clp = CLP(sp);
+	win = CLSP(sp) ? CLSP(sp) : stdscr;
+
+	/*
+	 * This clause is required because the curses screen uses reverse
+	 * video to delimit split screens.  If the screen does not do this,
+	 * this code won't be necessary.
+	 *
+	 * If the bottom line was in reverse video, rewrite it in normal
+	 * video before it's scrolled.
+	 *
+	 * Check for the existence of a chgat function; XSI requires it, but
+	 * historic implementations of System V curses don't.   If it's not
+	 * a #define, we'll fall back to doing it by hand, which is slow but
+	 * acceptable.
+	 *
+	 * By hand means walking through the line, retrieving and rewriting
+	 * each character.  Curses has no EOL marker, so track strings of
+	 * spaces, and copy the trailing spaces only if there's a non-space
+	 * character following.
+	 */
+	if (!F_ISSET(sp, SC_SCR_EXWROTE) && IS_SPLIT(sp)) {
+		getyx(win, y, x);
+#ifdef mvchgat
+		mvwchgat(win, RLNO(sp, LASTLINE(sp)), 0, -1, A_NORMAL, 0, NULL);
+#else
+		for (lno = RLNO(sp, LASTLINE(sp)), col = spcnt = 0;;) {
+			(void)wmove(win, lno, col);
+			ch = winch(win);
+			if (isblank(ch))
+				++spcnt;
+			else {
+				(void)wmove(win, lno, col - spcnt);
+				for (; spcnt > 0; --spcnt)
+					(void)waddch(win, ' ');
+				(void)waddch(win, ch);
+			}
+			if (++col >= sp->cols)
+				break;
+		}
+#endif
+		(void)wmove(win, y, x);
+	}
+
+	/*
+	 * The bottom line is expected to be blank after this operation,
+	 * and other screens must support that semantic.
+	 */
+	return (wdeleteln(win) == ERR);
+}
+
+/* 
+ * cl_discard --
+ *	Discard a screen.
+ *
+ * PUBLIC: int cl_discard __P((SCR *, SCR **));
+ */
+int
+cl_discard(SCR *discardp, SCR **acquirep)
+{
+	CL_PRIVATE *clp;
+	SCR*	tsp;
+
+	if (discardp) {
+	    clp = CLP(discardp);
+	    F_SET(clp, CL_LAYOUT);
+
+	    if (CLSP(discardp)) {
+		    delwin(CLSP(discardp));
+		    discardp->cl_private = NULL;
+	    }
+	}
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-soc-all mailing list