From owner-cvs-all Tue May 7 16:20:42 2002 Delivered-To: cvs-all@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 796ED37B409; Tue, 7 May 2002 16:20:24 -0700 (PDT) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.12.1/8.12.1) with ESMTP id g47NKMob160322; Tue, 7 May 2002 19:20:23 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20020507191959.GA26441@FreeBSD.ORG> References: <20020507184519.GB28857@FreeBSD.ORG> <20020507191959.GA26441@FreeBSD.ORG> Date: Tue, 7 May 2002 19:20:21 -0400 To: "J. Mallett" , John Baldwin From: Garance A Drosihn Subject: Re: cvs commit: src/usr.bin/sed main.c sed.1 Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) 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 At 7:20 PM +0000 5/7/02, J. Mallett wrote: >On Tue, May 07, 2002 at 03:06:37PM -0400, John Baldwin wrote: > > Personally, I won't use sed -i if it insists on leaving > > backup files around that I have to go the trouble to delete. > > I might as well just do > > sed 'foo' < foo > foo.bak this does not work well when you're also using 'sudo'... >Various points taken. Tell me the preferred way to handle >options which may or may not take arguments, and I'll give >it my best shot. I'd assume it's to do something like > >case 'i': > if (*argv[optind+1] != '-') { > take the option from argv[optind++]; > } else > set a binary flag for -i, and don't set the extension. > break; > >Does that seem right? We do not want options which "may or may not take arguments". The standards only allow those as concessions to older code which was written that way. I am pretty sure all "new code" has options such that they either always take an argument, or they never take an argument. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message