diff options
Diffstat (limited to '')
-rw-r--r-- | bzmore | 61 | ||||
-rw-r--r-- | bzmore.1 | 152 |
2 files changed, 213 insertions, 0 deletions
@@ -0,0 +1,61 @@ | |||
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 -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 | ||
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' -o "$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 | ||
diff --git a/bzmore.1 b/bzmore.1 new file mode 100644 index 0000000..b437d3b --- /dev/null +++ b/bzmore.1 | |||
@@ -0,0 +1,152 @@ | |||
1 | .\"Shamelessly copied from zmore.1 by Philippe Troin <phil@fifi.org> | ||
2 | .\"for Debian GNU/Linux | ||
3 | .TH BZMORE 1 | ||
4 | .SH NAME | ||
5 | bzmore, bzless \- file perusal filter for crt viewing of bzip2 compressed text | ||
6 | .SH SYNOPSIS | ||
7 | .B bzmore | ||
8 | [ name ... ] | ||
9 | .br | ||
10 | .B bzless | ||
11 | [ name ... ] | ||
12 | .SH NOTE | ||
13 | In the following description, | ||
14 | .I bzless | ||
15 | and | ||
16 | .I less | ||
17 | can be used interchangeably with | ||
18 | .I bzmore | ||
19 | and | ||
20 | .I more. | ||
21 | .SH DESCRIPTION | ||
22 | .I Bzmore | ||
23 | is a filter which allows examination of compressed or plain text files | ||
24 | one screenful at a time on a soft-copy terminal. | ||
25 | .I bzmore | ||
26 | works on files compressed with | ||
27 | .I bzip2 | ||
28 | and also on uncompressed files. | ||
29 | If a file does not exist, | ||
30 | .I bzmore | ||
31 | looks for a file of the same name with the addition of a .bz2 suffix. | ||
32 | .PP | ||
33 | .I Bzmore | ||
34 | normally pauses after each screenful, printing --More-- | ||
35 | at the bottom of the screen. | ||
36 | If the user then types a carriage return, one more line is displayed. | ||
37 | If the user hits a space, | ||
38 | another screenful is displayed. Other possibilities are enumerated later. | ||
39 | .PP | ||
40 | .I Bzmore | ||
41 | looks in the file | ||
42 | .I /etc/termcap | ||
43 | to determine terminal characteristics, | ||
44 | and to determine the default window size. | ||
45 | On a terminal capable of displaying 24 lines, | ||
46 | the default window size is 22 lines. | ||
47 | Other sequences which may be typed when | ||
48 | .I bzmore | ||
49 | pauses, and their effects, are as follows (\fIi\fP is an optional integer | ||
50 | argument, defaulting to 1) : | ||
51 | .PP | ||
52 | .IP \fIi\|\fP<space> | ||
53 | display | ||
54 | .I i | ||
55 | more lines, (or another screenful if no argument is given) | ||
56 | .PP | ||
57 | .IP ^D | ||
58 | display 11 more lines (a ``scroll''). | ||
59 | If | ||
60 | .I i | ||
61 | is given, then the scroll size is set to \fIi\|\fP. | ||
62 | .PP | ||
63 | .IP d | ||
64 | same as ^D (control-D) | ||
65 | .PP | ||
66 | .IP \fIi\|\fPz | ||
67 | same as typing a space except that \fIi\|\fP, if present, becomes the new | ||
68 | window size. Note that the window size reverts back to the default at the | ||
69 | end of the current file. | ||
70 | .PP | ||
71 | .IP \fIi\|\fPs | ||
72 | skip \fIi\|\fP lines and print a screenful of lines | ||
73 | .PP | ||
74 | .IP \fIi\|\fPf | ||
75 | skip \fIi\fP screenfuls and print a screenful of lines | ||
76 | .PP | ||
77 | .IP "q or Q" | ||
78 | quit reading the current file; go on to the next (if any) | ||
79 | .PP | ||
80 | .IP "e or q" | ||
81 | When the prompt --More--(Next file: | ||
82 | .IR file ) | ||
83 | is printed, this command causes bzmore to exit. | ||
84 | .PP | ||
85 | .IP s | ||
86 | When the prompt --More--(Next file: | ||
87 | .IR file ) | ||
88 | is printed, this command causes bzmore to skip the next file and continue. | ||
89 | .PP | ||
90 | .IP = | ||
91 | Display the current line number. | ||
92 | .PP | ||
93 | .IP \fIi\|\fP/expr | ||
94 | search for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP | ||
95 | If the pattern is not found, | ||
96 | .I bzmore | ||
97 | goes on to the next file (if any). | ||
98 | Otherwise, a screenful is displayed, starting two lines before the place | ||
99 | where the expression was found. | ||
100 | The user's erase and kill characters may be used to edit the regular | ||
101 | expression. | ||
102 | Erasing back past the first column cancels the search command. | ||
103 | .PP | ||
104 | .IP \fIi\|\fPn | ||
105 | search for the \fIi\|\fP-th occurrence of the last regular expression entered. | ||
106 | .PP | ||
107 | .IP !command | ||
108 | invoke a shell with \fIcommand\|\fP. | ||
109 | The character `!' in "command" are replaced with the | ||
110 | previous shell command. The sequence "\\!" is replaced by "!". | ||
111 | .PP | ||
112 | .IP ":q or :Q" | ||
113 | quit reading the current file; go on to the next (if any) | ||
114 | (same as q or Q). | ||
115 | .PP | ||
116 | .IP . | ||
117 | (dot) repeat the previous command. | ||
118 | .PP | ||
119 | The commands take effect immediately, i.e., it is not necessary to | ||
120 | type a carriage return. | ||
121 | Up to the time when the command character itself is given, | ||
122 | the user may hit the line kill character to cancel the numerical | ||
123 | argument being formed. | ||
124 | In addition, the user may hit the erase character to redisplay the | ||
125 | --More-- message. | ||
126 | .PP | ||
127 | At any time when output is being sent to the terminal, the user can | ||
128 | hit the quit key (normally control\-\\). | ||
129 | .I Bzmore | ||
130 | will stop sending output, and will display the usual --More-- | ||
131 | prompt. | ||
132 | The user may then enter one of the above commands in the normal manner. | ||
133 | Unfortunately, some output is lost when this is done, due to the | ||
134 | fact that any characters waiting in the terminal's output queue | ||
135 | are flushed when the quit signal occurs. | ||
136 | .PP | ||
137 | The terminal is set to | ||
138 | .I noecho | ||
139 | mode by this program so that the output can be continuous. | ||
140 | What you type will thus not show on your terminal, except for the / and ! | ||
141 | commands. | ||
142 | .PP | ||
143 | If the standard output is not a teletype, then | ||
144 | .I bzmore | ||
145 | acts just like | ||
146 | .I bzcat, | ||
147 | except that a header is printed before each file. | ||
148 | .SH FILES | ||
149 | .DT | ||
150 | /etc/termcap Terminal data base | ||
151 | .SH "SEE ALSO" | ||
152 | more(1), less(1), bzip2(1), bzdiff(1), bzgrep(1) | ||