Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/sed Add -G to support GNU extensions



details:   https://anonhg.NetBSD.org/src/rev/bfece30236a2
branches:  trunk
changeset: 981421:bfece30236a2
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 11 15:15:05 2021 +0000

description:
Add -G to support GNU extensions

diffstat:

 usr.bin/sed/main.c |  13 ++++++++-----
 usr.bin/sed/sed.1  |  11 ++++++++---
 2 files changed, 16 insertions(+), 8 deletions(-)

diffs (83 lines):

diff -r 9fd839bf6049 -r bfece30236a2 usr.bin/sed/main.c
--- a/usr.bin/sed/main.c        Thu Mar 11 15:12:51 2021 +0000
+++ b/usr.bin/sed/main.c        Thu Mar 11 15:15:05 2021 +0000
@@ -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 @@
        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 @@
 {
        (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);
 }
diff -r 9fd839bf6049 -r bfece30236a2 usr.bin/sed/sed.1
--- a/usr.bin/sed/sed.1 Thu Mar 11 15:12:51 2021 +0000
+++ b/usr.bin/sed/sed.1 Thu Mar 11 15:15:05 2021 +0000
@@ -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 @@
 .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 .



Home | Main Index | Thread Index | Old Index