#! /bin/csh 
# Last edited on 2008-02-04 17:08:18 by stolfi

set usage = "$0 ALBUM SECTION..."

# Displays the images from Rene's CD 
# Looks for images in ${STOLFIHOME}/projects/voynich/docs/RZCD/ALBUM
# Each SECTION may be "all" (default) or "hea", "heb", ... 

if ( $#argv < 1) then
  echo "usage = $usage"; exit 1
endif

set showpg = "`which xv`"
if ( "/${showpg}" == "/xv: Command not found" ) then
  set showpg = "display"
endif

set album   = $1; shift;
if ($#argv == 0) then
  set sections = ( "all" )
else
  set sections = ( $* )
endif

set tmp = "/tmp/$$.dir"
set top = "${STOLFIHOME}/projects/voynich/docs/RZCD"

/bin/rm -f ${tmp}
foreach sec ( $sections ) 
  set ext = `cat ${top}/${album}/TYPE`
  cat ${top}/X-$sec.fnums \
    | sed -e 's/$/.'"${ext}"'/' \
    >> ${tmp}
end

( cd ${top}/${album} && ${showpg} `cat ${tmp}` )
