⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 check.lrzsz

📁 Linux下ztelnet 的rz、sz源码
💻 LRZSZ
📖 第 1 页 / 共 2 页
字号:
#! /bin/shtestdir="testdir.lrzsz"srcdir="$1"if test $srcdir = . ; then	srcdir=`pwd`fiif test $srcdir = .. ; then	srcdir=`pwd`/..fiobjdir="$2"if test $objdir = . ; then	objdir=`pwd`fiif test "x$3" = x ; then	mode=allelse	mode=$3fi#SZBUFSIZE="-B 524288"RZBUFSIZE="-B 524288"SZ="$objdir/src/lsz"RZ="$objdir/src/lrz"echo checking with srcdir = $1 and objdir = $2# z_test_files: files to test zmodem with.# z8_test_files: files to test zmodem-8k with. Optional.# y_test_files: files to test ymodem with.# x_test_files: files to test xmodem with. Must be ascii, as we need the#               ascii mode to remove the padding ^Zs.# generate list of testfiles z_test_files=""for i in $srcdir/src/l?z.c ; do	z_test_files="$z_test_files $i" 	x_test_files="$x_test_files $i" donefor i in $objdir/src/l?z ; do	z_test_files="$z_test_files $i" 	y_test_files="$y_test_files $i" donefor i in /pub/gnu/emacs-1*.tar.gz ; do	if test -f "$i" ; then		z8_test_files="$z8_test_files $i" 		z_test_files="$z_test_files $i" 	fidone# change to tmp dirif test "x$TMPDIR" = x ; then	cd /tmpelse	cd $TMPDIR || cd /tmpfirm -rf $testdirmkdir $testdirexec 5>$testdir/error.log(mkfifo $testdir/pipe || mknod $testdir/pipe p) 2>&5# test zmodemif test "$mode" = all -o "$mode" = z ; then	echo "testing ZMODEM"	mkdir $testdir/zmodem	failed=0	($SZ -q $SZBUFSIZE $z_test_files ) <$testdir/pipe | \		(cd $testdir/zmodem ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )	for i in $z_test_files ; do 		bn=`basename $i`		cmp $i $testdir/zmodem/$bn		if test $? -eq 0 ; then			rm -f $testdir/zmodem/$bn		else			failed=1		fi	done	rmdir $testdir/zmodem 2>&5	if test $failed = 1 ; then 		echo "ZMODEM test failed"		any_failure="$any_failure ZMODEM"	fifi# test zmodem framlenif test "$mode" = f ; then	echo "testing ZMODEMframlen"	mkdir $testdir/zmodem	failed=0	($SZ -q $SZBUFSIZE -l 128 $z_test_files ) <$testdir/pipe | \		(cd $testdir/zmodem ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )	for i in $z_test_files ; do 		bn=`basename $i`		cmp $i $testdir/zmodem/$bn		if test $? -eq 0 ; then			rm -f $testdir/zmodem/$bn		else			failed=1		fi	done	rmdir $testdir/zmodem 2>&5	if test $failed = 1 ; then 		echo "ZMODEM test failed"		any_failure="$any_failure ZMODEM"	fifi# test zmodem-4kif test "$mode" = all -o "$mode" = z4 ; then	echo "testing ZMODEM4K"	mkdir $testdir/zmodem4k	failed=0	($SZ -q4 $SZBUFSIZE $z_test_files ) <$testdir/pipe | \		(cd $testdir/zmodem4k ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )	for i in $z_test_files ; do 		bn=`basename $i`		cmp $i $testdir/zmodem4k/$bn		if test $? -eq 0 ; then			rm -f $testdir/zmodem4k/$bn		else			failed=1		fi	done	rmdir $testdir/zmodem4k 2>&5	if test $failed = 1 ; then 		echo "ZMODEM4k test failed"		any_failure="$any_failure ZMODEM4k"	fifi# test zmodem8kif test "$mode" = all -o "$mode" = z8 ; then	# we test this only if we have something really large, because this is	# we only case we can expect any differences	if test "x$z8_test_files" = x ; then		:	else		echo "testing ZMODEM8K"		mkdir $testdir/zmodem8k		failed=0		$SZ -q8OT $SZBUFSIZE $z8_test_files <$testdir/pipe | \			(cd $testdir/zmodem8k ; $RZ -O $RZBUFSIZE $QUIET >>../pipe )		for i in $z8_test_files ; do 			bn=`basename $i`			cmp $i $testdir/zmodem8k/$bn			if test $? -eq 0 ; then				rm -f $testdir/zmodem8k/$bn			else				failed=1			fi		done		if test $failed = 1 ; then 			echo "ZMODEM8k test failed"			any_failure="$any_failure ZMODEM8k"		fi		rmdir $testdir/zmodem8k 2>&5	fifiif test "$mode" = all -o "$mode" = z8N ; then	# we test this only if we have something really large, because this is	# we only case we can expect any differences	if test "x$z8_test_files" = x ; then		:	else		echo "testing ZMODEM8K-NULL"		mkdir $testdir/zmodem8k-NULL		$SZ -q8OT $SZBUFSIZE $z8_test_files <$testdir/pipe | \			(cd $testdir/zmodem8k-NULL ; $RZ -DO $RZBUFSIZE $QUIET >>../pipe )		rmdir $testdir/zmodem8k-NULL 2>&5	fifi# test zmodem-tcp# inband tcp: stdin/out connection needed.if test "$mode" = all -o "$mode" = tcp ; then	echo "testing ZMODEMtcp"	mkdir $testdir/zmodemtcp	failed=0	($SZ --tcp -q $SZBUFSIZE $z_test_files ) <$testdir/pipe | \		(cd $testdir/zmodemtcp ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )	for i in $z_test_files ; do 		bn=`basename $i`		cmp $i $testdir/zmodemtcp/$bn		if test $? -eq 0 ; then			rm -f $testdir/zmodemtcp/$bn		else			failed=1		fi	done	rmdir $testdir/zmodemtcp 2>&5	if test $failed = 1 ; then 		echo "ZMODEMtcp test failed"		any_failure="$any_failure ZMODEMtcp"	fifiif test "$mode" = all -o "$mode" = tcp4 ; then	echo "testing ZMODEMtcp4k"	mkdir $testdir/zmodemtcp4k	failed=0	($SZ --tcp -q4 $SZBUFSIZE $z_test_files ) <$testdir/pipe | \		(cd $testdir/zmodemtcp4k ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )	for i in $z_test_files ; do 		bn=`basename $i`		cmp $i $testdir/zmodemtcp4k/$bn		if test $? -eq 0 ; then			rm -f $testdir/zmodemtcp4k/$bn		else			failed=1		fi	done	rmdir $testdir/zmodemtcp4k 2>&5	if test $failed = 1 ; then 		echo "ZMODEMtcp4k test failed"		any_failure="$any_failure ZMODEMtcp4k"	fifiif test "$mode" = all -o "$mode" = tcp8 ; then	echo "testing ZMODEMtcp8k"	mkdir $testdir/zmodemtcp8k	failed=0	($SZ --tcp -q8OT $SZBUFSIZE $z_test_files ) <$testdir/pipe | \		(cd $testdir/zmodemtcp8k ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )	for i in $z_test_files ; do 		bn=`basename $i`		cmp $i $testdir/zmodemtcp8k/$bn		if test $? -eq 0 ; then			rm -f $testdir/zmodemtcp8k/$bn		else			failed=1		fi	done	rmdir $testdir/zmodemtcp8k 2>&5	if test $failed = 1 ; then 		echo "ZMODEMtcp8k test failed"		any_failure="$any_failure ZMODEMtcp8k"	fifi# out-of-band tcpif test "$mode" = tcpo ; then	echo "testing ZMODEMtcpo"	mkdir $testdir/zmodemtcpo	failed=0	$SZ --tcp-server -q $SZBUFSIZE $z_test_files | \		perl -e '$|=1; while(<>) {if (/^connect with .* "(.*)"/) {print $1 . "\n";}}' |	( cd $testdir/zmodemtcpo ; xargs -l1 $RZ $RZBUFSIZE -vv --tcp-client )	for i in $z_test_files ; do 		bn=`basename $i`		cmp $i $testdir/zmodemtcpo/$bn		if test $? -eq 0 ; then			rm -f $testdir/zmodemtcpo/$bn		else			failed=1		fi	done	rmdir $testdir/zmodemtcpo 2>&5	if test $failed = 1 ; then 		echo "ZMODEMtcpo test failed"		any_failure="$any_failure ZMODEMtcpo"	fifiif test "$mode" = error ; then	# we test this only if we have something really large, because this is	# we only case we can expect any differences	if test "x$y_test_files" = x ; then		:	else		echo "testing error, lsz"		mkdir $testdir/error.lsz		failed=0		# strace -vs 128 -o out $SZ -8 -vvvvvvvv $SZBUFSIZE $y_test_files <$testdir/pipe | \		$SZ -8q $SZBUFSIZE $y_test_files <$testdir/pipe | \			(cd $testdir/error.lsz ; $RZ --errors 32768 $RZBUFSIZE $QUIET >>../pipe 2>/dev/null)		for i in $y_test_files ; do 			bn=`basename $i`			cmp $i $testdir/error.lsz/$bn			if test $? -eq 0 ; then				rm -f $testdir/error.lsz/$bn			else				failed=1			fi		done		if test $failed = 1 ; then 			echo "error test failed"			any_failure="$any_failure error.lsz"		fi		rmdir $testdir/error.lsz 2>&5		# omen zmodem has a really bad error behaviour. it gets so slow		# that you wouldn't believe it ...		echo "testing error, omen.sz"		mkdir $testdir/error.omen		failed=0		omen.sz $y_test_files <$testdir/pipe | \			(cd $testdir/error.omen ; $RZ -vvv --errors 32768 $RZBUFSIZE $QUIET >>../pipe 2>/tmp/out2)		for i in $y_test_files ; do 			bn=`basename $i`			cmp $i $testdir/error.omen/$bn			if test $? -eq 0 ; then				rm -f $testdir/error.omen/$bn			else				failed=1			fi		done		if test $failed = 1 ; then 			echo "error.omen test failed"			any_failure="$any_failure error.omen"		fi		rmdir $testdir/error.omen 2>&5		echo "testing error, zm.sz"		mkdir $testdir/error.zm		failed=0		zmtx $y_test_files <$testdir/pipe | \			(cd $testdir/error.zm ; $RZ -vvv --errors 32768 $RZBUFSIZE $QUIET >>../pipe 2>/tmp/out2)		for i in $y_test_files ; do 			bn=`basename $i`			cmp $i $testdir/error.zm/$bn			if test $? -eq 0 ; then				rm -f $testdir/error.zm/$bn			else				failed=1			fi		done		if test $failed = 1 ; then 			echo "error.zm test failed"			any_failure="$any_failure error.zm"		fi		rmdir $testdir/error.zm 2>&5	fifi# test ymodemif test "$mode" = all -o "$mode" = y ; then	echo "testing YMODEM"	mkdir $testdir/ymodem	failed=0	$SZ --ymodem -q $y_test_files <$testdir/pipe | \		(cd $testdir/ymodem ; $RZ $QUIET --ymodem >>../pipe)	for i in $y_test_files ; do 		bn=`basename $i`		cmp $i $testdir/ymodem/$bn		if test $? -eq 0 ; then			rm -f $testdir/ymodem/$bn		else			failed=1		fi	done	rmdir $testdir/ymodem 2>&5	if test $failed = 1 ; then 		echo "YMODEM test failed"		any_failure="$any_failure YMODEM"	fifiif test "$mode" = all -o "$mode" = x ; then	echo "testing XMODEM"	mkdir $testdir/xmodem	failed=0	for i in $x_test_files; do		bn=`basename $i`		$SZ --xmodem -qa $i <$testdir/pipe | \			(cd $testdir/xmodem ; $RZ $QUIET -a --xmodem $bn >>../pipe)		cmp $i $testdir/xmodem/$bn		if test $? -eq 0 ; then			rm -f $testdir/xmodem/$bn		else			failed=1		fi	done	rmdir $testdir/xmodem 2>&5	if test $failed = 1 ; then 		echo "XMODEM test failed"		any_failure="$any_failure XMODEM"	fifiif test "$mode" = all -o "$mode" = manage ; then	echo "testing file management, appending"	mkdir $testdir/manag.append	failed=0	$SZ -q --append $srcdir/src/lsz.c $srcdir/src/lsz.c <$testdir/pipe | \		(cd $testdir/manag.append ; $RZ $QUIET >>../pipe)	rm -f $testdir/manag.append/compare	cp $srcdir/src/lsz.c $testdir/manag.append/compare	cat $srcdir/src/lsz.c >>$testdir/manag.append/compare	cmp $testdir/manag.append/compare $testdir/manag.append/lsz.c	if test $? -eq 0 ; then		rm -f $testdir/manag.append/lsz.c		rm -f $testdir/manag.append/compare	else		failed=1	fi	rmdir $testdir/manag.append 2>&5	if test $failed = 1 ; then 		echo "management/append test failed"		any_failure="$any_failure manag.append"	fi	echo "testing file management, renaming"	mkdir $testdir/manag.rename	failed=0	rm -f $testdir/manag.rename/lsz.c	cp $srcdir/src/lsz.c $testdir/manag.rename/	$SZ -q --rename $srcdir/src/lsz.c $srcdir/src/lsz.c <$testdir/pipe | \		(cd $testdir/manag.rename ; $RZ $QUIET >>../pipe)	cmp $testdir/manag.rename/lsz.c $srcdir/src/lsz.c	if test $? -ne 0 ; then		failed=1	else		cmp $testdir/manag.rename/lsz.c.0 $srcdir/src/lsz.c		if test $? -ne 0 ; then			failed=1			else			cmp $testdir/manag.rename/lsz.c.1 $srcdir/src/lsz.c			if test $? -ne 0 ; then				failed=1				fi		fi	fi	if test $failed -eq 0 ; then		rm -f $testdir/manag.rename/lsz.c		rm -f $testdir/manag.rename/lsz.c.0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -