tools/WiMP: correct target names and casing
[AROS.git] / external / bz2 / bzmore
blobd314043404976e58329f611c195d5c49eb917655
1 #!/bin/sh
3 # Bzmore wrapped for bzip2,
4 # adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
6 PATH="/usr/bin:$PATH"; export PATH
8 prog=`echo $0 | sed 's|.*/||'`
9 case "$prog" in
10 *less) more=less ;;
11 *) more=more ;;
12 esac
14 if test "`echo -n a`" = "-n a"; then
15 # looks like a SysV system:
16 n1=''; n2='\c'
17 else
18 n1='-n'; n2=''
20 oldtty=`stty -g 2>/dev/null`
21 if stty -cbreak 2>/dev/null; then
22 cb='cbreak'; ncb='-cbreak'
23 else
24 # 'stty min 1' resets eof to ^a on both SunOS and SysV!
25 cb='min 1 -icanon'; ncb='icanon eof ^d'
27 if test $? -eq 0 -a -n "$oldtty"; then
28 trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
29 else
30 trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
33 if test $# = 0; then
34 if test -t 0; then
35 echo usage: $prog files...
36 else
37 bzip2 -cdfq | eval $more
39 else
40 FIRST=1
41 for FILE
43 if test $FIRST -eq 0; then
44 echo $n1 "--More--(Next file: $FILE)$n2"
45 stty $cb -echo 2>/dev/null
46 ANS=`dd bs=1 count=1 2>/dev/null`
47 stty $ncb echo 2>/dev/null
48 echo " "
49 if test "$ANS" = 'e' -o "$ANS" = 'q'; then
50 exit
53 if test "$ANS" != 's'; then
54 echo "------> $FILE <------"
55 bzip2 -cdfq "$FILE" | eval $more
57 if test -t; then
58 FIRST=0
60 done