Use exec and fix handling of filenames containing whitespace.
authorPeter Avalos <pavalos@dragonflybsd.org>
Sun, 3 Jun 2007 03:59:53 +0000 (03:59 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 3 Jun 2007 03:59:53 +0000 (03:59 +0000)
Obtained-from:  FreeBSD

usr.bin/less/lesspipe.sh

index 5380a46..3827879 100644 (file)
@@ -1,14 +1,17 @@
 #! /bin/sh
 # ex:ts=8
 
-# $FreeBSD: src/usr.bin/less/lesspipe.sh,v 1.1.2.1 2003/03/16 04:48:44 obrien Exp $
-# $DragonFly: src/usr.bin/less/lesspipe.sh,v 1.2 2003/06/17 04:29:27 dillon Exp $
+# $FreeBSD: src/usr.bin/less/lesspipe.sh,v 1.4 2007/05/24 18:28:08 le Exp $
+# $DragonFly: src/usr.bin/less/lesspipe.sh,v 1.3 2007/06/03 03:59:53 pavalos Exp $
 
 case "$1" in
-       *.Z)    uncompress -c $1        2>/dev/null
+       *.Z)
+               exec uncompress -c "$1" 2>/dev/null
                ;;
-       *.gz)   gzip -d -c $1           2>/dev/null
+       *.gz)
+               exec gzip -d -c "$1"    2>/dev/null
                ;;
-       *.bz2)  bzip2 -d -c $1          2>/dev/null
+       *.bz2)
+               exec bzip2 -d -c "$1"   2>/dev/null
                ;;
 esac