[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kdeprint/filters
From: Michael Goffioul <goffioul () imec ! be>
Date: 2002-12-17 9:23:19
[Download RAW message or body]
CVS commit by goffioul:
Removed bashism and support spaces in file name
M +14 -7 imagetops 1.3
--- kdelibs/kdeprint/filters/imagetops #1.2:1.3
@@ -21,5 +21,5 @@
ARGS="$ARGS $FILE"
FILE=`mktemp /tmp/imagetops.XXXXXX` || exit 1
- cat > $FILE
+ cat > "$FILE"
temp=1
fi
@@ -27,12 +27,14 @@
# check the file mime type, and set the command correspondingly
cmd=
-magic=`file -bi $FILE`
-if [[ $magic != image/* ]] ; then
+magic=`file -bi "$FILE"`
+magicbase=`echo $magic | cut -f 1 -d "/"`
+magictype=`echo $magic | cut -f 2- -d "/"`
+if test "$magicbase" != "image" ; then
echo "Not an image"
exit 1;
fi
-case ${magic/image\//} in
+case $magictype in
jpeg)
- cmd="djpeg -pnm"
+ cmd="jpegtopnm"
;;
png|x-png)
@@ -57,6 +59,11 @@
# executing command
if [ "$GRAYSCALE" = "1" ]; then
- exec $cmd $FILE | ppmtopgm | pnmtops $ARGS
+ exec $cmd "$FILE" | ppmtopgm | pnmtops $ARGS
else
- exec $cmd $FILE | pnmtops $ARGS
+ exec $cmd "$FILE" | pnmtops $ARGS
+fi
+
+# removing temporary file
+if test "$temp" = "1"; then
+ rm -f "$FILE"
fi
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic