Module Name: src
Committed By: christos
Date: Thu Mar 11 15:15:05 UTC 2021
Modified Files:
src/usr.bin/sed: main.c sed.1
Log Message:
Add -G to support GNU extensions
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/sed/main.c
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/sed/sed.1
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/sed/main.c
diff -u src/usr.bin/sed/main.c:1.36 src/usr.bin/sed/main.c:1.37
--- src/usr.bin/sed/main.c:1.36 Fri May 15 18:39:54 2020
+++ src/usr.bin/sed/main.c Thu Mar 11 10:15:05 2021
@@ -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);
}
Index: src/usr.bin/sed/sed.1
diff -u src/usr.bin/sed/sed.1:1.40 src/usr.bin/sed/sed.1:1.41
--- src/usr.bin/sed/sed.1:1.40 Tue Jun 24 22:05:58 2014
+++ src/usr.bin/sed/sed.1 Thu Mar 11 10:15:05 2021
@@ -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
.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 .