Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/sed Use the same options like m4 (-g turns on GNU, -...



details:   https://anonhg.NetBSD.org/src/rev/2a27b7deed4b
branches:  trunk
changeset: 960202:2a27b7deed4b
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 11 15:45:55 2021 +0000

description:
Use the same options like m4 (-g turns on GNU, -G turns off GNU) Suggested
by uwe@

diffstat:

 usr.bin/sed/main.c |  15 +++++++++------
 usr.bin/sed/sed.1  |  10 ++++++----
 2 files changed, 15 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r 35aecdc1df5d -r 2a27b7deed4b usr.bin/sed/main.c
--- a/usr.bin/sed/main.c        Thu Mar 11 15:44:50 2021 +0000
+++ b/usr.bin/sed/main.c        Thu Mar 11 15:45:55 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.37 2021/03/11 15:15:05 christos Exp $       */
+/*     $NetBSD: main.c,v 1.38 2021/03/11 15:45:55 christos Exp $       */
 
 /*-
  * Copyright (c) 2013 Johann 'Myrkraverk' Oskarsson.
@@ -39,7 +39,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: main.c,v 1.37 2021/03/11 15:15:05 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.38 2021/03/11 15:45:55 christos Exp $");
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/usr.bin/sed/main.c 252231 2013-06-26 04:14:19Z pfg $");
 #endif
@@ -141,14 +141,14 @@
        fflag = 0;
        inplace = NULL;
 
-       while ((c = getopt(argc, argv, "EGI::ae:f:i::lnru")) != -1)
+       while ((c = getopt(argc, argv, "EGI::ae:f:gi::lnru")) != -1)
                switch (c) {
                case 'r':               /* Gnu sed compat */
                case 'E':
                        rflags |= REG_EXTENDED;
                        break;
                case 'G':
-                       rflags |= REG_GNU;
+                       rflags &= ~REG_GNU;
                        break;
                case 'I':
                        inplace = optarg ? optarg : __UNCONST("");
@@ -168,6 +168,9 @@
                        fflag = 1;
                        add_compunit(CU_FILE, optarg);
                        break;
+               case 'g':
+                       rflags |= REG_GNU;
+                       break;
                case 'i':
                        inplace = optarg ? optarg : __UNCONST("");
                        ispan = 0;      /* don't span across input files */
@@ -226,8 +229,8 @@
 usage(void)
 {
        (void)fprintf(stderr,
-           "Usage:  %s [-aElnru] command [file ...]\n"
-           "\t%s [-aEGlnru] [-e command] [-f command_file] [-I[extension]]\n"
+           "Usage:  %s [-aEGglnru] command [file ...]\n"
+           "\t%s [-aEGglnru] [-e command] [-f command_file] [-I[extension]]\n"
            "\t    [-i[extension]] [file ...]\n", getprogname(), getprogname());
        exit(1);
 }
diff -r 35aecdc1df5d -r 2a27b7deed4b usr.bin/sed/sed.1
--- a/usr.bin/sed/sed.1 Thu Mar 11 15:44:50 2021 +0000
+++ b/usr.bin/sed/sed.1 Thu Mar 11 15:45:55 2021 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sed.1,v 1.41 2021/03/11 15:15:05 christos Exp $
+.\"    $NetBSD: sed.1,v 1.42 2021/03/11 15:45:55 christos Exp $
 .\" Copyright (c) 1992, 1993
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
@@ -40,11 +40,11 @@
 .Nd stream editor
 .Sh SYNOPSIS
 .Nm
-.Op Fl aElnru
+.Op Fl aEGglnru
 .Ar command
 .Op Ar
 .Nm
-.Op Fl aEGlnru
+.Op Fl aEGglnru
 .Op Fl e Ar command
 .Op Fl f Ar command_file
 .Op Fl I Ns Op Ar extension
@@ -98,7 +98,9 @@
 to the list of commands.
 The editing commands should each be listed on a separate line.
 .It Fl G
-Support GNU regex extensions.
+Turn off GNU regex extensions (the default).
+.It Fl g
+Turn on GNU regex extensions.
 See 
 .Xr regex 3
 for details.



Home | Main Index | Thread Index | Old Index