Initial import to Fedora CVS

This commit is contained in:
Matej Cepl 2010-06-26 08:33:25 +00:00
parent e759cf0335
commit 91d3563582
32 changed files with 5223 additions and 0 deletions

View File

@ -0,0 +1 @@
nvi-1.81.6.tar.bz2

1
import.log Normal file
View File

@ -0,0 +1 @@
nvi-1_81_6-2_el6:F-13:nvi-1.81.6-2.el6.src.rpm:1277541166

File diff suppressed because it is too large Load Diff

28
nvi-03-db4.patch Normal file
View File

@ -0,0 +1,28 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 03db4.dpatch by <hesso@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);

13
nvi-04-confdefs.patch Normal file
View File

@ -0,0 +1,13 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 04confdefs.dpatch by <hesso@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

View File

@ -0,0 +1,18 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 06default_value_escapetime.dpatch by <hesso@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);

49
nvi-07-flush_cache.patch Normal file
View File

@ -0,0 +1,49 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 07flush_cache.dpatch by <hesso@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))

28
nvi-08-lfs.patch Normal file
View File

@ -0,0 +1,28 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 08lfs.dpatch by <hesso@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

18
nvi-08-safe_printf.patch Normal file
View File

@ -0,0 +1,18 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 08safe_printf.dpatch by <hesso@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);

View File

@ -0,0 +1,31 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 08tempfile_umask.dpatch by <hesso@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);

27
nvi-09-casting.patch Normal file
View File

@ -0,0 +1,27 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 09casting.dpatch by <hesso@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);

View File

@ -0,0 +1,24 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10no_one_line_visual.dpatch by <hesso@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;

View File

@ -0,0 +1,18 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 11backward_sentence_moving.dpatch by <hesso@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;
/*

View File

@ -0,0 +1,18 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 12horiz_scroll_count.dpatch by <hesso@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. */

View File

@ -0,0 +1,67 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 13widechar_horrors.dpatch by <hesso@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. */

View File

@ -0,0 +1,31 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 14private_regex_fixes.dpatch by <hesso@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))

29
nvi-15-search_word.patch Normal file
View File

@ -0,0 +1,29 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 15search_word.dpatch by Al Viro <viro@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);

770
nvi-16-manpage_errors.patch Normal file
View File

@ -0,0 +1,770 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 16manpage_errors.dpatch by <hesso@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.

View File

@ -0,0 +1,63 @@
#! /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

View File

@ -0,0 +1,25 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 18dbpagesize_binpower.dpatch by <hesso@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;

View File

@ -0,0 +1,28 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 19include_term_h.dpatch by <hesso@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>

View File

@ -0,0 +1,29 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 20glibc_has_grantpt.dpatch by <hesso@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 *));

View File

@ -0,0 +1,61 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 21exrc_writability_check.dpatch by <hesso@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);

View File

@ -0,0 +1,35 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 23debian_alternatives.dpatch by <hesso@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);

View File

@ -0,0 +1,29 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 24fallback_to_dumb_term.dpatch by <hesso@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,

View File

@ -0,0 +1,58 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 25manpage_note_dropped_F.dpatch by <hesso@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.

View File

@ -0,0 +1,18 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 26trailing_tab_segv.dpatch by <hesso@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' && \

View File

@ -0,0 +1,30 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 27support_C_locale.dpatch by <hesso@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);

View File

@ -0,0 +1,19 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 28regex_widechar.dpatch by <hesso@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;
}

35
nvi-29-file_backup.patch Normal file
View File

@ -0,0 +1,35 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 29file_backup.dpatch by <hesso@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.

136
nvi.spec Normal file
View File

@ -0,0 +1,136 @@
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@redhat.com> - 1.81.6-2
- Fixing review comments
* Tue Jun 22 2010 Matěj Cepl <mcepl@redhat.com> - 1.81.6-1
- Initial experimental package

View File

@ -0,0 +1 @@
88d1e23115ee9f2961186b62e55f5704 nvi-1.81.6.tar.bz2