about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-07-05 17:48:57 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-07-05 17:48:57 +0000
commit00689cb51661846234b343c052212a834e835e46 (patch)
tree3cd823d717404f9e3c5eb825bec69f2ce1f5c5e6 /converter
parent7948d72da35dfa541b5313aceb61883bbe99be10 (diff)
downloadnetpbm-mirror-00689cb51661846234b343c052212a834e835e46.tar.gz
netpbm-mirror-00689cb51661846234b343c052212a834e835e46.tar.xz
netpbm-mirror-00689cb51661846234b343c052212a834e835e46.zip
Fix garbage conversion from csh arrays
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3891 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rwxr-xr-xconverter/ppm/hpcdtoppm/pcdovtoppm34
1 files changed, 17 insertions, 17 deletions
diff --git a/converter/ppm/hpcdtoppm/pcdovtoppm b/converter/ppm/hpcdtoppm/pcdovtoppm
index 7f7239e3..b86048cc 100755
--- a/converter/ppm/hpcdtoppm/pcdovtoppm
+++ b/converter/ppm/hpcdtoppm/pcdovtoppm
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # pcdovtoppm - generate a single PPM file from a PCD overview file
 #
@@ -136,7 +136,7 @@ done
 
 if [ $versionopt -eq 1 ] ; then
     version
-elif [ $# = 0 ] ; then
+elif [ $# -eq 0 ] ; then
     usage
 fi
 
@@ -146,12 +146,6 @@ trap 'rm -rf $tempdir' 0
 
 tmpfile=`tempfile -p pi -m 600`
 
-rowfiles=()
-imagefiles=()
-row=1
-col=1
-width=$size
-
 # Convert the PCD overview file to many PPM images
 if [ -f $1 ] ; then
     hpcdtoppm -Overview $1 $tmpfile ||
@@ -162,14 +156,20 @@ else
     usage
 fi
 
+imagefiles=
+rowfiles=
+row=1
+col=1
+width=$size
+
 for i in "$tmpfile"* 
 do
     if [ -f $i ] ; then
-        description=`pnmfile $i`
-        if [ "${description[4]}" -le $size -a \
-             "${description[6]}" -le $size ] ; then
+        thiswidth=$(pamfile -machine $i | cut -f 4 -d ' ')
+        thisheight=$(pamfile -machine $i | cut -f 5 -d ' ')
+        if [ "$thiswidth" -le $size -a "$thisheight" -le $size ] ; then
             cat $i > $tmpfile
-                else
+        else
             if [ "$colors" = "n" ] ; then
                 pnmscale -quiet -xysize $size $size $i > $tmpfile
             else
@@ -191,8 +191,8 @@ do
     fi
 
     rm -f $tmpfile
-    description=`pnmfile $imagefile`
-    width=$(( $width + ${description[4]} ))
+    thisWidth=$(pamfile -machine $i | cut -f 4 -d ' ')
+    width=$(( $width + $thisWidth ))
     imagefiles="$imagefiles $imagefile"
 
     if [ $col -ge $across -o $width -gt $maxwidth ] ; then
@@ -205,7 +205,7 @@ do
         ppmquant -quiet $colors > $rowfile
     fi
     rm -f $imagefiles
-    imagefiles=()
+    imagefiles=
     rowfiles="$rowfiles $rowfile"
     col=1
     row=$(( $row + 1 ))
@@ -215,7 +215,7 @@ do
     fi
 done
 
-if [ ${#imagefiles[*]} -gt 0 ] ; then
+if [ -n $imagefiles ] ; then
     rowfile=${tempdir}/pi.${row}
     rm -f $rowfile
     if [ "$colors" = "n" ] ; then
@@ -228,7 +228,7 @@ if [ ${#imagefiles[*]} -gt 0 ] ; then
     rowfiles="$rowfiles $rowfile"
 fi
 
-if [ ${#rowfiles[*]} = 1 ] ; then
+if [ $(echo $rowfiles|wc -w) -eq 1 ] ; then
     ppmtoppm $plainopt < $rowfiles
 else
     if [ "$colors" = "n" ] ; then