1*4f9a1459Swiz#!/bin/sh 2*4f9a1459Swiz 3*4f9a1459Swiz# Bzmore wrapped for bzip2, 4*4f9a1459Swiz# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux. 5*4f9a1459Swiz 6*4f9a1459SwizPATH="/usr/bin:$PATH"; export PATH 7*4f9a1459Swiz 8*4f9a1459Swizprog=`echo $0 | sed 's|.*/||'` 9*4f9a1459Swizcase "$prog" in 10*4f9a1459Swiz *less) more=less ;; 11*4f9a1459Swiz *) more=more ;; 12*4f9a1459Swizesac 13*4f9a1459Swiz 14*4f9a1459Swizif test "`echo -n a`" = "-n a"; then 15*4f9a1459Swiz # looks like a SysV system: 16*4f9a1459Swiz n1=''; n2='\c' 17*4f9a1459Swizelse 18*4f9a1459Swiz n1='-n'; n2='' 19*4f9a1459Swizfi 20*4f9a1459Swizoldtty=`stty -g 2>/dev/null` 21*4f9a1459Swizif stty -cbreak 2>/dev/null; then 22*4f9a1459Swiz cb='cbreak'; ncb='-cbreak' 23*4f9a1459Swizelse 24*4f9a1459Swiz # 'stty min 1' resets eof to ^a on both SunOS and SysV! 25*4f9a1459Swiz cb='min 1 -icanon'; ncb='icanon eof ^d' 26*4f9a1459Swizfi 27*4f9a1459Swizif test $? -eq 0 -a -n "$oldtty"; then 28*4f9a1459Swiz trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15 29*4f9a1459Swizelse 30*4f9a1459Swiz trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15 31*4f9a1459Swizfi 32*4f9a1459Swiz 33*4f9a1459Swizif test $# = 0; then 34*4f9a1459Swiz if test -t 0; then 35*4f9a1459Swiz echo usage: $prog files... 36*4f9a1459Swiz else 37*4f9a1459Swiz bzip2 -cdfq | eval $more 38*4f9a1459Swiz fi 39*4f9a1459Swizelse 40*4f9a1459Swiz FIRST=1 41*4f9a1459Swiz for FILE 42*4f9a1459Swiz do 43*4f9a1459Swiz if test $FIRST -eq 0; then 44*4f9a1459Swiz echo $n1 "--More--(Next file: $FILE)$n2" 45*4f9a1459Swiz stty $cb -echo 2>/dev/null 46*4f9a1459Swiz ANS=`dd bs=1 count=1 2>/dev/null` 47*4f9a1459Swiz stty $ncb echo 2>/dev/null 48*4f9a1459Swiz echo " " 49*4f9a1459Swiz if test "$ANS" = 'e' -o "$ANS" = 'q'; then 50*4f9a1459Swiz exit 51*4f9a1459Swiz fi 52*4f9a1459Swiz fi 53*4f9a1459Swiz if test "$ANS" != 's'; then 54*4f9a1459Swiz echo "------> $FILE <------" 55*4f9a1459Swiz bzip2 -cdfq "$FILE" | eval $more 56*4f9a1459Swiz fi 57*4f9a1459Swiz if test -t; then 58*4f9a1459Swiz FIRST=0 59*4f9a1459Swiz fi 60*4f9a1459Swiz done 61*4f9a1459Swizfi 62