Eliminate egrep -q in mc.menu

root at sav.it.efp.com.ua root at sav.it.efp.com.ua
Fri Oct 5 07:43:53 UTC 2001


Hi!

This patch eliminate unportable egrep -q usage in mc.menu file.
It seems case xxx in *.tgz) is more portable. If it is really
so I can rewrite mc.menu in such order at all.

Best regards,
Andrew.

ChangeLog:

	lib/mc.menu: Eliminate egrep -q, use case instead.

Index: mc.menu
===================================================================
RCS file: /cvs/gnome/mc/lib/mc.menu,v
retrieving revision 1.5
diff -u -p -r1.5 mc.menu
--- mc.menu	2000/05/09 01:18:29	1.5
+++ mc.menu	2001/10/05 07:22:16
@@ -229,26 +229,17 @@ B       Bzip2 or bunzip2 tagged files
 
 + f \.tar.gz$ | f \.tgz$ | f \.tpz$ | f \.tar.Z$ | f \.tar.z$ | f \.tar.bz2$ & t r & ! t t
 z       Extract compressed tar file to subdirectory
-        unset D
-	echo %f|egrep -q "\.tar.gz$" && EXT=tar_gz
-	echo %f|egrep -q "\.tgz$"    && EXT=tgz
-	echo %f|egrep -q "\.tpz$"    && EXT=tpz
-	echo %f|egrep -q "\.tar.Z$"    && EXT=tar_Z
-	echo %f|egrep -q "\.tar.z$"    && EXT=tar_z
-	echo %f|egrep -q "\.tar.bz2$"  && EXT=tar_bz2
-        case $EXT in
-          tar_gz) D="`basename %f .tar.gz`";;
-          tgz)    D="`basename %f .tgz`";;
-          tpz)    D="`basename %f .tpz`";;
-          tar_Z)  D="`basename %f .tar.Z`";;
-          tar_z)  D="`basename %f .tar.z`";;
-	  tar_bz2) D="`basename %f .tar.bz2`";;
-        esac
-        if [ "$EXT" = "tar_bz2" ]; then
-            mkdir $D; cd $D && (bunzip2 -c ../%f | tar xvf -)
-	else
-	    mkdir $D; cd $D && (gzip -dc ../%f | tar xvf -)
-	fi
+	unset D
+	set gzip -cd
+	case %f in
+	  *.tar.gz) D="`basename %f .tar.gz`";;
+	  *.tgz)    D="`basename %f .tgz`";;
+	  *.tpz)    D="`basename %f .tpz`";;
+	  *.tar.Z)  D="`basename %f .tar.Z`";;
+	  *.tar.z)  D="`basename %f .tar.z`";;
+	  *.tar.bz2) D="`basename %f .tar.bz2`"; set bunzip2 -c ;;
+	esac
+	mkdir $D; cd $D && ($1 $2 ../%f | tar xvf -)
 
 + f \.tar.F$ & t r & ! t t
 z	Extract compressed tar file to subdirectory




More information about the mc-devel mailing list