From owner-cvs-all Tue May 7 15:54:12 2002 Delivered-To: cvs-all@freebsd.org Received: from dragon.nuxi.com (trang.nuxi.com [66.92.13.169]) by hub.freebsd.org (Postfix) with ESMTP id 3D31B37B407; Tue, 7 May 2002 15:54:06 -0700 (PDT) Received: from dragon.nuxi.com (obrien@localhost [127.0.0.1]) by dragon.nuxi.com (8.12.3/8.12.2) with ESMTP id g47Ms5ev031299; Tue, 7 May 2002 15:54:05 -0700 (PDT) (envelope-from obrien@dragon.nuxi.com) Received: (from obrien@localhost) by dragon.nuxi.com (8.12.3/8.12.3/Submit) id g47Ms5pY031298; Tue, 7 May 2002 15:54:05 -0700 (PDT) Date: Tue, 7 May 2002 15:54:05 -0700 From: "David O'Brien" To: "J. Mallett" Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/usr.bin/sed main.c sed.1 Message-ID: <20020507155405.A31179@dragon.nuxi.com> Reply-To: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Mail-Followup-To: David O'Brien , "J. Mallett" , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org References: <200205071832.g47IWJO26790@freefall.freebsd.org> <20020507214610.GA30780@FreeBSD.ORG> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020507214610.GA30780@FreeBSD.ORG>; from jmallett@FreeBSD.ORG on Tue, May 07, 2002 at 09:46:11PM +0000 X-Operating-System: FreeBSD 5.0-CURRENT Organization: The NUXI BSD group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, May 07, 2002 at 09:46:11PM +0000, J. Mallett wrote: > On Tue, May 07, 2002 at 11:32:18AM -0700, J. Mallett wrote: > > jmallett 2002/05/07 11:32:18 PDT > > > > Modified files: > > usr.bin/sed main.c sed.1 > > Log: > > Add a -i option to sed(1) to do inplace editing, to give us an > > alternative to Perl for such things. Actually looking at this, you are not doing things in the most robust order: sed -i.bak -e s/A/B/ foo should: open foo for reading create tmpfile for output read from foo, do /A/B/ write to tmpfile IF successful rename foo to foo.bak rename tmpfile to foo Anything else is not robust in the face of ^C, etc... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message