[PATCH] Don't use the -i option with sed

Ollivier Robert roberto at keltia.freenix.fr
Thu Jan 10 03:22:18 CST 2008


According to Matt Mackall:
> Queued, thanks.

Note that, to make things a bit more complex, that at least FreeBSD has
implemented -i for BSD sed a long time ago.

changeset:   73562:bd2ae37225bb
user:        jmallett
date:        Tue May 07 18:32:18 2002 +0000
files:       usr.bin/sed/main.c usr.bin/sed/sed.1
description:
Add a -i option to sed(1) to do inplace editing, to give us an alternative
to Perl for such things.  The key difference to Perl is that a backup
extension *MUST* be specified, because on one hand it isn't recommended to
have options which optionally take a parameter, and on the other hand, it'd
be slightly unpleasent to implement proper handling for that.

The difference between this and the version posted to developers@ is that
it does handle multiple files in argv after the getopt(3) handling
"correctly", in that the inplace editing-specific code has been moved out
to a function, and that function is used beyond the first file in our
linked list.

This option has been documented as FreeBSD-specific in the manpage.

Reviewed by:    developers@ (got feedback from: des, fanf, sobomax,
roberto, obrien)

MFC after:      1 week

-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto at keltia.freenix.fr
Darwin sidhe.keltia.net Version 8.10.1: Wed May 23 16:33:00 PDT 2007 i386


More information about the Mercurial-devel mailing list