Date: Sun, 3 Mar 2002 00:27:40 -0600 (CST) From: "Matthew D.Fuller" <fullermd@over-yonder.net> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/35505: [PATCH] Feature enhancement for sed(1) Message-ID: <20020303062740.B59361F13@mortis.sighup.org>
next in thread | raw e-mail | index | archive | help
>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 <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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020303062740.B59361F13>