rpms/nvi/EL-6 import.log, NONE, 1.1 nvi-01-additional_upstream_data.patch, NONE, 1.1 nvi-03-db4.patch, NONE, 1.1 nvi-04-confdefs.patch, NONE, 1.1 nvi-06-default_value_escapetime.patch, NONE, 1.1 nvi-07-flush_cache.patch, NONE, 1.1 nvi-08-lfs.patch, NONE, 1.1 nvi-08-safe_printf.patch, NONE, 1.1 nvi-08-tempfile_umask.patch, NONE, 1.1 nvi-09-casting.patch, NONE, 1.1 nvi-10-no_one_line_visual.patch, NONE, 1.1 nvi-11-backward_sentence_moving.patch, NONE, 1.1 nvi-12-horiz_scroll_count.patch, NONE, 1.1 nvi-13-widechar_horrors.patch, NONE, 1.1 nvi-14-private_regex_fixes.patch, NONE, 1.1 nvi-15-search_word.patch, NONE, 1.1 nvi-16-manpage_errors.patch, NONE, 1.1 nvi-17-tutorial_typos.patch, NONE, 1.1 nvi-18-dbpagesize_binpower.patch, NONE, 1.1 nvi-19-include_term_h.patch, NONE, 1.1 nvi-20-glibc_has_grantpt.patch, NONE, 1.1 nvi-21-exrc_writability_check.patch, NONE, 1.1 nvi-23-debian_alternatives.patch, NONE, 1.1 nvi-24-fallback_to_dumb_term.patch, NONE, 1.1 nvi-25-manpage_note_dropped_F.patch, NONE, 1.1 nvi-26-trailing_tab_segv.patch, NONE, 1.1 nvi-27-support_C_locale.patch, NONE, 1.1 nvi-28-regex_widechar.patch, NONE, 1.1 nvi-29-file_backup.patch, NONE, 1.1 nvi.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Matej Cepl mcepl at fedoraproject.org
Sat Jun 26 08:36:51 UTC 2010


Author: mcepl

Update of /cvs/pkgs/rpms/nvi/EL-6
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv31741/EL-6

Modified Files:
	.cvsignore sources 
Added Files:
	import.log nvi-01-additional_upstream_data.patch 
	nvi-03-db4.patch nvi-04-confdefs.patch 
	nvi-06-default_value_escapetime.patch nvi-07-flush_cache.patch 
	nvi-08-lfs.patch nvi-08-safe_printf.patch 
	nvi-08-tempfile_umask.patch nvi-09-casting.patch 
	nvi-10-no_one_line_visual.patch 
	nvi-11-backward_sentence_moving.patch 
	nvi-12-horiz_scroll_count.patch nvi-13-widechar_horrors.patch 
	nvi-14-private_regex_fixes.patch nvi-15-search_word.patch 
	nvi-16-manpage_errors.patch nvi-17-tutorial_typos.patch 
	nvi-18-dbpagesize_binpower.patch nvi-19-include_term_h.patch 
	nvi-20-glibc_has_grantpt.patch 
	nvi-21-exrc_writability_check.patch 
	nvi-23-debian_alternatives.patch 
	nvi-24-fallback_to_dumb_term.patch 
	nvi-25-manpage_note_dropped_F.patch 
	nvi-26-trailing_tab_segv.patch nvi-27-support_C_locale.patch 
	nvi-28-regex_widechar.patch nvi-29-file_backup.patch nvi.spec 
Log Message:
Initial import to Fedora CVS


--- NEW FILE import.log ---
nvi-1_81_6-2_el6:EL-6:nvi-1.81.6-2.el6.src.rpm:1277541376

nvi-01-additional_upstream_data.patch:
 FAQ                       |  160 +++++
 docs/changelog            | 1102 ++++++++++++++++++++++++++++++++++
 docs/tutorial/vi.advanced | 1458 ++++++++++++++++++++++++++++++++++++++++++++++
 docs/tutorial/vi.beginner |  741 +++++++++++++++++++++++
 4 files changed, 3461 insertions(+)

--- NEW FILE nvi-01-additional_upstream_data.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 01additional_upstream_data.dpatch by <hesso at pool.math.tu-berlin.de>
##
## DP: A few documentation files cherry-picked from the last stable
## DP: release tarball, because they are missing in later development
## DP: branch releases.

@DPATCH@
diff -Naur nvi-1.81.6.orig/nvi-1.79/FAQ nvi-1.81.6/nvi-1.79/FAQ
--- nvi-1.81.6.orig/nvi-1.79/FAQ	1970-01-01 01:00:00.000000000 +0100
+++ nvi-1.81.6/nvi-1.79/FAQ	1996-10-14 15:52:46.000000000 +0200
@@ -0,0 +1,160 @@
+@(#)FAQ	8.13 (Berkeley) 10/14/96
+
+Q: How can I get vi to display my character set?
+A: Vi uses the C library routine isprint(3) to determine if a character
+   is printable, or should be displayed as an octal or hexadecimal value
+   on the screen.  Generally, if vi is displaying printable characters
+   in octal/hexadecimal forms, your environment is not configured correctly.
+   Try looking at the man pages that allow you to configure your locale.
+   For example, to configure an ISO 8859-1 locale under Solaris using csh,
+   you would do:
+
+	setenv LANG C
+	setenv LC_CTYPE iso_8859_1
+
+   Other LC_CTYPE systems/values that I'm told work:
+
+   System	Value
+   ======	=====
+   FreeBSD	lt_LN.ISO_8859-1
+   HP-UX  9.X	american.iso88591
+   HP-UX 10.X	en_US.iso88591
+   SunOS  4.X	iso_8859_1
+   SunOS  5.X	iso_8859_1
+
+   If there's no other solution, you can use the print and noprint edit
+   options of vi to specify that a specific character is printable or not
+   printable.
+	
+Q: My map won't work!
+A: One thing that you should immediately check if a vi map doesn't work
+   is if depends on the final cursor position after a P or p command.
+   Historic vi's were inconsistent as to the final position of the cursor,
+   and, to make matter worse, the final cursor position also depended on
+   whether the put text came from a named or unnamed buffer!  Vi follows
+   the POSIX 1003.2 standard on this one, and makes this consistent, always
+   placing the cursor on the first character.
+
+Q: I'm using ksh or csh as my vi edit option shell value, and file
+   expansions don't work right!
+A: The problem may be in your ksh or csh startup files, e.g., .cshrc.  Vi
+   executes the shell to do name expansion, and the shell generally reads
+   its startup files.  If the startup files are not correctly configured
+   for non-interactive use, e.g., they always echo a prompt to the screen,
+   vi will be unable to parse the output and things will not work
+   correctly.
+
+Q: How does the iclower edit option differ from the ignorecase (i.e. ic)
+   edit option?
+A: The difference is that the ignorecase edit option always ignores the
+   case of letters in the Regular Expression (RE), and the iclower edit
+   option only ignores the case if there are no upper-case letters in the
+   RE.  If any upper-case letters appear in the Regular Expression, then
+   it will be treated case-sensitively, as if the ignorecase edit option
+   was not set.
+
+Q: When I edit binary files, vi appends a <newline> to the last line!
+A: This is historic practice for vi, and further, it's required by the
+   POSIX 1003.2 standard.  My intent is to provide a command line and/or
+   edit option to turn this behavior off when I switch to version 2.0 of
+   the Berkeley DB package.
+
+Q: My cursor keys don't work when I'm in text input mode!
+A: A common problem over slow links is that the set of characters sent by
+   the cursor keys don't arrive close enough together for vi to understand
+   that they are a single keystroke, and not separate keystrokes.  Try
+   increasing the value of the escapetime edit option, which will cause
+   vi to wait longer before deciding that the <escape> character that
+   starts cursor key sequences doesn't have any characters following it.
+
+Q: When I edit some files, vi seems to hang forever, and I have to kill it.
+A: Vi uses flock(2) and fcntl(2) to do file locking.  When it attempts to
+   acquired a lock for a file on an NFS mounted filesystem, it can hang
+   for a very long (perhaps infinite) period of time.  Turning off the
+   "lock" edit option will keep vi from attempting to acquire any locks
+   on the files you edit.
+
+Q: When I compile vi I get lots of warnings about pointer assignments
+   being incompatible!
+A: Vi is partially written to support wide characters.  When this code
+   interfaces with the code that doesn't yet support wide characters,
+   the pointer types clash.  This will hopefully be fixed in the near
+   future, but I've been saying that for awhile, now.
+
+Q: I get jumpy scrolling behavior in the screen!
+A: This is almost certainly a problem with the system's terminfo or
+   termcap information for your terminal.  If the terminfo/termcap entry
+   doesn't have the settable scrolling region capabilities, or the more
+   powerful scrolling commands, these behaviors can result.  Historic
+   implementations of vi, and some of the vi clones, don't suffer from
+   this problem because they wrote their own screen support instead of
+   using the curses library.
+
+   The solution is to find a good terminfo or termcap entry for your
+   terminal, which will fix the problem for all of the applications on
+   your system, not just vi.  Eric Raymond maintains the freely
+   redistributable termcap/terminfo entries.  They can be downloaded
+   from http://www.ccil.org/~esr/ncurses.html, or you can contact him
+   at esr at snark.thyrsus.com.
+
+Q: The entire screen repaints on every keystroke!
+A: Your system's curses implementation is broken.  You should use the
+   curses implementation provided with vi or a curses replacement such
+   as ncurses.  Eric Raymond is one of the maintainers of the freely
+   redistributable ncurses package.  You can download ncurses from
+   http://www.ccil.org/~esr/ncurses.html, or you can contact him at
+   esr at snark.thyrsus.com.
+
+Q: When I use vi on a Sun console (terminal type sun-34) the screen
+   is occasionally trashed, usually when exiting vi!
+A: The Sun console can't handle the 'al' capability of the termcap
+   entry (the il1 capability of terminfo entries).  If you delete that
+   entry from your terminfo/termcap information everything should work
+   correctly.
+
+Q: I don't have a version of ctags (or I have ctags, but it doesn't tag
+   nearly enough things)!
+A: There's a version of ctags available on the 4.4BSD-Lite distributions,
+   as well as the FreeBSD, NetBSD, Linux and GNU distributions.  Or, you
+   might want to try Exuberant Ctags:
+
+	Title:		Exuberant Ctags
+	Version:	1.3
+	Entered-date:	16JUN96
+	Description:
+	    A better ctags which generates tags for all possible tag types:
+	    macro definitions, enumerated values (values inside enum{...}),
+	    function and method definitions, enum/struct/union tags, external
+	    function prototypes (optional), typedefs, and variable
+	    declarations. It is far less easily fooled by code containing #if
+	    preprocessor conditional constructs, using a conditional path
+	    selection algorithm to resolve complicated choices, and a
+	    fall-back algorithm when this one fails. Can also be used to print
+	    out a list of selected objects found in source files.
+	Keywords:	ctags, tags, exuberant
+	Author:		darren at sirsi.com (Darren Hiebert)
+			darren at hiwaay.net (Darren Hiebert)
+	Maintained-by:	darren at sirsi.com (Darren Hiebert)
+			darren at hiwaay.net (Darren Hiebert)
+	Primary-site:	sunsite.unc.edu /pub/Linux/devel/lang/c
+			27kB ctags-1.3.tar.gz
+	Alternate-site:	ftp.halcyon.com /local/gvr
+			27kB ctags-1.3.tar.gz
+	Original-site:
+	Platforms:	UNIX, MSDOS, WindowsNT, Windows95, OS/2, Amiga
+	Copying-policy:	Public domain
+
+Q: When I update a file I already have open, and use :e to reread it, I
+   get nul's for the rest of the file!
+A: Your system's implementation of mmap(2) has a bug; you will have to
+   exit vi and re-execute it.
+
+Q: Where can I get cscope?
+A: Cscope is available on UNIXWare System V Release 4.0 variants such as
+   Sun Solaris 2.x (/opt/SUNWspro/bin) and UNIXWare System V Release 4.1.
+
+   You can buy version 13.3 source with an unrestricted license for $400
+   from AT&T Software Solutions by calling +1-800-462-8146.  Binary
+   redistribution of cscope is an additional $1500, one-time flat fee.
+
+   For more information, see http://www.unipress.com/att/new/cscope.html.
diff -Naur nvi-1.81.6.orig/docs/changelog nvi-1.81.6/docs/changelog
--- nvi-1.81.6.orig/nvi-1.79/docs/changelog	1970-01-01 01:00:00.000000000 +0100
+++ nvi-1.81.6/nvi-1.79/docs/changelog	1996-10-23 15:39:08.000000000 +0200
@@ -0,0 +1,1102 @@
+1.78 -> 1.79 (10/23/96)
+	+ Rename delete() to del(), for C++.
+	+ Add Spanish to the list of translations.
+	+ Update to Perl 5.003_06, and other Perl interpreter updates.
+	+ Update the set-edit-option interface for the scripting languages.
+	+ Rework ex command parsing to match historic practice for backslash
+	  escaped <newline> characters inside of global commands.
+	+ Enhance the comment edit option to skip C++ comments.
+	+ Change installation to configure the recovery shell script to match
+	  the system pathnames and to install it into the vi data directory.
+	  Move the recover script into the build directory, and delete the
+	  recover directory.
+	+ Enhance LynxOS support.
+1.76 -> 1.78 (10/01/96)
+	+ Fix bugs when both the leftright scrolling and number edit options
+	  were on.
+	+ Fix bug where splitting in the middle of the screen could repaint
+	  incorrectly.
+	+ Fix first-nul in input bug, where random garbage was inserted.
+	+ Correct search and mark-as-motion-command bug, it's a line mode
+	  action if the search starts at or before the first non<blank>.
+	+ Fix bug autoindent bug, where ^D could shift too far in the line.
+	+ Fix core dump where ! command called from the .exrc file.
[...3086 lines suppressed...]
+First, type {/line /^M}.  This puts us on the word 'line' in Line 4
+(the blank in the search string is important!).  Next, type {e}.  The 'e' puts
+us at the end of the word.  Now, type {as^[  (^[ is the escape character)}.  
+The 'a' puts us in insert mode, AFTER the current character.  We appended the 
+'s', and the escape ^[ ended the insert mode.
+
+The difference between {i} (insert) and {a} (append) is that {i} begins
+inserting text BEFORE the cursor, and {a} begins inserting AFTER the cursor.
+
+Now type {Aa' command.^[}.  The cursor is moved to the end of the line and the
+string following {A} is inserted into the text.  Line 4 should now look like
+line 3.
+
+Just as {A} moves you to the end of the line to begin inserting, {I} would
+begin inserting at the FRONT of the line.
+
+To begin the insertion of a line after the cursor line, type {o}.  To insert a
+line before the cursor line, type {O}.  In other words {o123^[} is equivalent
+to {A^M123^[}, and {O123^[} is equivalent to {I123^M^[}.  The text after the
+{o} or {O} is ended with an escape ^[.
+
+This paragraph contains information that is terminal dependent: you will just
+have to experiment to discover what your terminal does.  Once in the insert
+mode, if you make a mistake in the typing, ^H will delete the previous
+character up to the beginning of the current insertion.  ^W will delete the
+previous word, and one of ^U, @, or ^X will delete the current line (up to the
+beginning of the current insertion).  You will need to experiment with ^U, @,
+and ^X to determine which works for your terminal.
+
+Section 23: {f} {x} {X} {w} {l} {r} {R} {s} {S} {J}
+
+Position the cursor at the beginning of line 5 and {z^M}:
+
+Line 5: The line as it should be.
+Line 6: The line as it shouldn't be.
+
+To make Line 6 like Line 5, we have to delete the 'n', the apostrophe, and the
+'t'.  There are several ways to position ourselves at the 'n'.  Choose
+whichever one suits your fancy:
+
+{/n't/^M}
+{^M7w6l}  or  {^M7w6 } (note the space)
+{^M3fn}  (finds the 3rd 'n' on the line)
+
+Now {xxx} will delete the three characters, as will {3x}.
+
+Note that {X} deletes the character just BEFORE the cursor, as opposed
+to the character AT the cursor.
+
+Position the cursor at line 7 and {z^M}:
+
+Line 7: The line as it would be.
+Line 8: The line as it could be.
+
+To change line 8 into line 7 we need to change the 'c' in 'could' into a 'w'.
+The 'r' (replace) command was designed for this.  Typing {rc} is the same as
+typing {xic^[} (i.e.  delete the 'bad' character and insert the correct
+new character).  Therefore, assuming that you have positioned the cursor on the
+'c' of 'could', the easiest way to change 'could' into 'would' is {rw}.
+
+If you would like to now change the 'would' into 'should', use the substitute
+command, 's': {ssh^[}.  The difference between 'r' and 's' is that 'r'
+(replace) replaces the current character with another character, while 's'
+(substitute) substitutes the current character with a string, ended with an
+escape.
+
+The capital letter version of replace {R} replaces each character by a
+character one at a time until you type an escape, ^[.  The 'S' command
+substitutes the whole line.
+
+Position your cursor at the beginning of line 9 and {z^M}.
+
+Line  9: Love is a many splendored thing.
+Line 10: Love is a most splendored thing.
+
+To change line 10 into line 9, position the cursor at the beginning of 'most',
+and type {Rmany^[}.
+
+You may have noticed that, when inserting text, a new line is formed by typing
+{^M}.  When changing, replacing, or substituting text you can make a new line
+by typing {^M}.  However, neither {x} nor {X} will remove ^M to make two lines 
+into one line.  To do this, position the cursor on the first of the two lines 
+you wish to make into a single line and type {J} (uppercase J for 'Join').
+
+Section 24: {u} {U}
+
+Finally, before we review, let's look at the undo command.  Position
+your cursor on line 11 below and {z^M}.
+
+Line 11: The quick brown fox jumped over the lazy hound dog.
+Line 12: the qwick black dog dumped over the laxy poune fox.
+
+Type the following set of commands, and observe carefully the effect of each 
+of the commands:
+
+{/^Line 12:/^M} {ft} {rT} {fw} {ru} {w} {Rbrown fox^[} {w} {rj} 
+{fx} {rz} {w} {Rhound dog^[}
+
+Line 12 now matches line 11.  Now type {U} - capital 'U'.  And line 12 now
+looks like it did before you typed in the command strings.  Now type:
+
+{ft} {rT} {fw} {ru} {^M} {^M}
+
+and then type {u}:  the cursor jumps back to the line containing the second
+change you made and 'undoes' it.  That is, {U} 'undoes' all the changes on the
+line, and {u} 'undoes' only the last change.  Type {u} several times and
+observe what happens: {u} can undo a previous {u}!
+
+Caveat: {U} only works as long as the cursor is still on the line.  Move the
+cursor off the line and {U} will have no effect, except to possibly beep at
+you.  However, {u} will undo the last change, no matter where it occurred.
+
+Section 25: review
+
+At this point, you have all the commands you need in order to make use of vi.
+The remainder of this tutorial will discuss variations on these commands as
+well as introduce new commands that make the job of editing more efficient.
+Here is a brief review of the basic commands we have covered.  They are listed
+in the order of increasing complexity and/or decreasing necessity (to say that
+a command is less necessary is not to say that it is less useful!).  These
+commands allow you to comfortably edit any text file.  There are other
+commands that will make life easier but will require extra time to learn,
+obviously.  You may want to consider setting this tutorial aside for several
+weeks and returning to it later after gaining experience with vi and getting
+comfortable with it.  The convenience of some of the more exotic commands may
+then be apparent and worth the extra investment of time and effort
+required to master them.
+
+to get into the editor from Unix:           {vi filename}
+to exit the editor
+      saving all changes                    {ZZ} or {:wq^M}
+      throwing away all changes             {:q!^M}
+      when no changes have been made        {:q^M}
+save a file without exiting the editor      {:w^M}
+write the file into another file            {:w filename^M}
+insert text 
+      before the cursor                     {i ...text... ^[}
+      at the beginning of the line          {I ...text... ^[}
+      after the cursor (append)             {a ...text... ^[}
+      at the end of the line                {A ...text... ^[}
+      after the current line                {o ...text... ^[}
+      before the current line               {O ...text... ^[}
+delete the character  ...
+      under the cursor                      {x}
+      to the left of the cursor             {X}
+delete n characters                         {nx} or {nX}  (for n a number)
+make two lines into one line (Join)         {J}
+find a string in the file ...
+      searching forward                     {/ ...string... /^M}
+      searching backwards                   {? ...string... ?^M}
+repeat the last search command              {n}
+repeat the last search command in the
+  opposite direction                        {N}
+find the character c on this line ...
+      searching forward                     {fc}
+      searching backward                    {Fc}
+repeat the last 'find character' command    {;}
+replace a character with character x        {rx}
+substitute a single character with text     {s ...text... ^[}
+substitute n characters with text           {ns ...text... ^[}
+replace characters one-by-one with text     {R ...text... ^[}
+undo all changes to the current line        {U}
+undo the last single change                 {u}
+move forward in the file a "screenful"      {^F}
+move back in the file a "screenful"         {^B}
+move forward in the file one line           {^M} or {+}
+move backward in the file one line          {-}
+move to the beginning of the line           {0}
+move to the end of the line                 {$}
+move forward one word                       {w}
+move forward one word, ignoring punctuation {W}
+move forward to the end of the next word    {e}
+to the end of the word, ignoring punctuation{E}
+move backward one word                      {b}
+move back one word, ignoring punctuation    {B}
+return to the last line modified            {''}
+scroll a line onto the top of the screen    {^Y}
+scroll a line onto the bottom of the screen {^E}
+move "up" in the file a half-screen         {^U}
+move "down" in the file a half-screen       {^D}
+move the cursor to the top screen line      {H}
+move the cursor to the bottom screen line   {L}
+move the cursor to the middle line          {M}
+move LEFT one character position            {h} or {^H}
+move RIGHT one character position           {l} or { }
+move UP in the same column                  {k} or {^P}
+move DOWN in the same column                {j} or {^N}
+mark the current position, name it x        {mx}
+move to the line marked/named x             {'x}
+move to the character position named x      {`x}
+move to the beginning of the file           {1G}
+move to the end of the file                 {G}
+move to line 23 in the file                 {23G}
+repaint the screen with the cursor line
+       at the top of the screen             {z^M}
+       in the middle of the screen          {z.}
+       at the bottom of the screen          {z-}
+
+More information on vi can be found in the file vi.advanced, which you can
+peruse at your leisure.  From UNIX, type {vi.tut advanced^M}.  

nvi-03-db4.patch:
 msg.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- NEW FILE nvi-03-db4.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 03db4.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: libdb4 compatibility adjustments.

@DPATCH@
--- nvi-1.81.6.orig/common/msg.c	2009-02-26 14:26:58.350336128 +0100
+++ nvi-1.81.6/common/msg.c	2009-02-26 14:29:05.235335829 +0100
@@ -724,9 +724,18 @@
 		p = buf;
 	} else
 		p = file;
+	if (access(p, F_OK) != 0) {
+		if (first) {
+			first = 0;
+			return (1);
+		}
+		sp->db_error = ENOENT;
+		msgq_str(sp, M_DBERR, p, "%s");
+		return (1);
+	}
 	if ((sp->db_error = db_create(&db, 0, 0)) != 0 ||
 	    (sp->db_error = db->set_re_source(db, p)) != 0 ||
-	    (sp->db_error = db_open(db, NULL, DB_RECNO, 0, 0)) != 0) {
+	    (sp->db_error = db_open(db, NULL, DB_RECNO, DB_CREATE, 0)) != 0) {
 		if (first) {
 			first = 0;
 			return (1);

nvi-04-confdefs.patch:
 confdefs.h |    3 +++
 1 file changed, 3 insertions(+)

--- NEW FILE nvi-04-confdefs.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 04confdefs.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Help configure by decreeing that some headers are present.

@DPATCH@
diff -Naur nvi-1.81.6.orig/build/confdefs.h nvi-1.81.6/build/confdefs.h
--- nvi-1.81.6.orig/build/confdefs.h	1970-01-01 01:00:00.000000000 +0100
+++ nvi-1.81.6/build/confdefs.h	2008-05-01 18:05:00.000000000 +0200
@@ -0,0 +1,3 @@
+
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_SELECT_H 1

nvi-06-default_value_escapetime.patch:
 options.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE nvi-06-default_value_escapetime.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 06default_value_escapetime.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Increase the default 'escapetime' setting to accommodate slow lines.

@DPATCH@
diff -Naur nvi-1.81.6.orig/common/options.c nvi-1.81.6/common/options.c
--- nvi-1.81.6.orig/common/options.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/options.c	2008-05-01 18:06:18.000000000 +0200
@@ -356,7 +356,7 @@
 	(void)SPRINTF(b2, SIZE(b2),
 	    L("directory=%s"), (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s);
 	OI(O_TMP_DIRECTORY, b2);
-	OI(O_ESCAPETIME, L("escapetime=1"));
+	OI(O_ESCAPETIME, L("escapetime=3"));
 	OI(O_KEYTIME, L("keytime=6"));
 	OI(O_MATCHTIME, L("matchtime=7"));
 	(void)SPRINTF(b2, SIZE(b2), L("msgcat=%s"), _PATH_MSGCAT);

nvi-07-flush_cache.patch:
 db1.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

--- NEW FILE nvi-07-flush_cache.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 07flush_cache.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: No description.

@DPATCH@
diff -Naur nvi-1.81.6.orig/common/db1.c nvi-1.81.6/common/db1.c
--- nvi-1.81.6.orig/common/db1.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/db1.c	2008-05-01 18:07:58.000000000 +0200
@@ -262,8 +262,7 @@
 	}
 
 	/* Flush the cache, update line count, before screen update. */
-	if (lno <= ep->c_lno)
-		ep->c_lno = OOBLNO;
+	ep->c_lno = OOBLNO;
 	if (ep->c_nlines != OOBLNO)
 		--ep->c_nlines;
 
@@ -314,8 +313,7 @@
 	}
 
 	/* Flush the cache, update line count, before screen update. */
-	if (lno < ep->c_lno)
-		ep->c_lno = OOBLNO;
+	ep->c_lno = OOBLNO;
 	if (ep->c_nlines != OOBLNO)
 		++ep->c_nlines;
 
@@ -386,8 +384,7 @@
 	}
 
 	/* Flush the cache, update line count, before screen update. */
-	if (lno >= ep->c_lno)
-		ep->c_lno = OOBLNO;
+	ep->c_lno = OOBLNO;
 	if (ep->c_nlines != OOBLNO)
 		++ep->c_nlines;
 
@@ -459,8 +456,7 @@
 	}
 
 	/* Flush the cache, before logging or screen update. */
-	if (lno == ep->c_lno)
-		ep->c_lno = OOBLNO;
+	ep->c_lno = OOBLNO;
 
 	/* File now dirty. */
 	if (F_ISSET(ep, F_FIRSTMODIFY))

nvi-08-lfs.patch:
 exf.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- NEW FILE nvi-08-lfs.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 08lfs.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Insert a safety check to save large files from being overwritten.

@DPATCH@
diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
--- nvi-1.81.6.orig/common/exf.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/exf.c	2008-05-01 18:09:55.000000000 +0200
@@ -157,6 +157,18 @@
 	 */
 	if (file_spath(sp, frp, &sb, &exists))
 		return (1);
+        /*
+         * On LFS systems, it's possible that stat returned an error because
+         * the file is >2GB, which nvi would normally treat as "doesn't exist"
+         * and eventually overwrite. That's no good. Rather than mess with
+         * every stat() call in file_spath, we'll just check again here.
+         */
+        if (!exists && stat(frp->name, &sb)) {
+            if (errno == EOVERFLOW) {
+                msgq(sp, M_ERR,  "File too large (>2GB, probably)");
+                goto err;
+            }
+        }
 
 	/*
 	 * Check whether we already have this file opened in some

nvi-08-safe_printf.patch:
 exf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE nvi-08-safe_printf.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 08safe_printf.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: No description.

@DPATCH@
diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
--- nvi-1.81.6.orig/common/exf.c	2008-05-01 18:10:20.000000000 +0200
+++ nvi-1.81.6/common/exf.c	2008-05-01 18:10:30.000000000 +0200
@@ -1075,7 +1075,7 @@
 			*--s = '.';
 		}
 	}
-	msgq(sp, M_INFO, s);
+	msgq(sp, M_INFO, "%s", s);
 	if (nf)
 		FREE_SPACE(sp, p, 0);
 	return (0);

nvi-08-tempfile_umask.patch:
 exf.c |    5 +++++
 1 file changed, 5 insertions(+)

--- NEW FILE nvi-08-tempfile_umask.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 08tempfile_umask.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: No description.

@DPATCH@
diff -Naur nvi-1.81.6.orig/common/exf.c nvi-1.81.6/common/exf.c
--- nvi-1.81.6.orig/common/exf.c	2008-05-01 18:10:45.000000000 +0200
+++ nvi-1.81.6/common/exf.c	2008-05-01 18:13:23.000000000 +0200
@@ -207,16 +207,21 @@
 	 */
 	oname = frp->name;
 	if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) {
+		mode_t orig_umask;
 		if (opts_empty(sp, O_TMP_DIRECTORY, 0))
 			goto err;
+		orig_umask = umask(0);
+		umask(orig_umask & 0177);
 		(void)snprintf(tname, sizeof(tname),
 		    "%s/vi.XXXXXX", O_STR(sp, O_TMP_DIRECTORY));
 		if ((fd = mkstemp(tname)) == -1) {
+			umask(orig_umask);
 			msgq(sp, M_SYSERR,
 			    "237|Unable to create temporary file");
 			goto err;
 		}
 		(void)close(fd);
+		umask(orig_umask);
 
 		if (frp->name == NULL)
 			F_SET(frp, FR_TMPFILE);

nvi-09-casting.patch:
 v_ch.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- NEW FILE nvi-09-casting.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 09casting.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: No description.

@DPATCH@
diff -Naur nvi-1.81.6.orig/vi/v_ch.c nvi-1.81.6/vi/v_ch.c
--- nvi-1.81.6.orig/vi/v_ch.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/v_ch.c	2008-05-01 18:14:03.000000000 +0200
@@ -165,7 +165,7 @@
 	endp = (startp = p) + len;
 	p += vp->m_start.cno;
 	for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) {
-		while (++p < endp && *p != key);
+		while (++p < endp && *p != (char) key);
 		if (p == endp) {
 			notfound(sp, key);
 			return (1);
@@ -247,7 +247,7 @@
 	endp = p - 1;
 	p += vp->m_start.cno;
 	for (cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; cnt--;) {
-		while (--p > endp && *p != key);
+		while (--p > endp && *p != (char) key);
 		if (p == endp) {
 			notfound(sp, key);
 			return (1);

nvi-10-no_one_line_visual.patch:
 vi.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- NEW FILE nvi-10-no_one_line_visual.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10no_one_line_visual.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Catch segfaults when the screen is only one line high.

@DPATCH@
diff -Naur nvi-1.81.6.orig/vi/vi.c nvi-1.81.6/vi/vi.c
--- nvi-1.81.6.orig/vi/vi.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/vi.c	2008-05-01 18:15:14.000000000 +0200
@@ -974,6 +974,14 @@
 	sp->rows = vip->srows = O_VAL(sp, O_LINES);
 	sp->cols = O_VAL(sp, O_COLUMNS);
 	sp->t_rows = sp->t_minrows = O_VAL(sp, O_WINDOW);
+	/*
+	 * To avoid segfaults on terminals with only one line,
+	 * catch this corner case now and die explicitly.
+	 */
+	if (sp->t_rows == 0) {
+		(void)fprintf(stderr, "Error: Screen too small for visual mode.\n");
+		return 1;
+	}
 	if (sp->rows != 1) {
 		if (sp->t_rows > sp->rows - 1) {
 			sp->t_minrows = sp->t_rows = sp->rows - 1;

nvi-11-backward_sentence_moving.patch:
 v_sentence.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE nvi-11-backward_sentence_moving.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 11backward_sentence_moving.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: No description.

@DPATCH@
diff -Naur nvi-1.81.6.orig/vi/v_sentence.c nvi-1.81.6/vi/v_sentence.c
--- nvi-1.81.6.orig/vi/v_sentence.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/v_sentence.c	2008-05-01 18:15:37.000000000 +0200
@@ -291,7 +291,7 @@
 			 * we can end up where we started.  Fix it.
 			 */
 			if (vp->m_start.lno != cs.cs_lno ||
-			    vp->m_start.cno != cs.cs_cno)
+			    vp->m_start.cno > cs.cs_cno)
 				goto okret;
 
 			/*

nvi-12-horiz_scroll_count.patch:
 vs_refresh.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE nvi-12-horiz_scroll_count.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 12horiz_scroll_count.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: No description.

@DPATCH@
diff -Naur nvi-1.81.6.orig/vi/vs_refresh.c nvi-1.81.6/vi/vs_refresh.c
--- nvi-1.81.6.orig/vi/vs_refresh.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/vs_refresh.c	2008-05-01 18:16:01.000000000 +0200
@@ -569,7 +569,7 @@
 		 * for the number option offset.
 		 */
 		cnt = vs_columns(sp, NULL, LNO, &CNO, NULL);
-		if (O_ISSET(sp, O_NUMBER))
+		if (O_ISSET(sp, O_NUMBER) && cnt)
 			cnt -= O_NUMBER_LENGTH;
 
 		/* Adjust the window towards the beginning of the line. */

nvi-13-widechar_horrors.patch:
 v_increment.c |   14 +++++++++++---
 vs_msg.c      |    4 ++--
 2 files changed, 13 insertions(+), 5 deletions(-)

--- NEW FILE nvi-13-widechar_horrors.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 13widechar_horrors.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: This patch tries to cope with the fact that widechar support
## DP: in nvi is at best rudimentary.
## DP: Hunk 1)
## DP: * Due to "ch = *t", this code is not wide-char aware, so
## DP:   cast the value to a proper type so the KEY_ macros make
## DP:   the right choice.
## DP: Hunk 2)
## DP: * Printing of the in-/decreased number back into the screen
## DP:   buffer is not widechar-aware, either. Add a dirty fix.
## DP:   Cf. #497349.

@DPATCH@
--- nvi-1.81.6.orig/vi/vs_msg.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/vs_msg.c	2009-03-01 14:51:08.211414132 +0100
@@ -472,10 +472,10 @@
 			 */
 			if (ch == '\t')
 				ch = ' ';
-			chlen = KEY_LEN(sp, ch);
+			chlen = KEY_LEN(sp, (unsigned char)ch);
 			if (cbp + chlen >= ecbp)
 				FLUSH;
-			for (kp = KEY_NAME(sp, ch); chlen--;)
+			for (kp = KEY_NAME(sp, (unsigned char)ch); chlen--;)
 				*cbp++ = *kp++;
 		}
 		if (cbp > cbuf)
--- nvi-1.81.6.orig/vi/v_increment.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/vi/v_increment.c	2009-03-01 15:12:50.950415874 +0100
@@ -57,7 +57,7 @@
 	long change, ltmp, lval;
 	size_t beg, blen, end, len, nlen, wlen;
 	int base, isempty, rval;
-	char *ntype, nbuf[100];
+	char *ntype, nbuf[100 * sizeof(CHAR_T)];
 	CHAR_T *bp, *p, *t;
 
 	/* Validate the operator. */
@@ -202,7 +202,7 @@
 		/* If we cross 0, signed numbers lose their sign. */
 		if (lval == 0 && ntype == fmt[SDEC])
 			ntype = fmt[DEC];
-		nlen = snprintf(nbuf, sizeof(nbuf), ntype, lval);
+		nlen = snprintf(nbuf, sizeof(nbuf)/sizeof(CHAR_T), ntype, lval);
 	} else {
 		if ((nret = nget_uslong(sp, &ulval, t, NULL, base)) != NUM_OK)
 			goto err;
@@ -224,7 +224,15 @@
 		if (base == 16)
 			wlen -= 2;
 
-		nlen = snprintf(nbuf, sizeof(nbuf), ntype, wlen, ulval);
+		nlen = snprintf(nbuf, sizeof(nbuf)/sizeof(CHAR_T), ntype, wlen, ulval);
+	}
+
+	/* Inflate the printed char buffer to CHAR_T elements if necessary */
+	if (sizeof(CHAR_T) > sizeof(char)) {
+		int nlen_inflate;
+		for (nlen_inflate = nlen; nlen_inflate >= 0; nlen_inflate--) {
+			((CHAR_T *)nbuf)[nlen_inflate] = nbuf[nlen_inflate];
+		}
 	}
 
 	/* Build the new line. */

nvi-14-private_regex_fixes.patch:
 regcomp.c |    3 ++-
 regexec.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

--- NEW FILE nvi-14-private_regex_fixes.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 14private_regex_fixes.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Fixes to the private regex library; includes fix for #523934.

@DPATCH@
diff -Naur regex.orig/regcomp.c regex/regcomp.c
--- nvi-1.81.6.orig/regex/regcomp.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/regex/regcomp.c	2008-05-01 18:37:57.000000000 +0200
@@ -606,7 +606,8 @@
 		REQUIRE(starordinary, REG_BADRPT);
 		/* FALLTHROUGH */
 	default:
-		ordinary(p, c &~ BACKSL);
+	  /* ordinary(p, c &~ BACKSL); -- Fix potential overflow */
+	        ordinary(p, c & 0xff);
 		break;
 	}
 
diff -Naur regex.orig/regexec.c regex/regexec.c
--- nvi-1.81.6.orig/regex/regexec.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/regex/regexec.c	2008-05-01 18:38:00.000000000 +0200
@@ -63,7 +63,7 @@
 
 /* macros for manipulating states, small version */
 #define	states	int
-#define	states1	states		/* for later use in regexec() decision */
+typedef states states1;		/* for later use in regexec() decision */
 #define	CLEAR(v)	((v) = 0)
 #define	SET0(v, n)	((v) &= ~(1 << (n)))
 #define	SET1(v, n)	((v) |= 1 << (n))

nvi-15-search_word.patch:
 v_search.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- NEW FILE nvi-15-search_word.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 15search_word.dpatch by  Al Viro <viro at ZenIV.linux.org.uk>
##
## DP: Fix {^A} command. (End-of-word was not included in search
## DP: regexp leading to false positives.)

@DPATCH@
--- nvi-1.81.6.orig/vi/v_search.c	2007-11-18 11:41:42.000000000 -0500
+++ nvi-1.81.6/vi/v_search.c	2009-03-05 15:37:37.000000000 -0500
@@ -322,16 +322,17 @@
 v_searchw(SCR *sp, VICMD *vp)
 {
 	size_t blen, len;
+	size_t olen = STRLEN(VIP(sp)->keyw);
 	int rval;
 	CHAR_T *bp, *p;
 
-	len = VIP(sp)->klen + RE_WSTART_LEN + RE_WSTOP_LEN;
+	len = olen + RE_WSTART_LEN + RE_WSTOP_LEN;
 	GET_SPACE_RETW(sp, bp, blen, len);
 	MEMCPY(bp, RE_WSTART, RE_WSTART_LEN); 
 	p = bp + RE_WSTART_LEN;
-	MEMCPY(p, VIP(sp)->keyw, VIP(sp)->klen);
-	p += VIP(sp)->klen;
+	MEMCPY(p, VIP(sp)->keyw, olen);
+	p += olen;
 	MEMCPY(p, RE_WSTOP, RE_WSTOP_LEN); 
 
 	rval = v_search(sp, vp, bp, len, SEARCH_SET, FORWARD);

nvi-16-manpage_errors.patch:
 vi.1 |  236 ++++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 123 insertions(+), 113 deletions(-)

--- NEW FILE nvi-16-manpage_errors.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 16manpage_errors.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Fix a truckload of roff markup glitches.

@DPATCH@
diff -Naur nvi-1.81.6.orig/docs/vi.man/vi.1 nvi-1.81.6/docs/vi.man/vi.1
--- nvi-1.81.6.orig/docs/vi.man/vi.1	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/docs/vi.man/vi.1	2008-05-01 18:17:59.000000000 +0200
@@ -17,35 +17,35 @@
 .SH SYNOPSIS
 .B ex
 [\c
-.B -eFRrSsv\c
+.B \-eFRrSsv\c
 ] [\c
-.BI -c " cmd"\c
+.BI \-c " cmd"\c
 ] [\c
-.BI -t " tag"\c
+.BI \-t " tag"\c
 ] [\c
-.BI -w " size"\c
+.BI \-w " size"\c
 ] [file ...]
 .br
 .B vi
 [\c
-.B -eFlRrSv\c
+.B \-eFlRrSv\c
 ] [\c
-.BI -c " cmd"\c
+.BI \-c " cmd"\c
 ] [\c
-.BI -t " tag"\c
+.BI \-t " tag"\c
 ] [\c
-.BI -w " size"\c
+.BI \-w " size"\c
 ] [file ...]
 .br
 .B view
 [\c
-.B -eFRrSv\c
+.B \-eFRrSv\c
 ] [\c
-.BI -c " cmd"\c
+.BI \-c " cmd"\c
 ] [\c
-.BI -t " tag"\c
+.BI \-t " tag"\c
 ] [\c
-.BI -w " size"\c
+.BI \-w " size"\c
 ] [file ...]
 .SH LICENSE
 The vi program is freely redistributable.  You are welcome to copy,
@@ -57,7 +57,7 @@
 .I \&Vi
 is a screen oriented text editor.
 .I \&Ex
-is a line-oriented text editor.
+is a line\(hyoriented text editor.
 .I \&Ex
 and
 .I \&vi
@@ -66,7 +66,7 @@
 .I View
 is the equivalent of using the
 .B \-R
-(read-only) option of
+(read\(hyonly) option of
 .IR \&vi .
 .PP
 This manual page is the one provided with the
@@ -75,7 +75,7 @@
 .I ex/vi
 text editors.
 .I Nex/nvi
-are intended as bug-for-bug compatible replacements for the original
+are intended as bug\(hyfor\(hybug compatible replacements for the original
 Fourth Berkeley Software Distribution (4BSD)
 .I \&ex
 and
@@ -93,7 +93,7 @@
 editor before this manual page.
 If you're in an unfamiliar environment, and you absolutely have to
 get work done immediately, read the section after the options
-description, entitled ``Fast Startup''.
+description, entitled \(lqFast Startup\(rq.
 It's probably enough to get you going.
 .PP
 The following options are available:
@@ -105,7 +105,7 @@
 Particularly useful for initial positioning in the file, however
 .B cmd
 is not limited to positioning commands.
-This is the POSIX 1003.2 interface for the historic ``+cmd'' syntax.
+This is the POSIX 1003.2 interface for the historic \(lq+cmd\(rq syntax.
 .I Nex/nvi
 supports both the old and new syntax.
 .TP
@@ -122,7 +122,7 @@
 Start editing with the lisp and showmatch options set.
 .TP
 .B \-R
-Start editing in read-only mode, as if the command name was
+Start editing in read\(hyonly mode, as if the command name was
 .IR view ,
 or the
 .B readonly
@@ -151,7 +151,7 @@
 Prompts, informative messages and other user oriented message
 are turned off,
 and no startup files or environmental variables are read.
-This is the POSIX 1003.2 interface for the historic ``\-'' argument.
+This is the POSIX 1003.2 interface for the historic \(lq\-\(rq argument.
 .I \&Nex/nvi
 supports both the old and new syntax.
 .TP
@@ -215,8 +215,8 @@
 There are commands that switch you into input mode.
 There is only one key that takes you out of input mode,
 and that is the <escape> key.
-(Key names are written using less-than and greater-than signs, e.g.
-<escape> means the ``escape'' key, usually labeled ``esc'' on your
+(Key names are written using less\(hythan and greater\(hythan signs, e.g.
+<escape> means the \(lqescape\(rq key, usually labeled \(lqesc\(rq on your
 terminal's keyboard.)
 If you're ever confused as to which mode you're in,
 keep entering the <escape> key until
@@ -227,9 +227,9 @@
 will beep at you if you try and do something that's not allowed.
 It will also display error messages.)
 .PP
-To start editing a file, enter the command ``vi file_name<carriage-return>''.
+To start editing a file, enter the command \(lqvi file_name<carriage\(hyreturn>\(rq.
 The command you should enter as soon as you start editing is
-``:set verbose showmode<carriage-return>''.
+\(lq:set verbose showmode<carriage\(hyreturn>\(rq.
 This will make the editor give you verbose error messages and display
 the current mode at the bottom of the screen.
 .PP
@@ -247,11 +247,11 @@
 .B l
 Move the cursor right one character.
 .TP
-.B <cursor-arrows>
+.B <cursor\(hyarrows>
 The cursor arrow keys should work, too.
 .TP
-.B /text<carriage-return>
-Search for the string ``text'' in the file,
+.B /text<carriage\(hyreturn>
+Search for the string \(lqtext\(rq in the file,
 and move the cursor to its first character.
 .PP
 The commands to enter new text are:
@@ -303,30 +303,30 @@
 .PP
 The commands to write the file are:
 .TP
-.B :w<carriage-return>
+.B :w<carriage\(hyreturn>
 Write the file back to the file with the name that you originally used
 as an argument on the
 .I \&vi
 command line.
 .TP
-.B ":w file_name<carriage-return>"
-Write the file back to the file with the name ``file_name''.
+.B ":w file_name<carriage\(hyreturn>"
+Write the file back to the file with the name \(lqfile_name\(rq.
 .PP
 The commands to quit editing and exit the editor are:
 .TP
-.B :q<carriage-return>
+.B :q<carriage\(hyreturn>
 Quit editing and leave vi (if you've modified the file, but not
 saved your changes,
 .I \&vi
 will refuse to quit).
 .TP
-.B :q!<carriage-return>
+.B :q!<carriage\(hyreturn>
 Quit, discarding any modifications that you may have made.
 .PP
 One final caution.
 Unusual characters can take up more than one column on the screen,
 and long lines can take up more than a single screen line.
-The above commands work on ``physical'' characters and lines,
+The above commands work on \(lqphysical\(rq characters and lines,
 i.e. they affect the entire line no matter how many screen lines it
 takes up and the entire character no matter how many screen columns
 it takes up.
@@ -339,87 +339,87 @@
 character.
 .PP
 .TP
-.B "[count] <control-A>"
+.B "[count] <control\(hyA>"
 Search forward
 .I count
 times for the current word.
 .TP
-.B "[count] <control-B>"
+.B "[count] <control\(hyB>"
 Page backwards
 .I count
 screens.
 .TP
-.B "[count] <control-D>"
+.B "[count] <control\(hyD>"
 Scroll forward
 .I count
 lines.
 .TP
-.B "[count] <control-E>"
+.B "[count] <control\(hyE>"
 Scroll forward
 .I count
 lines, leaving the current line and column as is, if possible.
 .TP
-.B "[count] <control-F>"
+.B "[count] <control\(hyF>"
 Page forward
 .I count
 screens.
 .TP
-.B "<control-G>"
+.B "<control\(hyG>"
 Display the file information.
 .TP
-.B "<control-H>"
+.B "<control\(hyH>"
 .TP
 .B "[count] h"
 Move the cursor back
 .I count
 characters in the current line.
 .TP
-.B "[count] <control-J>"
+.B "[count] <control\(hyJ>"
 .TP
-.B "[count] <control-N>"
+.B "[count] <control\(hyN>"
 .TP
 .B "[count] j"
 Move the cursor down
 .I count
 lines without changing the current column.
 .TP
-.B "<control-L>"
+.B "<control\(hyL>"
 .TP
-.B "<control-R>"
+.B "<control\(hyR>"
 Repaint the screen.
 .TP
-.B "[count] <control-M>"
+.B "[count] <control\(hyM>"
 .TP
 .B "[count] +"
 Move the cursor down
 .I count
 lines to the first nonblank character of that line.
 .TP
-.B "[count] <control-P>"
+.B "[count] <control\(hyP>"
 .TP
 .B "[count] k"
 Move the cursor up
 .I count
 lines, without changing the current column.
 .TP
-.B "<control-T>"
+.B "<control\(hyT>"
 Return to the most recent tag context.
 .TP
-.B "<control-U>"
+.B "<control\(hyU>"
 Scroll backwards
 .I count
 lines.
 .TP
-.B "<control-W>"
+.B "<control\(hyW>"
 Switch to the next lower screen in the window, or, to the first
 screen if there are no lower screens in the window.
 .TP
-.B "<control-Y>"
+.B "<control\(hyY>"
 Scroll backwards
 .I count
 lines, leaving the current line and column as is, if possible.
 .TP
-.B "<control-Z>"
+.B "<control\(hyZ>"
 Suspend the current editor session.
 .TP
 .B "<escape>"
@@ -427,10 +427,10 @@
 .I \&ex
 commands or cancel partial commands.
 .TP
-.B "<control-]>"
+.B "<control\(hy]>"
 Push a tag reference onto the tag stack.
 .TP
-.B "<control-^>"
+.B "<control\(hy^>"
 Switch to the most recently edited file.
 .TP
 .B "[count] <space>"
@@ -440,10 +440,10 @@
 .I count
 characters without changing the current line.
 .TP
-.B "[count] ! motion shell-argument(s)"
+.B "[count] ! motion shell\(hyargument(s)"
 Replace text with results from a shell command.
 .TP
-.B "[count] # #|+|-"
+.B "[count] # #|+|\-"
 Increment or decrement the cursor number.
 .TP
 .B "[count] $"
@@ -457,7 +457,7 @@
 .TP
 .B "'<character>"
 .TP
-.B "`<character>"
+.B "\`<character>"
 Return to a context marked by the character
 .IR <character> .
 .TP
@@ -476,7 +476,7 @@
 .I count
 times.
 .TP
-.B "[count] -"
+.B "[count] \-"
 Move to first nonblank of the previous line,
 .I count
 times.
@@ -486,13 +486,13 @@
 .I \&vi
 command that modified text.
 .TP
-.B "/RE<carriage-return>"
+.B "/RE<carriage\(hyreturn>"
 .TP
-.B "/RE/ [offset]<carriage-return>"
+.B "/RE/ [offset]<carriage\(hyreturn>"
 .TP
-.B "?RE<carriage-return>"
+.B "?RE<carriage\(hyreturn>"
 .TP
-.B "?RE? [offset]<carriage-return>"
+.B "?RE? [offset]<carriage\(hyreturn>"
 .TP
 .B "N"
 .TP
@@ -527,15 +527,15 @@
 bigwords.
 .TP
 .B "[buffer] [count] C"
-Change text from the current position to the end-of-line.
+Change text from the current position to the end\(hyof\(hyline.
 .TP
 .B "[buffer] D"
-Delete text from the current position to the end-of-line.
+Delete text from the current position to the end\(hyof\(hyline.
 .TP
 .B "[count] E"
 Move forward
 .I count
-end-of-bigwords.
+end\(hyof\(hybigwords.
 .TP
 .B "[count] F <character>"
 Search
@@ -552,7 +552,7 @@
 .TP
 .B "[count] H"
 Move to the screen line
-.I "count - 1"
+.I "count \- 1"
 lines below the top of the screen.
 .TP
 .B "[count] I"
@@ -563,7 +563,7 @@
 .TP
 .B "[count] L"
 Move to the screen line
-.I "count - 1"
+.I "count \- 1"
 lines above the bottom of the screen.
 .TP
 .B " M"
@@ -614,7 +614,7 @@
 characters before the cursor.
 .TP
 .B "[buffer] [count] Y"
-Copy (or ``yank'')
+Copy (or \(lqyank\(rq)
 .I count
 lines into the specified buffer.
 .TP
@@ -637,7 +637,7 @@
 .TP
 .B "[count] _"
 Move down
-.I "count - 1"
+.I "count \- 1"
 lines, to the first nonblank character.
 .TP
 .B "[count] a"
@@ -657,7 +657,7 @@
 .B "[count] e"
 Move forward
 .I count
-end-of-words.
+end\(hyof\(hywords.
 .TP
 .B "[count] f<character>"
 Search forward,
@@ -709,12 +709,12 @@
 characters.
 .TP
 .B "[buffer] [count] y motion"
-Copy (or ``yank'')
+Copy (or \(lqyank\(rq)
 a text region specified by the
 .I count
 and motion into a buffer.
 .TP
-.B "[count1] z [count2] -|.|+|^|<carriage-return>"
+.B "[count1] z [count2] \-|.|+|^|<carriage\(hyreturn>"
 Redraw, optionally repositioning and resizing the screen.
 .TP
 .B "[count] {"
@@ -735,13 +735,20 @@
 .B "[count] ~"
 Reverse the case of the next
 .I count
-character(s).
+character(s), if the 
+.B tildeop
+option is
+.IR unset .
 .TP
 .B "[count] ~ motion"
 Reverse the case of the characters in a text region specified by the
 .I count
 and
-.IR motion .
+.IR motion ,
+if the 
+.B tildeop
+option is
+.IR set .
 .TP
 .B "<interrupt>"
 Interrupt the current operation.
@@ -755,18 +762,18 @@
 .B "<nul>"
 Replay the previous input.
 .TP
-.B "<control-D>"
+.B "<control\(hyD>"
 Erase to the previous
 .B shiftwidth
 column boundary.
 .TP
-.B "^<control-D>"
+.B "^<control\(hyD>"
 Erase all of the autoindent characters, and reset the autoindent level.
 .TP
-.B "0<control-D>"
+.B "0<control\(hyD>"
 Erase all of the autoindent characters.
 .TP
-.B "<control-T>"
+.B "<control\(hyT>"
 Insert sufficient
 .I <tab>
 and
@@ -777,7 +784,7 @@
 .TP
 .B "<erase>
 .TP
-.B "<control-H>"
+.B "<control\(hyH>"
 Erase the last character.
 .TP
 .B "<literal next>"
@@ -789,7 +796,7 @@
 .B "<line erase>"
 Erase the current line.
 .TP
-.B "<control-W>"
+.B "<control\(hyW>"
 .TP
 .B "<word erase>"
 Erase the last word.
@@ -799,7 +806,7 @@
 .B ttywerase
 options.
 .TP
-.B "<control-X>[0-9A-Fa-f]+"
+.B "<control\(hyX>[0\-9A\-Fa\-f]+"
 Insert a character with the specified hexadecimal value into the text.
 .TP
 .B "<interrupt>"
@@ -811,7 +818,7 @@
 In each entry below, the tag line is a usage synopsis for the command.
 .PP
 .TP
-.B "<end-of-file>"
+.B "<end\(hyof\(hyfile>"
 Scroll the screen.
 .TP
 .B "! argument(s)"
@@ -932,7 +939,7 @@
 .I file
 if it was previously saved.
 .TP
-.B "res[ize] [+|-]size"
+.B "res[ize] [+|\-]size"
 .I \&Vi
 mode only.
 Grow or shrink the current screen.
@@ -1034,7 +1041,10 @@
 .I \&ex
 and
 .I \&vi
-modes, unless otherwise specified.
+modes, unless otherwise specified. Multiple options can be given in
+one set or unset, separated by spaces or tabs.  Spaces and tabs can be
+included in string options (eg. tags or filec) by preceding each with
+a backslash.  There's no way to get backslash itself into an option.
 .PP
 .TP
 .B "altwerase [off]"
@@ -1071,7 +1081,7 @@
 command.
 .TP
 .B "cedit [no default]"
-Set the character to edit the colon command-line history.
+Set the character to edit the colon command\(hyline history.
 .TP
 .B "columns, co [80]"
 Set the number of columns in the screen.
@@ -1085,7 +1095,7 @@
 The directory where temporary files are created.
 .TP
 .B "edcompatible, ed [off]"
-Remember the values of the ``c'' and ``g'' suffices to the
+Remember the values of the \(lqc\(rq and \(lqg\(rq suffices to the
 .B substitute
 commands, instead of initializing them as unset for each new
 command.
@@ -1114,8 +1124,8 @@
 Set the spacing between hardware tab settings.
 .TP
 .B "iclower [off]"
-Makes all Regular Expressions case-insensitive,
-as long as an upper-case letter does not appear in the search string.
+Makes all Regular Expressions case\(hyinsensitive,
+as long as an upper\(hycase letter does not appear in the search string.
 .TP
 .B "ignorecase, ic [off]"
 Ignore case differences in regular expressions.
@@ -1128,7 +1138,7 @@
 .B "leftright [off]"
 .I \&Vi
 only.
-Do left-right scrolling.
+Do left\(hyright scrolling.
 .TP
 .B "lines, li [24]"
 .I \&Vi
@@ -1227,7 +1237,7 @@
 Display a command prompt.
 .TP
 .B "readonly, ro [off]"
-Mark the file and session as read-only.
+Mark the file and session as read\(hyonly.
 .TP
 .B "recdir [/var/tmp/vi.recover]"
 The directory where recovery files are stored.
@@ -1278,7 +1288,7 @@
 .\" to save my life.  The ONLY way I've been able to get this to work
 .\" is with the .tr command.
 .tr Q"
-.ds ms shellmeta [~{[*?$`'Q\e]
+.ds ms shellmeta [~{[*?$\`'Q\e]
 .TP
 .B "\*(ms"
 .tr QQ
@@ -1291,17 +1301,17 @@
 .B "showmatch, sm [off]"
 .I \&Vi
 only.
-Note matching ``{'' and ``('' for ``}'' and ``)'' characters.
+Note matching \(lq{\(rq and \(lq(\(rq for \(lq}\(rq and \(lq)\(rq characters.
 .TP
 .B "showmode, smd [off]"
 .I \&Vi
 only.
-Display the current editor mode and a ``modified'' flag.
+Display the current editor mode and a \(lqmodified\(rq flag.
 .TP
 .B "sidescroll [16]"
 .I \&Vi
 only.
-Set the amount a left-right scroll will shift.
+Set the amount a left\(hyright scroll will shift.
 .TP
 .B "slowopen, slow [off]"
 Delay display updating during text input.
@@ -1379,7 +1389,7 @@
 .I \&Vi
 only.
 Break lines automatically, the specified number of columns from the
-left-hand margin.
+left\(hyhand margin.
 If both the
 .B wraplen
 and
@@ -1392,7 +1402,7 @@
 .I \&Vi
 only.
 Break lines automatically, the specified number of columns from the
-right-hand margin.
+right\(hyhand margin.
 If both the
 .B wraplen
 and
@@ -1405,7 +1415,7 @@
 Set searches to wrap around the end or beginning of the file.
 .TP
 .B "writeany, wa [off]"
-Turn off file-overwriting checks.
+Turn off file\(hyoverwriting checks.
 .SH "ENVIRONMENT VARIABLES
 .TP
 .I COLUMNS
@@ -1430,7 +1440,7 @@
 .TP
 .I HOME
 The user's home directory, used as the initial directory path
-for the startup ``$\fIHOME\fP/.nexrc'' and ``$\fIHOME\fP/.exrc''
+for the startup \(lq$\fIHOME\fP/.nexrc\(rq and \(lq$\fIHOME\fP/.exrc\(rq
 files.
 This value is also used as the default directory for the
 .I \&vi
@@ -1462,7 +1472,7 @@
 .TP
 .I TERM
 The user's terminal type.
-The default is the type ``unknown''.
+The default is the type \(lqunknown\(rq.
 If the
 .I TERM
 environmental variable is not set when
@@ -1482,7 +1492,7 @@
 SIGALRM
 .I \&Vi/ex
 uses this signal for periodic backups of file modifications and to
-display ``busy'' messages when operations are likely to take a long time.
+display \(lqbusy\(rq messages when operations are likely to take a long time.
 .TP
 SIGHUP
 .TP
@@ -1492,7 +1502,7 @@
 be later recovered.
 See the
 .I \&vi/ex
-Reference manual section entitled ``Recovery'' for more information.
+Reference manual section entitled \(lqRecovery\(rq for more information.
 .TP
 SIGINT
 When an interrupt occurs,
@@ -1506,7 +1516,7 @@
 The screen is resized.
 See the
 .I \&vi/ex
-Reference manual section entitled ``Sizing the Screen'' for more information.
+Reference manual section entitled \(lqSizing the Screen\(rq for more information.
 .TP
 SIGCONT
 .TP
@@ -1521,7 +1531,7 @@
 The default user shell.
 .TP
 /etc/vi.exrc
-System-wide vi startup file.
+System\(hywide vi startup file.
 .TP
 /tmp
 Temporary file directory.
@@ -1546,38 +1556,38 @@
 .IR curses (3),
 .IR dbopen (3)
 .sp
-The ``Vi Quick Reference'' card.
+The \(lqVi Quick Reference\(rq card.
 .sp
-``An Introduction to Display Editing with Vi'', found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqAn Introduction to Display Editing with Vi\(rq, found in the
+\(lqUNIX User's Manual Supplementary Documents\(rq
 section of both the 4.3BSD and 4.4BSD manual sets.
 This document is the closest thing available to an introduction to the
 .I \&vi
 screen editor.
 .sp
-``Ex Reference Manual (Version 3.7)'',
+\(lqEx Reference Manual (Version 3.7)\(rq,
 found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqUNIX User's Manual Supplementary Documents\(rq
 section of both the 4.3BSD and 4.4BSD manual sets.
 This document is the final reference for the
 .I \&ex
 editor, as distributed in most historic 4BSD and System V systems.
 .sp
-``Edit: A tutorial'',
+\(lqEdit: A tutorial\(rq,
 found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqUNIX User's Manual Supplementary Documents\(rq
 section of the 4.3BSD manual set.
 This document is an introduction to a simple version of the
 .I \&ex
 screen editor.
 .sp
-``Ex/Vi Reference Manual'',
+\(lqEx/Vi Reference Manual\(rq,
 found in the
-``UNIX User's Manual Supplementary Documents''
+\(lqUNIX User's Manual Supplementary Documents\(rq
 section of the 4.4BSD manual set.
 This document is the final reference for the
 .I \&nex/nvi
-text editors, as distributed in 4.4BSD and 4.4BSD-Lite.
+text editors, as distributed in 4.4BSD and 4.4BSD\(hyLite.
 .PP
 .I Roff
 source for all of these documents is distributed with
@@ -1588,7 +1598,7 @@
 .I nex/nvi
 source code.
 .sp
-The files ``autowrite'', ``input'', ``quoting'' and ``structures''
+The files \(lqautowrite\(rq, \(lqinput\(rq, \(lqquoting\(rq and \(lqstructures\(rq
 found in the
 .I nvi/docs/internals
 directory of the
@@ -1602,7 +1612,7 @@
 editor first appeared in 4.4BSD.
 .SH STANDARDS
 .I \&Nex/nvi
-is close to IEEE Std1003.2 (``POSIX'').
+is close to IEEE Std1003.2 (\(lqPOSIX\(rq).
 That document differs from historical
 .I ex/vi
 practice in several places; there are changes to be made on both sides.

nvi-17-tutorial_typos.patch:
 vi.advanced |    6 +++---
 vi.beginner |   10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

--- NEW FILE nvi-17-tutorial_typos.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 17tutorial_typos.dpatch
##
## DP: Fix typos in the nvi tutorial.

@DPATCH@
--- nvi-1.81.6.orig/nvi-1.79/docs/tutorial/vi.beginner
+++ nvi-1.81.6/nvi-1.79/docs/tutorial/vi.beginner
@@ -505,7 +505,7 @@
 j - moves the cursor DOWN one line
 h - moves the cursor one character to the LEFT
 
-Section 22: {i} {a} {I} {A} {o} {O} ^[ (escape key)
+Section 22: {i} {a} {I} {A} {o} {O} {^[} (escape key)
 
 For this and following sections you will need to use the ESCAPE key on your
 terminal.  It is usually marked ESC.  Since the escape key is the same as
@@ -525,9 +525,9 @@
 on the word 'of'.)
 
 Now carefully type the following string and observe the effects:
-  {iexample ^[}  (remember: ^[ is the escape key)}
+  {iexample ^[}  (remember: ^[ is the escape key)
 The {i} begins the insert mode, and 'example ' is inserted into the line: 
-be sure to notice the blank in 'example '.  The ^[ ends insertion mode, 
+be sure to notice the blank in 'example '.  The {^[} ends insertion mode, 
 and the line is updated to include the new string.  Line 1 should look exactly 
 like Line 2.
 
@@ -541,9 +541,9 @@
 of 'line'.  You can do this in several ways, one way is the following:
 First, type {/line /^M}.  This puts us on the word 'line' in Line 4
 (the blank in the search string is important!).  Next, type {e}.  The 'e' puts
-us at the end of the word.  Now, type {as^[  (^[ is the escape character)}.  
+us at the end of the word.  Now, type {as^[} (^[ is the escape character).  
 The 'a' puts us in insert mode, AFTER the current character.  We appended the 
-'s', and the escape ^[ ended the insert mode.
+'s', and the escape '^[' ended the insert mode.
 
 The difference between {i} (insert) and {a} (append) is that {i} begins
 inserting text BEFORE the cursor, and {a} begins inserting AFTER the cursor.
--- nvi-1.81.6.orig/nvi-1.79/docs/tutorial/vi.advanced
+++ nvi-1.81.6/nvi-1.79/docs/tutorial/vi.advanced
@@ -26,8 +26,8 @@
     1         introduction: {^F} {ZZ}
     2         introduction (con't) and positioning: {^F} {^B}
     3         introduction (con't) and positioning: {^F} {^B}
-    4         positioning: {^F} {^B} ^M (return key)
-    5         quitting: {:q!} ^M key
+    4         positioning: {^F} {^B} {^M} (return key)
+    5         quitting: {:q!} {^M} (return key)
     6         marking, cursor and screen positioning: {m} {G} {'} {z}
     7         marking, cursor and screen positioning: {m} {G} {'} {z}
     8         marking, cursor and screen positioning: {z} {m} {'}
@@ -44,7 +44,7 @@
    19         screen positioning: {H} {M} {L}
    20         character positioning: {w} {b} {0} {W} {B} {e} {E} {'} {`}
    21         cursor positioning: {l} {k} {j} {h}
-   22         adding text: {i} {a} {I} {A} {o} {O} ^[ (escape key)
+   22         adding text: {i} {a} {I} {A} {o} {O} {^[} (escape key)
    23         character manipulation: {f} {x} {X} {w} {l} {r} {R} {s} {S} {J}
    24         undo: {u} {U}
    25         review

nvi-18-dbpagesize_binpower.patch:
 exf.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

--- NEW FILE nvi-18-dbpagesize_binpower.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 18dbpagesize_binpower.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Make sure that the pagesize passed to db__set_pagesize() is
## DP: a power of two.

@DPATCH@
--- nvi-1.81.6.orig/common/exf.c	2009-03-09 01:48:01.695862889 +0100
+++ nvi-1.81.6/common/exf.c	2009-03-09 10:42:41.147866272 +0100
@@ -249,11 +249,10 @@
 		 * (vi should have good locality) or smaller than 1K.
 		 */
 		psize = ((sb.st_size / 15) + 1023) / 1024;
-		if (psize > 10)
-			psize = 10;
-		if (psize == 0)
-			psize = 1;
-		psize *= 1024;
+		if (psize >= 8) psize=8<<10;
+		else if (psize >= 4) psize=4<<10;
+		else if (psize >= 2) psize=2<<10;
+		else psize=1<<10;
 
 		F_SET(ep, F_DEVSET);
 		ep->mdev = sb.st_dev;

nvi-19-include_term_h.patch:
 cl_funcs.c  |    1 +
 cl_screen.c |    1 +
 2 files changed, 2 insertions(+)

--- NEW FILE nvi-19-include_term_h.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 19include_term_h.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Add <term.h> to the include list to suppress a few warnings.

@DPATCH@
diff -Naur nvi-1.81.6.orig/cl/cl_funcs.c nvi-1.81.6/cl/cl_funcs.c
--- nvi-1.81.6.orig/cl/cl_funcs.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/cl/cl_funcs.c	2008-05-01 18:23:08.000000000 +0200
@@ -18,6 +18,7 @@
 #include <sys/time.h>
 
 #include <bitstring.h>
+#include <term.h>
 #include <ctype.h>
 #include <signal.h>
 #include <stdio.h>
diff -Naur nvi-1.81.6.orig/cl/cl_screen.c nvi-1.81.6/cl/cl_screen.c
--- nvi-1.81.6.orig/cl/cl_screen.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/cl/cl_screen.c	2008-05-01 18:23:02.000000000 +0200
@@ -17,6 +17,7 @@
 #include <sys/queue.h>
 
 #include <bitstring.h>
+#include <term.h>
 #include <errno.h>
 #include <signal.h>
 #include <stdio.h>

nvi-20-glibc_has_grantpt.patch:
 ex_script.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- NEW FILE nvi-20-glibc_has_grantpt.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 20glibc_has_grantpt.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: glibc has grantpt(), so only hceck for HAVE_SYS5_PTY
## DP: on non-glibc installations.

@DPATCH@
diff -Naur nvi-1.81.6.orig/ex/ex_script.c nvi-1.81.6/ex/ex_script.c
--- nvi-1.81.6.orig/ex/ex_script.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/ex/ex_script.c	2008-05-01 18:24:06.000000000 +0200
@@ -23,7 +23,8 @@
 #include <sys/select.h>
 #endif
 #include <sys/stat.h>
-#ifdef HAVE_SYS5_PTY
+/* glibc2.1 defines grantpt but there is no stropts.h */
+#if defined(HAVE_SYS5_PTY) && !defined(__GLIBC__)  
 #include <sys/stropts.h>
 #endif
 #include <sys/time.h>
@@ -664,7 +665,7 @@
 	F_CLR(gp, G_SCRWIN);
 }
 
-#ifdef HAVE_SYS5_PTY
+#if defined(HAVE_SYS5_PTY) && !defined(__GLIBC__)
 static int ptys_open __P((int, char *));
 static int ptym_open __P((char *));
 

nvi-21-exrc_writability_check.patch:
 ex_init.c |   28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

--- NEW FILE nvi-21-exrc_writability_check.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 21exrc_writability_check.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: No description.

@DPATCH@
diff -Naur nvi-1.81.6.orig/ex/ex_init.c nvi-1.81.6/ex/ex_init.c
--- nvi-1.81.6.orig/ex/ex_init.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/ex/ex_init.c	2008-05-01 18:24:45.000000000 +0200
@@ -26,6 +26,9 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <pwd.h>
+#include <grp.h>
+
 #include "../common/common.h"
 #include "tag.h"
 #include "pathnames.h"
@@ -346,6 +349,9 @@
 	int nf1, nf2;
 	char *a, *b, buf[MAXPATHLEN];
 
+	struct group *grp_p;
+	struct passwd *pwd_p;
+
 	/* Check for the file's existence. */
 	if (stat(path, sbp))
 		return (NOEXIST);
@@ -359,10 +365,30 @@
 	}
 
 	/* Check writeability. */
-	if (sbp->st_mode & (S_IWGRP | S_IWOTH)) {
+	if (sbp->st_mode & S_IWOTH) {
 		etype = WRITER;
 		goto denied;
 	}
+	if (sbp->st_mode & S_IWGRP) {
+		/* on system error (getgrgid or getpwnam return NULL) set etype to WRITER
+		 * and continue execution */
+		if( (grp_p = getgrgid(sbp->st_gid)) == NULL) {
+			etype = WRITER;
+			goto denied;
+		}
+
+		/* lookup the group members' uids for an uid different from euid */
+		while( ( *(grp_p->gr_mem) ) != NULL) { /* gr_mem is a null-terminated array */
+			if( (pwd_p = getpwnam(*(grp_p->gr_mem)++)) == NULL) {
+				etype = WRITER;
+				goto denied;
+			}
+			if(pwd_p->pw_uid != euid) {
+				etype = WRITER;
+				goto denied;
+			}
+		}
+	}
 	return (RCOK);
 
 denied:	a = msg_print(sp, path, &nf1);

nvi-23-debian_alternatives.patch:
 gs.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

--- NEW FILE nvi-23-debian_alternatives.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 23debian_alternatives.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Adapt the internal program name if nvi was called via one of
## DP: the Debian alternative symlinks.

@DPATCH@
diff -Naur nvi-1.81.6.orig/common/gs.c nvi-1.81.6/common/gs.c
--- nvi-1.81.6.orig/common/gs.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/gs.c	2008-05-01 18:28:44.000000000 +0200
@@ -45,6 +45,24 @@
 
 	gp->progname = name;
 
+#ifdef DEBIAN
+	/* This is because of the Debian alternatives system. The
+	   definitions of editor, vi, view, and ex are transient. This
+	   would be ok, except that the recovery file hardcodes the
+	   name. The downside of this is that the error messages may
+	   not quite match what the user expects */
+
+	if (!strcmp(name, "editor")) {
+	  gp->progname = "nvi";
+	} else if (!strcmp(name, "vi")){
+	  gp->progname = "nvi";
+	} else if (!strcmp(name, "view")){
+	  gp->progname = "nview";
+	} else if (!strcmp(name, "ex")){
+	  gp->progname = "nex";
+	} 
+#endif   /* DEBIAN */
+
 	/* Common global structure initialization. */
 	/* others will need to be copied from main.c */
 	CIRCLEQ_INIT(&gp->dq);

nvi-24-fallback_to_dumb_term.patch:
 cl_main.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- NEW FILE nvi-24-fallback_to_dumb_term.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 24fallback_to_dumb_term.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: If there's no $TERM around, just fall back to "dumb".

@DPATCH@
diff -Naur nvi-1.81.6.orig/cl/cl_main.c nvi-1.81.6/cl/cl_main.c
--- nvi-1.81.6.orig/cl/cl_main.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/cl/cl_main.c	2008-05-01 18:29:13.000000000 +0200
@@ -96,6 +96,7 @@
 	if ((ttype = getenv("TERM")) == NULL)
 		ttype = "unknown";
 	term_init(gp->progname, ttype);
+	ttype = getenv("TERM");
 
 	/* Add the terminal type to the global structure. */
 	if ((OG_D_STR(gp, GO_TERM) =
@@ -233,6 +234,11 @@
 
 	/* Set up the terminal database information. */
 	setupterm(ttype, STDOUT_FILENO, &err);
+	if (err == 0) {
+		(void)fprintf(stderr, "%s: %s: unknown terminal type, falling back to 'dumb'\n", name, ttype);
+		setenv("TERM", "dumb", 1);
+		setupterm("dumb", STDOUT_FILENO, &err);
+	}
 	switch (err) {
 	case -1:
 		(void)fprintf(stderr,

nvi-25-manpage_note_dropped_F.patch:
 vi.1 |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

--- NEW FILE nvi-25-manpage_note_dropped_F.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 25manpage_note_dropped_F.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Replace the manpage paragraph about the '-F' commandline option
## DP: with a notice that is has been dropped.

@DPATCH@
--- nvi-1.81.6+debian-1.orig/docs/vi.man/vi.1	2008-06-13 00:52:45.000000000 +0200
+++ nvi-1.81.6+debian-1/docs/vi.man/vi.1	2008-06-13 00:55:40.000000000 +0200
@@ -17,7 +17,7 @@
 .SH SYNOPSIS
 .B ex
 [\c
-.B \-eFRrSsv\c
+.B \-eRrSsv\c
 ] [\c
 .BI \-c " cmd"\c
 ] [\c
@@ -28,7 +28,7 @@
 .br
 .B vi
 [\c
-.B \-eFlRrSv\c
+.B \-elRrSv\c
 ] [\c
 .BI \-c " cmd"\c
 ] [\c
@@ -39,7 +39,7 @@
 .br
 .B view
 [\c
-.B \-eFRrSv\c
+.B \-eRrSv\c
 ] [\c
 .BI \-c " cmd"\c
 ] [\c
@@ -113,11 +113,6 @@
 Start editing in ex mode, as if the command name were
 .IR \&ex .
 .TP
-.B \-F
-Don't copy the entire file when first starting to edit.
-(The default is to make a copy in case someone else modifies
-the file during your edit session.)
-.TP
 .B \-l
 Start editing with the lisp and showmatch options set.
 .TP
@@ -169,6 +164,9 @@
 or
 .IR view .
 .PP
+Note that the \fB-F\fP option (which prevented \fIex/vi\fP from making
+a full backup of the target file) has been removed and is no longer available.
+.PP
 Command input for
 .I ex/vi
 is read from the standard input.

nvi-26-trailing_tab_segv.patch:
 vs_relative.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE nvi-26-trailing_tab_segv.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 26trailing_tab_segv.dpatch by <hesso at pool.math.tu-berlin.de>
##
## DP: Prevent a segfault if a trailing tab is pushed to a new line by inserting
## DP: characters before it if 'set number' is in effect.

@DPATCH@
--- nvi-1.81.6+debian.orig/vi/vs_relative.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6+debian/vi/vs_relative.c	2008-06-13 03:22:55.000000000 +0200
@@ -133,7 +133,7 @@
 	 * Initialize the pointer into the buffer and current offset.
 	 */
 	p = lp;
-	curoff = 0;
+	curoff = scno;
 
 	/* Macro to return the display length of any signal character. */
 #define	CHLEN(val) (ch = *(UCHAR_T *)p++) == '\t' &&			\

nvi-27-support_C_locale.patch:
 conv.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--- NEW FILE nvi-27-support_C_locale.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 27support_C_locale.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Allow users to edit 8-bit files even under LC_CTYPE=C.

@DPATCH@
--- nvi-1.81.6.orig/common/conv.c	2007-11-18 17:41:42.000000000 +0100
+++ nvi-1.81.6/common/conv.c	2009-03-09 16:45:37.812022582 +0100
@@ -322,11 +322,16 @@
     else {
 	setlocale(LC_ALL, "");
 #ifdef USE_WIDECHAR
-	sp->conv.sys2int = cs_char2int;
-	sp->conv.int2sys = cs_int2char;
-	sp->conv.file2int = fe_char2int;
-	sp->conv.int2file = fe_int2char;
-	sp->conv.input2int = ie_char2int;
+	if (!strcmp(LANGCODESET, "ANSI_X3.4-1968")) {
+	    sp->conv.file2int = sp->conv.input2int = sp->conv.sys2int = raw2int;
+	    sp->conv.int2sys = sp->conv.int2file = int2raw;
+	} else {
+	    sp->conv.sys2int = cs_char2int;
+	    sp->conv.int2sys = cs_int2char;
+	    sp->conv.file2int = fe_char2int;
+	    sp->conv.int2file = fe_int2char;
+	    sp->conv.input2int = ie_char2int;
+	}
 #endif
 #ifdef USE_ICONV
 	o_set(sp, O_FILEENCODING, OS_STRDUP, nl_langinfo(CODESET), 0);

nvi-28-regex_widechar.patch:
 regcomp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE nvi-28-regex_widechar.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 28regex_widechar.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Fix an overflow check to properly mask off the undesired bits
## DP: instead of casting (and accidentally sign-extending) the value.
## DP: Bugfix for #523934.

@DPATCH@
--- nvi-1.81.6.orig/regex/regcomp.c	2009-06-03 22:44:27.530015032 +0200
+++ nvi-1.81.6/regex/regcomp.c	2009-06-05 02:15:01.021006288 +0200
@@ -607,7 +607,7 @@
 		/* FALLTHROUGH */
 	default:
 	  /* ordinary(p, c &~ BACKSL); -- Fix potential overflow */
-	        ordinary(p, (char)c);
+	        ordinary(p, c & 0xff);
 		break;
 	}
 

nvi-29-file_backup.patch:
 exf.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- NEW FILE nvi-29-file_backup.patch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 29file_backup.dpatch by  <hesso at pool.math.tu-berlin.de>
##
## DP: Save the intermediate CHAR2INT conversion pointer because
## DP: that pointer is reused by later conversions in calls below.

@DPATCH@
--- nvi-1.81.6.orig/common/exf.c	2009-07-24 11:30:05.962060755 +0200
+++ nvi-1.81.6/common/exf.c	2009-07-24 12:09:57.511311177 +0200
@@ -1092,8 +1092,8 @@
 	size_t blen;
 	int flags, maxnum, nr, num, nw, rfd, wfd, version;
 	char *bp, *estr, *p, *pct, *slash, *t, *wfname, buf[8192];
-	CHAR_T *wp;
-	size_t wlen;
+	CHAR_T *wp, *wp2;
+	size_t wlen, wlen2;
 	size_t nlen;
 	char *d = NULL;
 
@@ -1148,8 +1148,13 @@
 	} else
 		version = 0;
 	CHAR2INT(sp, bname, strlen(bname) + 1, wp, wlen);
-	if (argv_exp2(sp, &cmd, wp, wlen - 1))
+	GET_SPACE_RETW(sp, wp2, wlen2, wlen);
+	MEMCPY(wp2, wp, wlen);
+	if (argv_exp2(sp, &cmd, wp2, wlen2 - 1)) {
+		FREE_SPACEW(sp, wp2, wlen2);
 		return (1);
+	}
+	FREE_SPACEW(sp, wp2, wlen2);
 
 	/*
 	 *  0 args: impossible.


--- NEW FILE nvi.spec ---
Name:           nvi
Version:        1.81.6
Release:        2%{?dist}
Summary:		4.4BSD re-implementation of vi

Group:          Applications/Editors
License:        BSD
URL:            http://www.bostic.com/vi/
Source0:		http://www.kotnet.org/~skimo/%{name}/devel/%{name}-%{version}.tar.bz2
Patch1:         nvi-01-additional_upstream_data.patch
Patch2:         nvi-03-db4.patch
Patch3:         nvi-04-confdefs.patch
Patch4:         nvi-06-default_value_escapetime.patch
Patch5:         nvi-07-flush_cache.patch
Patch6:         nvi-08-lfs.patch
Patch7:         nvi-08-safe_printf.patch
Patch8:         nvi-08-tempfile_umask.patch
Patch9:         nvi-09-casting.patch
Patch10:        nvi-10-no_one_line_visual.patch
Patch11:        nvi-11-backward_sentence_moving.patch
Patch12:        nvi-12-horiz_scroll_count.patch
Patch13:        nvi-13-widechar_horrors.patch
Patch14:        nvi-14-private_regex_fixes.patch
Patch15:        nvi-15-search_word.patch
Patch16:        nvi-16-manpage_errors.patch
Patch17:        nvi-17-tutorial_typos.patch
Patch18:        nvi-18-dbpagesize_binpower.patch
Patch19:        nvi-19-include_term_h.patch
Patch20:        nvi-20-glibc_has_grantpt.patch
Patch21:        nvi-21-exrc_writability_check.patch
Patch22:        nvi-23-debian_alternatives.patch
Patch23:        nvi-24-fallback_to_dumb_term.patch
Patch24:        nvi-25-manpage_note_dropped_F.patch
Patch25:        nvi-26-trailing_tab_segv.patch
Patch26:        nvi-27-support_C_locale.patch
Patch27:        nvi-28-regex_widechar.patch
Patch28:        nvi-29-file_backup.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	ncurses-devel, db4-devel

%description
Vi is the original screen based text editor for Unix systems.
It is considered the standard text editor, and is available on
almost all Unix systems.

Nvi is intended as a "bug-for-bug compatible" clone of the original
BSD vi editor. As such, it doesn't have a lot of snazzy features as do
some of the other vi clones such as elvis and vim. However, if all
you want is vi, this is the one to get.

%prep
%setup -q
%patch1 -p1  -b .additional_upstream_data
%patch2 -p1  -b .db4
%patch3 -p1  -b .confdefs
%patch4 -p1  -b .default_value_escapetime
%patch5 -p1  -b .flush_cache
%patch6 -p1  -b .lfs
%patch7 -p1  -b .safe_printf
%patch8 -p1  -b .tempfile_umask
%patch9 -p1  -b .casting
%patch10 -p1 -b .no_one_line_visual
%patch11 -p1 -b .backward_sentence_moving
%patch12 -p1 -b .horiz_scroll_count
%patch13 -p1 -b .widechar_horrors
%patch14 -p1 -b .private_regex_fixes
%patch15 -p1 -b .search_word
%patch16 -p1 -b .manpage_errors
%patch17 -p1 -b .tutorial_typos
%patch18 -p1 -b .dbpagesize_binpower
%patch19 -p1 -b .include_term_h
%patch20 -p1 -b .glibc_has_grantpt
%patch21 -p1 -b .exrc_writability_check
%patch22 -p1 -b .debian_alternatives
%patch23 -p1 -b .fallback_to_dumb_term
%patch24 -p1 -b .manpage_note_dropped_F
%patch25 -p1 -b .trailing_tab_segv
%patch26 -p1 -b .support_C_locale
#patch27 -p1 -b .regex_widechar.patch
%patch28 -p1 -b .file_backup


%build
(cd build.unix && \
  OPTFLAG="$RPM_OPT_FLAGS" \
  ac_cv_path_vi_cv_path_sendmail=/usr/sbin/sendmail \
  vi_cv_revoke=no \
  ../dist/configure \
	--disable-curses \
	--prefix=%{_prefix} \
	--disable-shared --enable-static \
	--enable-widechar \
	--disable-threads \
	--without-x \
	--with-gnu-ld=yes \
	--datadir='%{_datadir}' \
	--mandir='%{_mandir}' \
	--program-prefix=n
)
sed -i -e '/define.*_PATH_MSGCAT/ s/".*"/"\/usr\/share\/vi\/catalog\/"/' \
    build.unix/pathnames.h
make -C build.unix %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make -C build.unix install prefix=%{_prefix} DESTDIR=$RPM_BUILD_ROOT 
find $RPM_BUILD_ROOT \( -name \*.a -o -name \*.la \) -delete
mv $RPM_BUILD_ROOT%{_datadir}/{vi,nvi}
mv $RPM_BUILD_ROOT%{_datadir}/nvi/recover \
    $RPM_BUILD_ROOT%{_bindir}/nvi.recover 
chmod 775 $RPM_BUILD_ROOT%{_bindir}/nvi.recover


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc LICENSE README* TODO
%{_mandir}/*/*
%{_datadir}/nvi/
%{_bindir}/nex
%{_bindir}/nvi
%{_bindir}/nview
%{_bindir}/nvi.recover

%changelog
* Thu Jun 24 2010 Matěj Cepl <mcepl at redhat.com> - 1.81.6-2
- Fixing review comments

* Tue Jun 22 2010 Matěj Cepl <mcepl at redhat.com> - 1.81.6-1
- Initial experimental package


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/nvi/EL-6/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- .cvsignore	26 Jun 2010 08:08:11 -0000	1.1
+++ .cvsignore	26 Jun 2010 08:36:51 -0000	1.2
@@ -0,0 +1 @@
+nvi-1.81.6.tar.bz2


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/nvi/EL-6/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- sources	26 Jun 2010 08:08:12 -0000	1.1
+++ sources	26 Jun 2010 08:36:51 -0000	1.2
@@ -0,0 +1 @@
+88d1e23115ee9f2961186b62e55f5704  nvi-1.81.6.tar.bz2



More information about the scm-commits mailing list