source: Daodan/MinGW/msys/1.0/bin/bzless@ 1130

Last change on this file since 1130 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 1.3 KB
Line 
1#!/bin/sh
2
3# Bzmore wrapped for bzip2,
4# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
5
6PATH="/usr/bin:$PATH"; export PATH
7
8prog=`echo $0 | sed 's|.*/||'`
9case "$prog" in
10 *less) more=less ;;
11 *) more=more ;;
12esac
13
14if test "`echo -n a`" = "-n a"; then
15 # looks like a SysV system:
16 n1=''; n2='\c'
17else
18 n1='-n'; n2=''
19fi
20oldtty=`stty -g 2>/dev/null`
21if stty -cbreak 2>/dev/null; then
22 cb='cbreak'; ncb='-cbreak'
23else
24 # 'stty min 1' resets eof to ^a on both SunOS and SysV!
25 cb='min 1 -icanon'; ncb='icanon eof ^d'
26fi
27if test $? -eq 0 && test -n "$oldtty"; then
28 trap 'stty $oldtty 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
29else
30 trap 'stty $ncb echo 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
31fi
32
33if test $# = 0; then
34 if test -t 0; then
35 echo usage: $prog files...
36 else
37 bzip2 -cdfq | eval $more
38 fi
39else
40 FIRST=1
41 for FILE
42 do
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' || test "$ANS" = 'q'; then
50 exit
51 fi
52 fi
53 if test "$ANS" != 's'; then
54 echo "------> $FILE <------"
55 bzip2 -cdfq "$FILE" | eval $more
56 fi
57 if test -t; then
58 FIRST=0
59 fi
60 done
61fi
Note: See TracBrowser for help on using the repository browser.