From sethk@pike.osd.bsdi.com  Fri Sep 29 21:21:30 2000
Return-Path: <sethk@pike.osd.bsdi.com>
Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222])
	by hub.freebsd.org (Postfix) with ESMTP id C648D37B503
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 29 Sep 2000 21:21:29 -0700 (PDT)
Received: (from sethk@localhost)
	by pike.osd.bsdi.com (8.11.0/8.9.3) id e8U4LFj36655
	for freebsd-gnats-submit@FreeBSD.org; Fri, 29 Sep 2000 21:21:15 -0700 (PDT)
	(envelope-from sethk)
Message-Id: <20000929212115.B36464@osd.bsdi.com>
Date: Fri, 29 Sep 2000 21:21:15 -0700
From: Seth Kingsley <sethk@osd.bsdi.com>
Sender: sethk@pike.osd.bsdi.com
To: freebsd-gnats-submit@FreeBSD.org
Subject: Re: nvi's -c flag does no do what it is documented to do. (it does nothing)

>Number:         21654
>Category:       bin
>Synopsis:       Re: nvi's -c flag does no do what it is documented to do. (it does nothing)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 29 21:30:00 PDT 2000
>Closed-Date:    Sun Oct 21 18:27:21 PDT 2001
>Last-Modified:  Sun Oct 21 18:28:40 PDT 2001
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 It looks like not executing commands specified with the -c or + option
 is part of Nvi's compatiblity with traditional Vi. Also, using
 :r on a new file changes the filename of the current file to the file
 you just read from. This means that using vi -c'r /etc/motd' is
 effectively the same as just editing /etc/motd. The following patches
 complain when using the -c option without an initial filename:
 
 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/09/30 02:31:46
 @@ -107,7 +107,8 @@
  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 no file is specified, this
 +option is ignored.
  .TP
  .B \-e
  Start editing in ex mode, as if the command name were
 
 -- 
 || Seth Kingsley || BSDi/Open Source Division || sethk@osd.bsdi.com ||
 ||  The only thing missing from the emacs OS is a good text editor  ||
 
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: peter 
Responsible-Changed-When: Mon Oct 2 12:01:27 PDT 2000 
Responsible-Changed-Why:  
misfiled 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21654 
State-Changed-From-To: open->closed 
State-Changed-By: mikeh 
State-Changed-When: Sun Oct 21 18:27:21 PDT 2001 
State-Changed-Why:  
Superseded by bin/31420. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=21654 
>Unformatted:
