#!/bin/sh # # NOTE: IF command has negative logic # # Revision History # 1 Oct 1994 zip/arj/lzh tests --jon # 7 Jun 1996 arj section updated --jopi # 20 Aug 1996 arc section added --jopi # 11 Oct 1996 uppercase names added --jopi # 16 Nov 1996 name parameters added --jopi # 3 Dec 1996 accept .good _correct --jopi # 7 Feb 1997 lha, zoo added --jopi # 21 Feb 1997 test for any zero size files --jopi # 4 Apr 1998 quiet, debug and verbose --jopi # # # Usage: ziptest [-d][-v] [ files ] # debug= verbose= continue=; while $continue; do case $1 in --) continue=false ;; -d|-debug) debug=1 shift ;; -q|-quiet) verbose= shift ;; -v|-verbose) verbose=1 shift ;; -*|+*) # Real kludge to filter - things out of test sentence. echo "Illegal parameter." exit 1 ;; *) continue=false ;; esac done ## -------------------------------------------------------------------------- ## Files ## case $# in 0) files=`echo *` ;; *) files="$@"; ;; esac if [ X$debug -ne X ]; then echo $files fi ## -------------------------------------------------------------------------- ## Loop all files ## for index in $files do if [ X$debug$verbose != X ]; then # STRING comparison echo "" echo "Testing $index" fi case `basename $index [_.]good` in *.arc|*.ARC) if arc t $index 1>/dev/null 2>&1; then echo "ok $index" else echo "ERROR $index" fi ;; *.arj|*.ARJ) if unarj t $index 1>/dev/null 2>&1; then echo "ok $index" else echo "ERROR $index" fi ;; *.lha|*.LHA|*.lzh|*.LZH) if lha t $index 1>/dev/null 2>&1; then echo "ok $index" else echo "ERROR $index" fi ;; *.zip|*.ZIP) if unzip -t $index 1>/dev/null 2>&1; then echo "ok $index" else echo "ERROR $index" fi ;; *.zoo|*.ZOO) if zoo -test $index 1>/dev/null 2>&1; then echo "ok $index" else echo "ERROR $index" fi ;; *.txt|*.TXT|README*) if [ ! -s $index ]; then echo "ERROR $index" # Zero-sized .txt file fi ;; *) if [ ! -s $index ]; then echo "ERROR $index" # Zero-sized file else echo "Unknown $index" fi ;; esac done echo "done."