3 # $FreeBSD: src/gnu/usr.bin/gzip/zmore,v 1.5 1999/08/27 23:35:56 peter Exp $
4 # $DragonFly: src/gnu/usr.bin/gzip/Attic/zmore,v 1.2 2003/06/17 04:25:46 dillon Exp $
6 if test "`echo -n a`" = "-n a"; then
7 # looks like a SysV system:
12 oldtty=`stty -g 2>/dev/null`
13 if stty -cbreak 2>/dev/null; then
14 cb='cbreak'; ncb='-cbreak'
16 # 'stty min 1' resets eof to ^a on both SunOS and SysV!
17 cb='min 1 -icanon'; ncb='icanon eof ^d'
19 if test $? -eq 0 -a -n "$oldtty"; then
20 trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
22 trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
27 echo usage: zmore files...
29 gzip -cdfq | eval ${PAGER-more}
35 if test $FIRST -eq 0; then
36 echo $n1 "--More--(Next file: $FILE)$n2"
37 stty $cb -echo 2>/dev/null
38 ANS=`dd bs=1 count=1 2>/dev/null`
39 stty $ncb echo 2>/dev/null
41 if test "$ANS" = 'e' -o "$ANS" = 'q'; then
45 if test "$ANS" != 's'; then
46 echo "------> $FILE <------"
47 gzip -cdfq "$FILE" | eval ${PAGER-more}