From fullermd@mortis.sighup.org  Sat Mar  2 22:27:43 2002
Return-Path: <fullermd@mortis.sighup.org>
Received: from draco.over-yonder.net (draco.over-yonder.net [198.78.58.61])
	by hub.freebsd.org (Postfix) with ESMTP id 3E0BE37B405
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  2 Mar 2002 22:27:43 -0800 (PST)
Received: from mortis.sighup.org (mortis.over-yonder.net [64.89.206.226])
	by draco.over-yonder.net (Postfix) with ESMTP id 02FC9FC2
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  3 Mar 2002 00:27:42 -0600 (CST)
Received: by mortis.sighup.org (Postfix, from userid 100)
	id B59361F13; Sun,  3 Mar 2002 00:27:40 -0600 (CST)
Message-Id: <20020303062740.B59361F13@mortis.sighup.org>
Date: Sun,  3 Mar 2002 00:27:40 -0600 (CST)
From: Matthew D.Fuller <fullermd@over-yonder.net>
Sender: fullermd@mortis.sighup.org
Reply-To: Matthew D.Fuller <fullermd@over-yonder.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Feature enhancement for sed(1)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         35505
>Category:       bin
>Synopsis:       [PATCH] Feature enhancement for sed(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 02 22:30:01 PST 2002
>Closed-Date:    Sun Jul 28 06:36:57 PDT 2002
>Last-Modified:  Sun Jul 28 06:36:57 PDT 2002
>Originator:     Matthew D. Fuller
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD mortis.sighup.org 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed Oct 31 00:17:52 CST 2001 fullermd@mortis.sighup.org:/usr/src/sys/i386/compile/MORTIS i386


	
>Description:

	GNU grep has a neat feature, in that its several major modes
	(general, extended, fixed, and compress'd) are available both as
	command-line switches, and by alternate calling names.

	sed(1) should do the same!  Just as grep(1) can be called as "grep"
	for basic regex's and either "egrep" or "grep -E" for extended
	regex's, sed(1) should be callable as "esed" as well as "sed -E" for
	extended regex's.

	OK, "should" is a bit strong a presumptuous.  But I like the idea, so
	here's the patch.

>How-To-Repeat:

	Spent 10 minutes trying to figure out why sed isn't working, then
	realize it's interpreting basic regex's instead of extended.  Then
	spend 30 seconds trying to figure out why egrep works and esed
	doesn't.

>Fix:

Index: Makefile
===================================================================
RCS file: /usr/cvs/src/usr.bin/sed/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile	2002/02/08 23:07:35	1.4
+++ Makefile	2002/03/03 06:13:02
@@ -4,5 +4,6 @@
 PROG=	sed
 SRCS=	compile.c main.c misc.c process.c
 
+LINKS+= ${BINDIR}/sed ${BINDIR}/esed
 
 .include <bsd.prog.mk>
Index: main.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/sed/main.c,v
retrieving revision 1.14
diff -u -r1.14 main.c
--- main.c	2001/12/12 23:20:16	1.14
+++ main.c	2002/03/03 06:19:45
@@ -115,8 +115,17 @@
 {
 	int c, fflag;
 	char *temp_arg;
+	char *progname;
 
 	(void) setlocale(LC_ALL, "");
+
+	progname = strrchr(*argv, '/');
+	if(progname)
+		progname++;
+	else
+		progname=*argv;
+	if(*progname=='e')
+		rflags = REG_EXTENDED;
 
 	fflag = 0;
 	while ((c = getopt(argc, argv, "Eae:f:n")) != -1)
>Release-Note:
>Audit-Trail:

From: Peter Pentchev <roam@ringlet.net>
To: "Matthew D.Fuller" <fullermd@over-yonder.net>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/35505: [PATCH] Feature enhancement for sed(1)
Date: Sun, 3 Mar 2002 21:05:05 +0200

 On Sun, Mar 03, 2002 at 12:27:40AM -0600, Matthew D.Fuller wrote:
 >=20
 > >Number:         35505
 > >Category:       bin
 > >Synopsis:       [PATCH] Feature enhancement for sed(1)
 > >Originator:     Matthew D. Fuller
 [snip]
 > >Fix:
 [patch snipped]
 
 I think that something like the attached would befit style(9) more.
 Other than a few style nits, your patch looks great, and the functionality
 is something that I really do like :)
 
 Now let us see how this goes down with the src committers..
 
 G'luck,
 Peter
 
 --=20
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 This sentence contradicts itself - or rather - well, no, actually it doesn'=
 t!
 
 Index: src/usr.bin/sed/Makefile
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/usr.bin/sed/Makefile,v
 retrieving revision 1.4
 diff -u -r1.4 Makefile
 --- src/usr.bin/sed/Makefile	8 Feb 2002 23:07:35 -0000	1.4
 +++ src/usr.bin/sed/Makefile	3 Mar 2002 18:59:52 -0000
 @@ -4,5 +4,6 @@
  PROG=3D	sed
  SRCS=3D	compile.c main.c misc.c process.c
 =20
 +LINKS+=3D ${BINDIR}/sed ${BINDIR}/esed
 =20
  .include <bsd.prog.mk>
 Index: src/usr.bin/sed/main.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /home/ncvs/src/usr.bin/sed/main.c,v
 retrieving revision 1.14
 diff -u -r1.14 main.c
 --- src/usr.bin/sed/main.c	12 Dec 2001 23:20:16 -0000	1.14
 +++ src/usr.bin/sed/main.c	3 Mar 2002 19:01:05 -0000
 @@ -114,9 +114,17 @@
  	char *argv[];
  {
  	int c, fflag;
 -	char *temp_arg;
 +	char *progname, *temp_arg;
 =20
  	(void) setlocale(LC_ALL, "");
 +
 +	progname =3D strrchr(*argv, '/');
 +	if (progname !=3D NULL)
 +		progname++;
 +	else
 +		progname =3D *argv;
 +	if (*progname=3D=3D'e')
 +		rflags =3D REG_EXTENDED;
 =20
  	fflag =3D 0;
  	while ((c =3D getopt(argc, argv, "Eae:f:n")) !=3D -1)

From: Peter Pentchev <roam@ringlet.net>
To: "Matthew D.Fuller" <fullermd@over-yonder.net>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/35505: [PATCH] Feature enhancement for sed(1)
Date: Sun, 3 Mar 2002 23:21:35 +0200

 On Sun, Mar 03, 2002 at 11:10:01AM -0800, Peter Pentchev wrote:
 > The following reply was made to PR bin/35505; it has been noted by GNATS.
 > 
 > From: Peter Pentchev <roam@ringlet.net>
 > To: "Matthew D.Fuller" <fullermd@over-yonder.net>
 > Cc: FreeBSD-gnats-submit@freebsd.org
 > Subject: Re: bin/35505: [PATCH] Feature enhancement for sed(1)
 > Date: Sun, 3 Mar 2002 21:05:05 +0200
 > 
 >  On Sun, Mar 03, 2002 at 12:27:40AM -0600, Matthew D.Fuller wrote:
 >  >=20
 >  > >Number:         35505
 >  > >Category:       bin
 >  > >Synopsis:       [PATCH] Feature enhancement for sed(1)
 >  > >Originator:     Matthew D. Fuller
 >  [snip]
 >  > >Fix:
 >  [patch snipped]
 >  
 >  I think that something like the attached would befit style(9) more.
 >  Other than a few style nits, your patch looks great, and the functionality
 >  is something that I really do like :)
 >  
 >  Now let us see how this goes down with the src committers..
 
 Come to think of it, a manual page update might also be in order.
 The attached patch adds a brief description of 'esed' to the manual
 page, as well as converts spaces to tabs in the Makefile.
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain.
 
 Index: src/usr.bin/sed/Makefile
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/sed/Makefile,v
 retrieving revision 1.4
 diff -u -r1.4 Makefile
 --- src/usr.bin/sed/Makefile	8 Feb 2002 23:07:35 -0000	1.4
 +++ src/usr.bin/sed/Makefile	3 Mar 2002 21:17:59 -0000
 @@ -4,5 +4,7 @@
  PROG=	sed
  SRCS=	compile.c main.c misc.c process.c
  
 +LINKS=	${BINDIR}/sed ${BINDIR}/esed
 +MLINKS=	sed.1 esed.1
  
  .include <bsd.prog.mk>
 Index: src/usr.bin/sed/main.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/sed/main.c,v
 retrieving revision 1.14
 diff -u -r1.14 main.c
 --- src/usr.bin/sed/main.c	12 Dec 2001 23:20:16 -0000	1.14
 +++ src/usr.bin/sed/main.c	3 Mar 2002 19:01:05 -0000
 @@ -114,9 +114,17 @@
  	char *argv[];
  {
  	int c, fflag;
 -	char *temp_arg;
 +	char *progname, *temp_arg;
  
  	(void) setlocale(LC_ALL, "");
 +
 +	progname = strrchr(*argv, '/');
 +	if (progname != NULL)
 +		progname++;
 +	else
 +		progname = *argv;
 +	if (*progname=='e')
 +		rflags = REG_EXTENDED;
  
  	fflag = 0;
  	while ((c = getopt(argc, argv, "Eae:f:n")) != -1)
 Index: src/usr.bin/sed/sed.1
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/sed/sed.1,v
 retrieving revision 1.19
 diff -u -r1.19 sed.1
 --- src/usr.bin/sed/sed.1	15 Aug 2001 09:09:43 -0000	1.19
 +++ src/usr.bin/sed/sed.1	3 Mar 2002 21:16:38 -0000
 @@ -39,7 +39,8 @@
  .Dt SED 1
  .Os
  .Sh NAME
 -.Nm sed
 +.Nm sed ,
 +.Nm esed
  .Nd stream editor
  .Sh SYNOPSIS
  .Nm
 @@ -76,6 +77,11 @@
  The
  .Xr re_format 7
  manual page fully describes both formats.
 +When
 +.Nm
 +is invoked as
 +.Nm esed ,
 +it treats regular expressions as extended by default.
  .It Fl a
  The files listed as parameters for the
  .Dq w

From: "Matthew D. Fuller" <fullermd@over-yonder.net>
To: Bruce Evans <bde@zeta.org.au>
Cc: Peter Pentchev <roam@ringlet.net>,
	freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/35505: [PATCH] Feature enhancement for sed(1)
Date: Sat, 9 Mar 2002 04:28:03 -0600

 On Wed, Mar 06, 2002 at 12:10:51AM +1100 I heard the voice of
 Bruce Evans, and lo! it spake thus:
 > 
 > GNU had to keep [ef]grep for historical reasons.  GNU zgrep has to have
 > a different name because it is a different utility (at least in the old
 > version of it in FreeBSD) -- it is an (unused in FreeBSD) shell script in
 > the gzip distribution.  zgrep as part of grep is a FreeBSD hack, at least
 > in the version in FreeBSD.  Even if it were part of GNU egrep, it would
 > have to have a link named zgrep for backwards compatibility.
 
 Well, that makes one vote for, and Bruce against.  :)
 
 So, what's the procedure now?  I guess we see if anybody with a commit
 bit likes it well enough to toss it in, and if not, close it and call it
 decided?
 
 
 
 -- 
 Matthew Fuller     (MF4839)     |    fullermd@over-yonder.net
 Unix Systems Administrator      |    fullermd@futuresouth.com
 Specializing in FreeBSD         |    http://www.over-yonder.net/
 
 "The only reason I'm burning my candle at both ends, is because I
       haven't figured out how to light the middle yet"

From: "Matthew D. Fuller" <fullermd@over-yonder.net>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: bin/35505: [PATCH] Feature enhancement for sed(1)
Date: Sun, 28 Jul 2002 05:52:39 -0500

 <KEEPALIVE>
 
 If somebody is interested in this functionality, could they commit it?
 Else, it can probably be closed, since I'm not sufficiently attached to
 it to fight for it over bde's objection.
 
 
 
 -- 
 Matthew Fuller     (MF4839)   |  fullermd@over-yonder.net
 Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
 
 "The only reason I'm burning my candle at both ends, is because I
       haven't figured out how to light the middle yet"
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Sun Jul 28 06:33:51 PDT 2002 
State-Changed-Why:  
Close this PR due to lack of interest. Peter Pentchev originially 
expressed some interest in the patch, so if he wants to commit 
he can reopen the PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35505 
>Unformatted:
