Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Oct 2000 16:48:19 -0700
From:      Seth Kingsley <sethk@osd.bsdi.com>
To:        gnats-admin@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/21654: Re: nvi's -c flag does no do what it is documented to do. (it does nothing)
Message-ID:  <20001002164819.B76593@osd.bsdi.com>
In-Reply-To: <200010021901.MAA38034@freefall.freebsd.org>; from peter@FreeBSD.ORG on Mon, Oct 02, 2000 at 12:01:49PM -0700
References:  <200010021901.MAA38034@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Synopsis: Re: nvi's -c flag does no do what it is documented to do. (it does nothing)

I believe that this is part of nvi's compatiblity with traditional Vi
in that it will not execute +cmd's when creating a new file to edit.
This patch just makes it complain and notes it in the manual page:

Index: common/exf.c
===================================================================
RCS file: /ncvs/src/contrib/nvi/common/exf.c,v
retrieving revision 1.3
diff -u -r1.3 exf.c
--- common/exf.c	2000/01/10 09:17:46	1.3
+++ common/exf.c	2000/09/30 02:05:09
@@ -546,14 +546,17 @@
 	 */
 	nb = 0;
 	gp = sp->gp;
-	if (gp->c_option != NULL && !F_ISSET(sp->frp, FR_NEWFILE)) {
+	if (gp->c_option != NULL) {
 		if (db_last(sp, &sp->lno))
 			return;
 		if (sp->lno == 0) {
 			sp->lno = 1;
 			sp->cno = 0;
 		}
-		if (ex_run_str(sp,
+		if (F_ISSET(sp->frp, FR_NEWFILE))
+			msgq_str(sp, M_ERR, sp->frp->name,
+			    "318|%s: Warning: +cmd ignored for new file");
+		else if (ex_run_str(sp,
 		    "-c option", gp->c_option, strlen(gp->c_option), 1, 1))
 			return;
 		gp->c_option = NULL;
Index: docs/USD.doc/vi.man/vi.1
===================================================================
RCS file: /ncvs/src/contrib/nvi/docs/USD.doc/vi.man/vi.1,v
retrieving revision 1.4
diff -u -r1.4 vi.1
--- docs/USD.doc/vi.man/vi.1	1997/09/18 06:49:40	1.4
+++ docs/USD.doc/vi.man/vi.1	2000/10/02 19:19:46
@@ -107,7 +107,9 @@
 is not limited to positioning commands.
 This is the POSIX 1003.2 interface for the historic ``+cmd'' syntax.
 .I Nex/nvi
-supports both the old and new syntax.
+supports both the old and new syntax. If a
+.B \-c
+option is used when creating a new file, it is ignored.
 .TP
 .B \-e
 Start editing in ex mode, as if the command name were



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001002164819.B76593>