From owner-freebsd-bugs Sat Mar 2 22:30:14 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 51EFC37B402 for ; Sat, 2 Mar 2002 22:30:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g236U1F78376; Sat, 2 Mar 2002 22:30:01 -0800 (PST) (envelope-from gnats) Received: from draco.over-yonder.net (draco.over-yonder.net [198.78.58.61]) by hub.freebsd.org (Postfix) with ESMTP id 3E0BE37B405 for ; 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 ; 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" Reply-To: "Matthew D.Fuller" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/35505: [PATCH] Feature enhancement for sed(1) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 35505 >Category: bin >Synopsis: [PATCH] Feature enhancement for sed(1) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Mar 02 22:30:01 PST 2002 >Closed-Date: >Last-Modified: >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 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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message