Last change
on this file since 1116 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 |
|
---|
6 | PATH="/usr/bin:$PATH"; export PATH
|
---|
7 |
|
---|
8 | prog=`echo $0 | sed 's|.*/||'`
|
---|
9 | case "$prog" in
|
---|
10 | *less) more=less ;;
|
---|
11 | *) more=more ;;
|
---|
12 | esac
|
---|
13 |
|
---|
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=''
|
---|
19 | fi
|
---|
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'
|
---|
26 | fi
|
---|
27 | if test $? -eq 0 && test -n "$oldtty"; then
|
---|
28 | trap 'stty $oldtty 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
|
---|
29 | else
|
---|
30 | trap 'stty $ncb echo 2>/dev/null; exit' 0 INT QUIT TRAP USR1 PIPE TERM
|
---|
31 | fi
|
---|
32 |
|
---|
33 | if test $# = 0; then
|
---|
34 | if test -t 0; then
|
---|
35 | echo usage: $prog files...
|
---|
36 | else
|
---|
37 | bzip2 -cdfq | eval $more
|
---|
38 | fi
|
---|
39 | else
|
---|
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
|
---|
61 | fi
|
---|
Note:
See
TracBrowser
for help on using the repository browser.