Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 May 2002 19:20:00 +0000
From:      "J. Mallett" <jmallett@FreeBSD.ORG>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        "J. Mallett" <jmallett@FreeBSD.ORG>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Garrett Rooney <rooneg@electricjellyfish.net>
Subject:   Re: cvs commit: src/usr.bin/sed main.c sed.1
Message-ID:  <20020507191959.GA26441@FreeBSD.ORG>
In-Reply-To: <XFMail.20020507150637.jhb@FreeBSD.org>
References:  <20020507184519.GB28857@FreeBSD.ORG> <XFMail.20020507150637.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, May 07, 2002 at 03:06:37PM -0400, John Baldwin wrote:
> 
> On 07-May-2002 J. Mallett wrote:
> > On Tue, May 07, 2002 at 02:39:43PM -0400, Garrett Rooney wrote:
> >> On Tue, May 07, 2002 at 11:32:18AM -0700, J. Mallett wrote:
> >>    
> >> >   Reviewed by:    developers@ (got feedback from: des, fanf, sobomax,
> >> >   roberto,
> >> >                   obrien)
> >> 
> >> is there a reason this was posted to developers@, rather than one of
> >> the public mailing lists?  it really doesn't seem like an additional
> >> flag for sed is something that needs to be discussed in private.
> > 
> > It came up in a discussion, and I felt sorta like I'd been dared to do it, so
> > I replied when I'd done it, and it got a surprisingly good response, so I
> > decided to clean it up, and commit it, once I'd satisfied all of my concerns
> > with it.
> 
> It still would have been a good idea to send out the actual patch for review
> on a public list.  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.  I only use -i when I'm not specifying a
> backup extension.  Those are the only times I use perl in fact, and thus I
> will probably continue to use perl for such things.

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?

And you're also 50% wrong, John.  No that is not what you might as well do, as
it doesn't handle multiple files.

As for the droppings, what I have in mind to do is just unlink the backup, if
the extension was not given, and to find some good extension to use to reopen
for stdin.

Seem reasonable?
-- 
jmallett@FreeBSD.org   | C, MIPS, POSIX, UNIX, BSD, IRC Geek.
http://www.FreeBSD.org | The Power to Serve
"I've never tried to give my life meaning by demeaning you."

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




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