Add -G to support GNU extensions

This commit is contained in:
christos 2021-03-11 15:15:05 +00:00
parent 0ad4def4b8
commit d502916eaa
2 changed files with 16 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.36 2020/05/15 22:39:54 christos Exp $ */
/* $NetBSD: main.c,v 1.37 2021/03/11 15:15:05 christos Exp $ */
/*-
* Copyright (c) 2013 Johann 'Myrkraverk' Oskarsson.
@ -39,7 +39,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: main.c,v 1.36 2020/05/15 22:39:54 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.37 2021/03/11 15:15:05 christos Exp $");
#ifdef __FBSDID
__FBSDID("$FreeBSD: head/usr.bin/sed/main.c 252231 2013-06-26 04:14:19Z pfg $");
#endif
@ -141,11 +141,14 @@ main(int argc, char *argv[])
fflag = 0;
inplace = NULL;
while ((c = getopt(argc, argv, "EI::ae:f:i::lnru")) != -1)
while ((c = getopt(argc, argv, "EGI::ae:f:i::lnru")) != -1)
switch (c) {
case 'r': /* Gnu sed compat */
case 'E':
rflags = REG_EXTENDED;
rflags |= REG_EXTENDED;
break;
case 'G':
rflags |= REG_GNU;
break;
case 'I':
inplace = optarg ? optarg : __UNCONST("");
@ -224,7 +227,7 @@ usage(void)
{
(void)fprintf(stderr,
"Usage: %s [-aElnru] command [file ...]\n"
"\t%s [-aElnru] [-e command] [-f command_file] [-I[extension]]\n"
"\t%s [-aEGlnru] [-e command] [-f command_file] [-I[extension]]\n"
"\t [-i[extension]] [file ...]\n", getprogname(), getprogname());
exit(1);
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sed.1,v 1.40 2014/06/25 02:05:58 uwe Exp $
.\" $NetBSD: sed.1,v 1.41 2021/03/11 15:15:05 christos 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
.\" $FreeBSD: head/usr.bin/sed/sed.1 259132 2013-12-09 18:57:20Z eadler $
.\"
.Dd June 18, 2014
.Dd March 11, 2021
.Dt SED 1
.Os
.Sh NAME
@ -44,7 +44,7 @@
.Ar command
.Op Ar
.Nm
.Op Fl aElnru
.Op Fl aEGlnru
.Op Fl e Ar command
.Op Fl f Ar command_file
.Op Fl I Ns Op Ar extension
@ -97,6 +97,11 @@ Append the editing commands found in the file
.Ar command_file
to the list of commands.
The editing commands should each be listed on a separate line.
.It Fl G
Support GNU regex extensions.
See
.Xr regex 3
for details.
.It Fl I Ns Op Ar extension
Edit files in-place, saving backups with the specified
.Ar extension .