svn commit: r281370 - in vendor/nvi/2.1.3: . catalog cl common docs docs/USD.doc docs/internals docs/interp docs/man docs/tutorial ex regex vi
Baptiste Daroussin
bapt at FreeBSD.org
Fri Apr 10 13:28:03 UTC 2015
Author: bapt
Date: Fri Apr 10 13:28:01 2015
New Revision: 281370
URL: https://svnweb.freebsd.org/changeset/base/281370
Log:
Tag nvi2 import 2.1.3
Added:
vendor/nvi/2.1.3/
- copied from r281364, vendor/nvi/dist/
vendor/nvi/2.1.3/docs/man/
- copied from r281368, vendor/nvi/dist/docs/man/
Replaced:
vendor/nvi/2.1.3/README
- copied unchanged from r281368, vendor/nvi/dist/README
vendor/nvi/2.1.3/catalog/dump.c
- copied unchanged from r281368, vendor/nvi/dist/catalog/dump.c
vendor/nvi/2.1.3/cl/cl.h
- copied unchanged from r281368, vendor/nvi/dist/cl/cl.h
vendor/nvi/2.1.3/cl/cl_funcs.c
- copied unchanged from r281368, vendor/nvi/dist/cl/cl_funcs.c
vendor/nvi/2.1.3/cl/cl_main.c
- copied unchanged from r281368, vendor/nvi/dist/cl/cl_main.c
vendor/nvi/2.1.3/cl/cl_read.c
- copied unchanged from r281368, vendor/nvi/dist/cl/cl_read.c
vendor/nvi/2.1.3/cl/cl_screen.c
- copied unchanged from r281368, vendor/nvi/dist/cl/cl_screen.c
vendor/nvi/2.1.3/cl/cl_term.c
- copied unchanged from r281368, vendor/nvi/dist/cl/cl_term.c
vendor/nvi/2.1.3/cl/extern.h
- copied unchanged from r281368, vendor/nvi/dist/cl/extern.h
vendor/nvi/2.1.3/common/common.h
- copied unchanged from r281368, vendor/nvi/dist/common/common.h
vendor/nvi/2.1.3/common/conv.c
- copied unchanged from r281368, vendor/nvi/dist/common/conv.c
vendor/nvi/2.1.3/common/cut.c
- copied unchanged from r281368, vendor/nvi/dist/common/cut.c
vendor/nvi/2.1.3/common/delete.c
- copied unchanged from r281368, vendor/nvi/dist/common/delete.c
vendor/nvi/2.1.3/common/encoding.c
- copied unchanged from r281368, vendor/nvi/dist/common/encoding.c
vendor/nvi/2.1.3/common/exf.c
- copied unchanged from r281368, vendor/nvi/dist/common/exf.c
vendor/nvi/2.1.3/common/extern.h
- copied unchanged from r281368, vendor/nvi/dist/common/extern.h
vendor/nvi/2.1.3/common/gs.h
- copied unchanged from r281368, vendor/nvi/dist/common/gs.h
vendor/nvi/2.1.3/common/key.c
- copied unchanged from r281368, vendor/nvi/dist/common/key.c
vendor/nvi/2.1.3/common/line.c
- copied unchanged from r281368, vendor/nvi/dist/common/line.c
vendor/nvi/2.1.3/common/log.c
- copied unchanged from r281368, vendor/nvi/dist/common/log.c
vendor/nvi/2.1.3/common/main.c
- copied unchanged from r281368, vendor/nvi/dist/common/main.c
vendor/nvi/2.1.3/common/mark.c
- copied unchanged from r281368, vendor/nvi/dist/common/mark.c
vendor/nvi/2.1.3/common/msg.c
- copied unchanged from r281368, vendor/nvi/dist/common/msg.c
vendor/nvi/2.1.3/common/options.c
- copied unchanged from r281368, vendor/nvi/dist/common/options.c
vendor/nvi/2.1.3/common/options.h
- copied unchanged from r281368, vendor/nvi/dist/common/options.h
vendor/nvi/2.1.3/common/options_f.c
- copied unchanged from r281368, vendor/nvi/dist/common/options_f.c
vendor/nvi/2.1.3/common/put.c
- copied unchanged from r281368, vendor/nvi/dist/common/put.c
vendor/nvi/2.1.3/common/recover.c
- copied unchanged from r281368, vendor/nvi/dist/common/recover.c
vendor/nvi/2.1.3/common/screen.c
- copied unchanged from r281368, vendor/nvi/dist/common/screen.c
vendor/nvi/2.1.3/common/search.c
- copied unchanged from r281368, vendor/nvi/dist/common/search.c
vendor/nvi/2.1.3/common/seq.c
- copied unchanged from r281368, vendor/nvi/dist/common/seq.c
vendor/nvi/2.1.3/common/util.c
- copied unchanged from r281368, vendor/nvi/dist/common/util.c
vendor/nvi/2.1.3/ex/ex.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex.c
vendor/nvi/2.1.3/ex/ex.h
- copied unchanged from r281368, vendor/nvi/dist/ex/ex.h
vendor/nvi/2.1.3/ex/ex_abbrev.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_abbrev.c
vendor/nvi/2.1.3/ex/ex_append.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_append.c
vendor/nvi/2.1.3/ex/ex_args.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_args.c
vendor/nvi/2.1.3/ex/ex_argv.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_argv.c
vendor/nvi/2.1.3/ex/ex_at.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_at.c
vendor/nvi/2.1.3/ex/ex_bang.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_bang.c
vendor/nvi/2.1.3/ex/ex_cd.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_cd.c
vendor/nvi/2.1.3/ex/ex_cscope.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_cscope.c
vendor/nvi/2.1.3/ex/ex_delete.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_delete.c
vendor/nvi/2.1.3/ex/ex_display.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_display.c
vendor/nvi/2.1.3/ex/ex_edit.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_edit.c
vendor/nvi/2.1.3/ex/ex_equal.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_equal.c
vendor/nvi/2.1.3/ex/ex_file.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_file.c
vendor/nvi/2.1.3/ex/ex_filter.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_filter.c
vendor/nvi/2.1.3/ex/ex_global.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_global.c
vendor/nvi/2.1.3/ex/ex_init.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_init.c
vendor/nvi/2.1.3/ex/ex_join.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_join.c
vendor/nvi/2.1.3/ex/ex_map.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_map.c
vendor/nvi/2.1.3/ex/ex_mark.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_mark.c
vendor/nvi/2.1.3/ex/ex_mkexrc.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_mkexrc.c
vendor/nvi/2.1.3/ex/ex_move.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_move.c
vendor/nvi/2.1.3/ex/ex_open.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_open.c
vendor/nvi/2.1.3/ex/ex_preserve.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_preserve.c
vendor/nvi/2.1.3/ex/ex_print.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_print.c
vendor/nvi/2.1.3/ex/ex_put.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_put.c
vendor/nvi/2.1.3/ex/ex_quit.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_quit.c
vendor/nvi/2.1.3/ex/ex_read.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_read.c
vendor/nvi/2.1.3/ex/ex_screen.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_screen.c
vendor/nvi/2.1.3/ex/ex_script.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_script.c
vendor/nvi/2.1.3/ex/ex_set.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_set.c
vendor/nvi/2.1.3/ex/ex_shell.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_shell.c
vendor/nvi/2.1.3/ex/ex_shift.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_shift.c
vendor/nvi/2.1.3/ex/ex_source.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_source.c
vendor/nvi/2.1.3/ex/ex_stop.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_stop.c
vendor/nvi/2.1.3/ex/ex_subst.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_subst.c
vendor/nvi/2.1.3/ex/ex_tag.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_tag.c
vendor/nvi/2.1.3/ex/ex_txt.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_txt.c
vendor/nvi/2.1.3/ex/ex_undo.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_undo.c
vendor/nvi/2.1.3/ex/ex_usage.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_usage.c
vendor/nvi/2.1.3/ex/ex_util.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_util.c
vendor/nvi/2.1.3/ex/ex_version.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_version.c
vendor/nvi/2.1.3/ex/ex_visual.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_visual.c
vendor/nvi/2.1.3/ex/ex_write.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_write.c
vendor/nvi/2.1.3/ex/ex_yank.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_yank.c
vendor/nvi/2.1.3/ex/ex_z.c
- copied unchanged from r281368, vendor/nvi/dist/ex/ex_z.c
vendor/nvi/2.1.3/ex/extern.h
- copied unchanged from r281368, vendor/nvi/dist/ex/extern.h
vendor/nvi/2.1.3/ex/version.h
- copied unchanged from r281368, vendor/nvi/dist/ex/version.h
vendor/nvi/2.1.3/regex/COPYRIGHT
- copied unchanged from r281368, vendor/nvi/dist/regex/COPYRIGHT
vendor/nvi/2.1.3/regex/cclass.h
- copied unchanged from r281368, vendor/nvi/dist/regex/cclass.h
vendor/nvi/2.1.3/regex/cname.h
- copied unchanged from r281368, vendor/nvi/dist/regex/cname.h
vendor/nvi/2.1.3/regex/engine.c
- copied unchanged from r281368, vendor/nvi/dist/regex/engine.c
vendor/nvi/2.1.3/regex/re_format.7
- copied unchanged from r281368, vendor/nvi/dist/regex/re_format.7
vendor/nvi/2.1.3/regex/regcomp.c
- copied unchanged from r281368, vendor/nvi/dist/regex/regcomp.c
vendor/nvi/2.1.3/regex/regerror.c
- copied unchanged from r281368, vendor/nvi/dist/regex/regerror.c
vendor/nvi/2.1.3/regex/regex.3
- copied unchanged from r281368, vendor/nvi/dist/regex/regex.3
vendor/nvi/2.1.3/regex/regex.h
- copied unchanged from r281368, vendor/nvi/dist/regex/regex.h
vendor/nvi/2.1.3/regex/regex2.h
- copied unchanged from r281368, vendor/nvi/dist/regex/regex2.h
vendor/nvi/2.1.3/regex/regexec.c
- copied unchanged from r281368, vendor/nvi/dist/regex/regexec.c
vendor/nvi/2.1.3/regex/regfree.c
- copied unchanged from r281368, vendor/nvi/dist/regex/regfree.c
vendor/nvi/2.1.3/regex/utils.h
- copied unchanged from r281368, vendor/nvi/dist/regex/utils.h
vendor/nvi/2.1.3/vi/extern.h
- copied unchanged from r281368, vendor/nvi/dist/vi/extern.h
vendor/nvi/2.1.3/vi/getc.c
- copied unchanged from r281368, vendor/nvi/dist/vi/getc.c
vendor/nvi/2.1.3/vi/v_at.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_at.c
vendor/nvi/2.1.3/vi/v_ch.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_ch.c
vendor/nvi/2.1.3/vi/v_delete.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_delete.c
vendor/nvi/2.1.3/vi/v_ex.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_ex.c
vendor/nvi/2.1.3/vi/v_increment.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_increment.c
vendor/nvi/2.1.3/vi/v_init.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_init.c
vendor/nvi/2.1.3/vi/v_itxt.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_itxt.c
vendor/nvi/2.1.3/vi/v_left.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_left.c
vendor/nvi/2.1.3/vi/v_mark.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_mark.c
vendor/nvi/2.1.3/vi/v_match.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_match.c
vendor/nvi/2.1.3/vi/v_paragraph.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_paragraph.c
vendor/nvi/2.1.3/vi/v_put.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_put.c
vendor/nvi/2.1.3/vi/v_redraw.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_redraw.c
vendor/nvi/2.1.3/vi/v_replace.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_replace.c
vendor/nvi/2.1.3/vi/v_right.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_right.c
vendor/nvi/2.1.3/vi/v_screen.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_screen.c
vendor/nvi/2.1.3/vi/v_scroll.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_scroll.c
vendor/nvi/2.1.3/vi/v_search.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_search.c
vendor/nvi/2.1.3/vi/v_section.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_section.c
vendor/nvi/2.1.3/vi/v_sentence.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_sentence.c
vendor/nvi/2.1.3/vi/v_status.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_status.c
vendor/nvi/2.1.3/vi/v_txt.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_txt.c
vendor/nvi/2.1.3/vi/v_ulcase.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_ulcase.c
vendor/nvi/2.1.3/vi/v_undo.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_undo.c
vendor/nvi/2.1.3/vi/v_util.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_util.c
vendor/nvi/2.1.3/vi/v_word.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_word.c
vendor/nvi/2.1.3/vi/v_xchar.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_xchar.c
vendor/nvi/2.1.3/vi/v_yank.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_yank.c
vendor/nvi/2.1.3/vi/v_z.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_z.c
vendor/nvi/2.1.3/vi/v_zexit.c
- copied unchanged from r281368, vendor/nvi/dist/vi/v_zexit.c
vendor/nvi/2.1.3/vi/vi.c
- copied unchanged from r281368, vendor/nvi/dist/vi/vi.c
vendor/nvi/2.1.3/vi/vi.h
- copied unchanged from r281368, vendor/nvi/dist/vi/vi.h
vendor/nvi/2.1.3/vi/vs_line.c
- copied unchanged from r281368, vendor/nvi/dist/vi/vs_line.c
vendor/nvi/2.1.3/vi/vs_msg.c
- copied unchanged from r281368, vendor/nvi/dist/vi/vs_msg.c
vendor/nvi/2.1.3/vi/vs_refresh.c
- copied unchanged from r281368, vendor/nvi/dist/vi/vs_refresh.c
vendor/nvi/2.1.3/vi/vs_relative.c
- copied unchanged from r281368, vendor/nvi/dist/vi/vs_relative.c
vendor/nvi/2.1.3/vi/vs_smap.c
- copied unchanged from r281368, vendor/nvi/dist/vi/vs_smap.c
vendor/nvi/2.1.3/vi/vs_split.c
- copied unchanged from r281368, vendor/nvi/dist/vi/vs_split.c
Deleted:
vendor/nvi/2.1.3/catalog/spell.ok
vendor/nvi/2.1.3/docs/TODO
vendor/nvi/2.1.3/docs/USD.doc/
vendor/nvi/2.1.3/docs/changelog
vendor/nvi/2.1.3/docs/ev
vendor/nvi/2.1.3/docs/features
vendor/nvi/2.1.3/docs/help
vendor/nvi/2.1.3/docs/internals/
vendor/nvi/2.1.3/docs/interp/
vendor/nvi/2.1.3/docs/spell.ok
vendor/nvi/2.1.3/docs/tutorial/
Copied: vendor/nvi/2.1.3/README (from r281368, vendor/nvi/dist/README)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/nvi/2.1.3/README Fri Apr 10 13:28:01 2015 (r281370, copy of r281368, vendor/nvi/dist/README)
@@ -0,0 +1,66 @@
+# $Id: README,v 9.2 2015/04/08 17:18:56 zy Exp $
+
+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.
+
+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.
+ regex ......... Modified regex library with wide character support.
+ vi ............ Vi source code.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+o Nvi was written by Keith Bostic, and the last version is 1.79. After that,
+
+ Sven Verdoolaege added the iconv support and the DB3 locking.
+
+ Jun-ichiro itojun Hagino developed the file encoding detection
+ techniques in his nvi-m17n.
+
+The following acknowledgments were written by Keith Bostic:
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+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.
Copied: vendor/nvi/2.1.3/catalog/dump.c (from r281368, vendor/nvi/dist/catalog/dump.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/nvi/2.1.3/catalog/dump.c Fri Apr 10 13:28:01 2015 (r281370, copy of r281368, vendor/nvi/dist/catalog/dump.c)
@@ -0,0 +1,101 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. 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.
+ */
+
+#ifndef lint
+static char sccsid[] = "$Id: dump.c,v 8.2 2011/07/14 00:05:25 zy Exp $";
+#endif /* not lint */
+
+#include <ctype.h>
+#include <stdio.h>
+
+static void
+parse(FILE *fp)
+{
+ int ch, s1, s2, s3;
+
+#define TESTD(s) { \
+ if ((s = getc(fp)) == EOF) \
+ return; \
+ if (!isdigit(s)) \
+ continue; \
+}
+#define TESTP { \
+ if ((ch = getc(fp)) == EOF) \
+ return; \
+ if (ch != '|') \
+ continue; \
+}
+#define MOVEC(t) { \
+ do { \
+ if ((ch = getc(fp)) == EOF) \
+ return; \
+ } while (ch != (t)); \
+}
+ for (;;) {
+ MOVEC('"');
+ TESTD(s1);
+ TESTD(s2);
+ TESTD(s3);
+ TESTP;
+ putchar('"');
+ putchar(s1);
+ putchar(s2);
+ putchar(s3);
+ putchar('|');
+ for (;;) { /* dump to end quote. */
+ if ((ch = getc(fp)) == EOF)
+ return;
+ putchar(ch);
+ if (ch == '"')
+ break;
+ if (ch == '\\') {
+ if ((ch = getc(fp)) == EOF)
+ return;
+ putchar(ch);
+ }
+ }
+ putchar('\n');
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ FILE *fp;
+
+ for (; *argv != NULL; ++argv) {
+ if ((fp = fopen(*argv, "r")) == NULL) {
+ perror(*argv);
+ return (1);
+ }
+ parse(fp);
+ (void)fclose(fp);
+ }
+ return (0);
+}
Copied: vendor/nvi/2.1.3/cl/cl.h (from r281368, vendor/nvi/dist/cl/cl.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/nvi/2.1.3/cl/cl.h Fri Apr 10 13:28:01 2015 (r281370, copy of r281368, vendor/nvi/dist/cl/cl.h)
@@ -0,0 +1,83 @@
+/*-
+ * 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.34 2011/08/15 20:07:32 zy Exp $
+ */
+
+#ifdef USE_WIDECHAR
+#define _XOPEN_SOURCE_EXTENDED
+#endif
+#ifdef HAVE_NCURSES_H
+#include <ncurses.h>
+#else
+#include <curses.h>
+#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. */
+
+ char *oname; /* Original screen window name. */
+
+ 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)
+
+#include "extern.h"
Copied: vendor/nvi/2.1.3/cl/cl_funcs.c (from r281368, vendor/nvi/dist/cl/cl_funcs.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/nvi/2.1.3/cl/cl_funcs.c Fri Apr 10 13:28:01 2015 (r281370, copy of r281368, vendor/nvi/dist/cl/cl_funcs.c)
@@ -0,0 +1,852 @@
+/*-
+ * 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.74 2012/10/11 10:30:16 zy Exp $";
+#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>
+#endif
+#include <termios.h>
+#include <unistd.h>
+
+#include "../common/common.h"
+#include "../vi/vi.h"
+#include "cl.h"
+
+static void cl_rdiv(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(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(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(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(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(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(SCR *);
+ */
+int
+cl_clrtoeol(SCR *sp)
+{
+ WINDOW *win;
+#if 0
+ size_t spcnt, y, x;
+#endif
+
+ 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(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(SCR *);
+ */
+int
+cl_deleteln(SCR *sp)
+{
+ CL_PRIVATE *clp;
+ WINDOW *win;
+ size_t 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.
+ */
+ if (!F_ISSET(sp, SC_SCR_EXWROTE) && IS_SPLIT(sp)) {
+ getyx(win, y, x);
+ mvwchgat(win, RLNO(sp, LASTLINE(sp)), 0, -1, A_NORMAL, 0, NULL);
+ (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(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;
+ }
+ }
+
+ /* no screens got a piece; we're done */
+ if (!acquirep)
+ return 0;
+
+ for (; (tsp = *acquirep) != NULL; ++acquirep) {
+ clp = CLP(tsp);
+ F_SET(clp, CL_LAYOUT);
+
+ if (CLSP(tsp))
+ delwin(CLSP(tsp));
+ tsp->cl_private = subwin(stdscr, tsp->rows, tsp->cols,
+ tsp->roff, tsp->coff);
+ }
+
+ /* discardp is going away, acquirep is taking up its space. */
+ return (0);
+}
+
+/*
+ * cl_ex_adjust --
+ * Adjust the screen for ex. This routine is purely for standalone
+ * ex programs. All special purpose, all special case.
+ *
+ * PUBLIC: int cl_ex_adjust(SCR *, exadj_t);
+ */
+int
+cl_ex_adjust(SCR *sp, exadj_t action)
+{
+ CL_PRIVATE *clp;
+ int cnt;
+
+ clp = CLP(sp);
+ switch (action) {
+ case EX_TERM_SCROLL:
+ /* Move the cursor up one line if that's possible. */
+ if (clp->cuu1 != NULL)
+ (void)tputs(clp->cuu1, 1, cl_putchar);
+ else if (clp->cup != NULL)
+ (void)tputs(tgoto(clp->cup,
+ 0, LINES - 2), 1, cl_putchar);
+ else
+ return (0);
+ /* FALLTHROUGH */
+ case EX_TERM_CE:
+ /* Clear the line. */
+ if (clp->el != NULL) {
+ (void)putchar('\r');
+ (void)tputs(clp->el, 1, cl_putchar);
+ } else {
+ /*
+ * Historically, ex didn't erase the line, so, if the
+ * displayed line was only a single glyph, and <eof>
+ * was more than one glyph, the output would not fully
+ * overwrite the user's input. To fix this, output
+ * the maxiumum character number of spaces. Note,
+ * this won't help if the user entered extra prompt
+ * or <blank> characters before the command character.
+ * We'd have to do a lot of work to make that work, and
+ * it's almost certainly not worth the effort.
+ */
+ for (cnt = 0; cnt < MAX_CHARACTER_COLUMNS; ++cnt)
+ (void)putchar('\b');
+ for (cnt = 0; cnt < MAX_CHARACTER_COLUMNS; ++cnt)
+ (void)putchar(' ');
+ (void)putchar('\r');
+ (void)fflush(stdout);
+ }
+ break;
+ default:
+ abort();
+ }
+ return (0);
+}
+
+/*
+ * cl_insertln --
+ * Push down the current line, discarding the bottom line.
+ *
+ * PUBLIC: int cl_insertln(SCR *);
+ */
+int
+cl_insertln(SCR *sp)
+{
+ WINDOW *win;
+ win = CLSP(sp) ? CLSP(sp) : stdscr;
+ /*
+ * The current line is expected to be blank after this operation,
+ * and the screen must support that semantic.
+ */
+ return (winsertln(win) == ERR);
+}
+
+/*
+ * cl_keyval --
+ * Return the value for a special key.
+ *
+ * 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)
+{
+ CL_PRIVATE *clp;
+
+ /*
+ * VEOF, VERASE and VKILL are required by POSIX 1003.1-1990,
+ * VWERASE is a 4BSD extension.
+ */
+ clp = CLP(sp);
+ switch (val) {
+ case KEY_VEOF:
+ *dnep = (*chp = clp->orig.c_cc[VEOF]) == _POSIX_VDISABLE;
+ break;
+ case KEY_VERASE:
+ *dnep = (*chp = clp->orig.c_cc[VERASE]) == _POSIX_VDISABLE;
+ break;
+ case KEY_VKILL:
+ *dnep = (*chp = clp->orig.c_cc[VKILL]) == _POSIX_VDISABLE;
+ break;
+#ifdef VWERASE
+ case KEY_VWERASE:
+ *dnep = (*chp = clp->orig.c_cc[VWERASE]) == _POSIX_VDISABLE;
+ break;
+#endif
+ default:
+ *dnep = 1;
+ break;
+ }
+ return (0);
+}
+
+/*
+ * cl_move --
+ * Move the cursor.
+ *
+ * PUBLIC: int cl_move(SCR *, size_t, size_t);
+ */
+int
+cl_move(SCR *sp, size_t lno, size_t cno)
+{
+ WINDOW *win;
+ win = CLSP(sp) ? CLSP(sp) : stdscr;
+ /* See the comment in cl_cursor. */
+ if (wmove(win, RLNO(sp, lno), RCNO(sp, cno)) == ERR) {
+ msgq(sp, M_ERR, "Error: move: l(%zu + %zu) c(%zu + %zu)",
+ lno, sp->roff, cno, sp->coff);
+ return (1);
+ }
+ return (0);
+}
+
+/*
+ * cl_refresh --
+ * Refresh the screen.
+ *
+ * PUBLIC: int cl_refresh(SCR *, int);
+ */
+int
+cl_refresh(SCR *sp, int repaint)
+{
+ GS *gp;
+ CL_PRIVATE *clp;
+ WINDOW *win;
+ SCR *psp, *tsp;
+ size_t y, x;
+
+ gp = sp->gp;
+ clp = CLP(sp);
+ win = CLSP(sp) ? CLSP(sp) : stdscr;
+
+ /*
+ * If we received a killer signal, we're done, there's no point
+ * in refreshing the screen.
+ */
+ if (clp->killersig)
+ return (0);
+
+ /*
+ * If repaint is set, the editor is telling us that we don't know
+ * what's on the screen, so we have to repaint from scratch.
+ *
+ * If repaint set or the screen layout changed, we need to redraw
+ * any lines separating vertically split screens. If the horizontal
+ * offsets are the same, then the split was vertical, and need to
+ * draw a dividing line.
+ */
+ if (repaint || F_ISSET(clp, CL_LAYOUT)) {
+ getyx(stdscr, y, x);
+ for (psp = sp; psp != NULL; psp = TAILQ_NEXT(psp, q))
+ for (tsp = TAILQ_NEXT(psp, q); tsp != NULL;
+ tsp = TAILQ_NEXT(tsp, q))
+ if (psp->roff == tsp->roff) {
+ if (psp->coff + psp->cols + 1 == tsp->coff)
+ cl_rdiv(psp);
+ else
+ if (tsp->coff + tsp->cols + 1 == psp->coff)
+ cl_rdiv(tsp);
+ }
+ (void)wmove(stdscr, y, x);
+ F_CLR(clp, CL_LAYOUT);
+ }
+
+ /*
+ * In the curses library, doing wrefresh(curscr) is okay, but the
+ * screen flashes when we then apply the refresh() to bring it up
+ * to date. So, use clearok().
+ */
+ if (repaint)
+ clearok(curscr, 1);
+ /*
+ * Only do an actual refresh, when this is the focus window,
+ * i.e. the one holding the cursor. This assumes that refresh
+ * is called for that window after refreshing the others.
+ * This prevents the cursor being drawn in the other windows.
+ */
+ return (wnoutrefresh(stdscr) == ERR ||
+ wnoutrefresh(win) == ERR ||
+ (sp == clp->focus && doupdate() == ERR));
+}
+
+/*
+ * cl_rdiv --
+ * Draw a dividing line between two vertically split screens.
+ */
+static void
+cl_rdiv(SCR *sp)
+{
+#ifdef __NetBSD__
+ mvvline(sp->roff, sp->cols + sp->coff, '|', sp->rows);
+#else
+ mvvline(sp->roff, sp->cols + sp->coff, ACS_VLINE, sp->rows);
+#endif
+}
+
+/*
+ * cl_rename --
+ * Rename the file.
+ *
+ * PUBLIC: int cl_rename(SCR *, char *, int);
+ */
+int
+cl_rename(SCR *sp, char *name, int on)
+{
+ GS *gp;
+ CL_PRIVATE *clp;
+ FILE *pfp;
+ char buf[256], *s, *e;
+ char * wid;
+ char cmd[64];
+
+ gp = sp->gp;
+ clp = CLP(sp);
+
+ /*
+ * XXX
+ * We can only rename windows for xterm.
+ */
+ if (on) {
+ clp->focus = sp;
+ if (!F_ISSET(clp, CL_RENAME_OK) ||
+ strncmp(OG_STR(gp, GO_TERM), "xterm", 5))
+ return (0);
+
+ if (clp->oname == NULL && (wid = getenv("WINDOWID"))) {
+ snprintf(cmd, sizeof(cmd), "xprop -id %s WM_NAME", wid);
+ if ((pfp = popen(cmd, "r")) == NULL)
+ goto rename;
+ if (fgets(buf, sizeof(buf), pfp) == NULL) {
+ pclose(pfp);
+ goto rename;
+ }
+ pclose(pfp);
+ if ((s = strchr(buf, '"')) != NULL &&
+ (e = strrchr(buf, '"')) != NULL)
+ clp->oname = strndup(s + 1, e - s - 1);
+ }
+
+rename: cl_setname(gp, name);
+
+ F_SET(clp, CL_RENAME);
+ } else
+ if (F_ISSET(clp, CL_RENAME)) {
+ cl_setname(gp, clp->oname);
+
+ F_CLR(clp, CL_RENAME);
+ }
+ return (0);
+}
+
+/*
+ * cl_setname --
+ * Set a X11 icon/window name.
+ *
+ * PUBLIC: void cl_setname(GS *, char *);
+ */
+void
+cl_setname(GS *gp, char *name)
+{
+/* X11 xterm escape sequence to rename the icon/window. */
+#define XTERM_RENAME "\033]0;%s\007"
+
+ (void)printf(XTERM_RENAME, name == NULL ? OG_STR(gp, GO_TERM) : name);
+ (void)fflush(stdout);
+#undef XTERM_RENAME
+}
+
+/*
+ * cl_split --
+ * Split a screen.
+ *
+ * PUBLIC: int cl_split(SCR *, SCR *);
+ */
+int
+cl_split(SCR *origp, SCR *newp)
+{
+ CL_PRIVATE *clp;
+
+ clp = CLP(origp);
+ F_SET(clp, CL_LAYOUT);
+
+ if (CLSP(origp))
+ delwin(CLSP(origp));
+
+ origp->cl_private = subwin(stdscr, origp->rows, origp->cols,
+ origp->roff, origp->coff);
+ newp->cl_private = subwin(stdscr, newp->rows, newp->cols,
+ newp->roff, newp->coff);
+
+ /* origp is the original screen, giving up space to newp. */
+ return (0);
+}
+
+/*
+ * cl_suspend --
+ * Suspend a screen.
+ *
+ * PUBLIC: int cl_suspend(SCR *, int *);
+ */
+int
+cl_suspend(SCR *sp, int *allowedp)
+{
+ struct termios t;
+ CL_PRIVATE *clp;
+ WINDOW *win;
+ GS *gp;
+ size_t y, x;
+ int changed;
+
+ gp = sp->gp;
+ clp = CLP(sp);
+ win = CLSP(sp) ? CLSP(sp) : stdscr;
+ *allowedp = 1;
+
+ /*
+ * The ex implementation of this function isn't needed by screens not
+ * supporting ex commands that require full terminal canonical mode
+ * (e.g. :suspend).
+ *
+ * The vi implementation of this function isn't needed by screens not
+ * supporting vi process suspension, i.e. any screen that isn't backed
+ * by a UNIX shell.
+ *
+ * Setting allowedp to 0 will cause the editor to reject the command.
+ */
+ if (F_ISSET(sp, SC_EX)) {
+ /* Save the terminal settings, and restore the original ones. */
+ if (F_ISSET(clp, CL_STDIN_TTY)) {
+ (void)tcgetattr(STDIN_FILENO, &t);
+ (void)tcsetattr(STDIN_FILENO,
+ TCSASOFT | TCSADRAIN, &clp->orig);
+ }
+
+ /* Stop the process group. */
+ (void)kill(0, SIGTSTP);
+
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-vendor
mailing list