#! /bin/csh -f # Last edited on 2008-02-04 18:25:35 by stolfi set usage = "$0 FILE.ppm[|Z|gz] ..." # Lists the sizes (width and height) of the given PPM/PBM/PGM files, one per line. set path = ( /usr/local/bin /usr/bin /usr/ucb ) set pbmbin = "${STOLFIHOME}/pkg/netpbm-1mar1994-1/PUB/${PLATFORM}/bin" set gnubin = "/usr/bin" set getdims = "${STOLFIHOME}/bin/get-pnm-dimensions" if ( $#argv == 0 ) then echo "usage: ${usage}"; exit 1 endif foreach f ( $* ) if ( "/${f:e}" == "/Z" ) then set fxy = ( `zcat $f | ${getdims}` ) else if ( "/${f:e}" == "/gz" ) then set fxy = ( `cat $f | gunzip | ${getdims}` ) else set fxy = ( `cat $f | ${getdims}` ) endif printf "%5d %5d %s\n" $fxy[1] $fxy[2] $f end