Add a -r flag that is an alias for -E, for compatibility with gnu sed.

This commit is contained in:
perry 2008-09-16 13:32:04 +00:00
parent d451eab1e2
commit 5a047c798a
2 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.18 2008/07/21 14:19:26 lukem Exp $ */
/* $NetBSD: main.c,v 1.19 2008/09/16 13:32:04 perry Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94";
#else
__RCSID("$NetBSD: main.c,v 1.18 2008/07/21 14:19:26 lukem Exp $");
__RCSID("$NetBSD: main.c,v 1.19 2008/09/16 13:32:04 perry Exp $");
#endif
#endif /* not lint */
@ -150,7 +150,7 @@ main(int argc, char *argv[])
setprogname(*argv);
fflag = 0;
while ((c = getopt(argc, argv, "ae:f:nE")) != -1)
while ((c = getopt(argc, argv, "ae:f:nrE")) != -1)
switch (c) {
case 'a':
aflag = 1;
@ -166,13 +166,14 @@ main(int argc, char *argv[])
case 'n':
nflag = 1;
break;
case 'r':
case 'E':
ere = REG_EXTENDED;
break;
default:
case '?':
(void)fprintf(stderr,
"usage:\t%s [-aEn] script [file ...]\n\t%s [-aEn] [-e script] ... [-f script_file] ... [file ...]\n",
"usage:\t%s [-aEnr] script [file ...]\n\t%s [-aEnr] [-e script] ... [-f script_file] ... [file ...]\n",
getprogname(), getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sed.1,v 1.25 2006/05/14 14:34:49 wiz Exp $
.\" $NetBSD: sed.1,v 1.26 2008/09/16 13:32:04 perry Exp $
.\"
.\" Copyright (c) 1992, 1993
.\" The Regents of the University of California. All rights reserved.
@ -32,7 +32,7 @@
.\"
.\" @(#)sed.1 8.2 (Berkeley) 12/30/93
.\"
.Dd May 14, 2006
.Dd September 16, 2008
.Dt SED 1
.Os
.Sh NAME
@ -40,11 +40,11 @@
.Nd stream editor
.Sh SYNOPSIS
.Nm
.Op Fl aEn
.Op Fl aEnr
.Ar command
.Op Ar file ...
.Nm
.Op Fl aEn
.Op Fl aEnr
.Op Fl e Ar command
.Op Fl f Ar command_file
.Op Ar file ...
@ -82,6 +82,10 @@ function is applied to a line of input.
.It Fl E
Enables the use of extended regular expressions instead of the
usual basic regular expression syntax.
.It Fl r
Identical to
.Fl E ,
present for compatibility with Gnu sed.
.It Fl e Ar command
Append the editing commands specified by the
.Ar command