Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / miscellany / less-177 / version.c
1 /*
2  *              less
3  *      Copyright (c) 1984,1985,1989  Mark Nudelman
4  *
5  *      This program may be freely used and/or modified, 
6  *      with the following provisions:
7  *      1. This notice and the above copyright notice must remain intact.
8  *      2. Neither this program, nor any modification of it,
9  *         may be sold for profit without written consent of the author.
10  *
11  *       ---------------------------------------------------------------
12  *      |  Special note to the person who ported "less" to the Amiga:   |
13  *      |  If you're going to be vain enough to splash your name on     |
14  *      |  the screen every time someone runs less, you might at        |
15  *      |  least credit the author.                                     |
16  *       ---------------------------------------------------------------
17  *
18  *      This program is a paginator similar to "more", 
19  *      but allows you to move both forward and backward in the file.  
20  *      Commands are based on "more" and "vi".
21  *
22  *      ----------------------- CHANGES ---------------------------------
23  *
24  *          Allowed use on standard input               1/29/84   markn
25  *          Added E, N, P commands                      2/1/84    markn
26  *          Added '=' command, 'stop' signal handling   4/17/84   markn
27  *          Added line folding                          4/20/84   markn
28  *      v2: Fixed '=' command to use BOTTOM_PLUS_ONE, 
29  *          instead of TOP, added 'p' & 'v' commands    4/27/84   markn
30  *      v3: Added -m and -t options, '-' command        5/3/84    markn
31  *      v4: Added LESS environment variable             5/3/84    markn
32  *      v5: New comments, fixed '-' command slightly    5/3/84    markn
33  *      v6: Added -Q, visual bell                       5/15/84   markn
34  *      v7: Fixed jump_back(n) bug: n should count real
35  *          lines, not folded lines.  Also allow number
36  *          on G command.                               5/24/84   markn
37  *      v8: Re-do -q and -Q commands                    5/30/84   markn
38  *      v9: Added "+<cmd>" argument                     9/25/84   markn
39  *      v10: Fixed bug in -b<n> argument processing     10/10/84  markn
40  *      v11: Made error() ring bell if \n not entered.  10/18/84  markn
41  *      -----------------------------------------------------------------
42  *      v12: Reorganized signal handling and made
43  *           portable to 4.2bsd.                        2/13/85   mark
44  *      v13: Reword error message for '-' command.      2/16/85   mark
45  *      v14: Added -bf and -bp variants of -b.          2/22/85   mark
46  *      v15: Miscellaneous changes.                     2/25/85   mark
47  *      v16: Added -u flag for backspace processing.    3/13/85   mark
48  *      v17: Added j and k commands, 
49  *              changed -t default.                     4/13/85   mark
50  *      v18: Rewrote signal handling code.              4/20/85   mark
51  *      v19: Got rid of "verbose" eq_message().         5/2/85    mark
52  *           Made search() scroll in some cases.
53  *      v20: Fixed screen.c ioctls for System V.        5/21/85   mark
54  *      v21: Fixed some first_cmd bugs.                 5/23/85   mark
55  *      v22: Added support for no RECOMP nor REGCMP.    5/24/85   mark
56  *      v23: Miscellanous changes and prettying up.     5/25/85   mark
57  *              Posted to USENET.
58  *      -----------------------------------------------------------------
59  *      v24: Added ti,te terminal init & de-init       6/3/85 Mike Kersenbrock
60  *      v25: Added -U flag, standout mode underlining.  6/8/85    mark
61  *      v26: Added -M flag.                             6/9/85    mark
62  *           Use underline termcap (us) if it exists.
63  *      v27: Renamed some variables to make unique in   6/15/85   mark
64  *           6 chars.  Minor fix to -m.
65  *      v28: Fixed right margin bug.                    6/28/85   mark
66  *      v29: Incorporated M.Rose's changes to signal.c  6/28/85   mark
67  *      v30: Fixed stupid bug in argument processing.   6/29/85   mark
68  *      v31: Added -p flag, changed repaint algorithm.  7/15/85   mark
69  *           Added kludge for magic cookie terminals.
70  *      v32: Added cat_file if output not a tty.        7/16/85   mark
71  *      v33: Added -e flag and EDITOR.                  7/23/85   mark
72  *      v34: Added -s flag.                             7/26/85   mark
73  *      v35: Rewrote option handling; added option.c.   7/27/85   mark
74  *      v36: Fixed -e flag to work if not last file.    7/29/85   mark
75  *      v37: Added -x flag.                             8/10/85   mark
76  *      v38: Changed prompting; created prompt.c.       8/19/85   mark
77  *      v39: (Not -p) does not initially clear screen.  8/24/85   mark
78  *      v40: Added "skipping" indicator in forw().      8/26/85   mark
79  *              Posted to USENET.
80  *      -----------------------------------------------------------------
81  *      v41: ONLY_RETURN, control char commands,        9/17/85   mark
82  *           faster search, other minor fixes.
83  *      v42: Added ++ command line syntax;              9/25/85   mark
84  *           ch_fsize for pipes.
85  *      v43: Added -h flag, changed prim.c algorithms.  10/15/85  mark
86  *      v44: Made END print in all cases of eof;        10/16/85  mark
87  *           ignore SIGTTOU after receiving SIGTSTP.
88  *      v45: Never print backspaces unless -u.          10/16/85  mark
89  *      v46: Backwards scroll in jump_loc.              10/24/85  mark
90  *      v47: Fixed bug in edit(): *first_cmd==0         10/30/85  mark
91  *      v48: Use TIOCSETN instead of TIOCSETP.          11/16/85  mark
92  *           Added marks (m and ' commands).
93  *              Posted to USENET.
94  *      -----------------------------------------------------------------
95  *      v49: Fixed bug: signal didn't clear mcc.        1/9/86    mark
96  *      v50: Added ' (quote) to gomark.                 1/15/86   mark
97  *      v51: Added + cmd, fixed problem if first_cmd
98  *           fails, made g cmd sort of "work" on pipes
99  *           even if bof is no longer buffered.         1/16/86   mark
100  *      v52: Made short files work better.              1/17/86   mark
101  *      v53: Added -P option.                           1/20/86   mark
102  *      v54: Changed help to use HELPFILE.              1/20/86   mark
103  *      v55: Messages work better if not tty output.    1/23/86   mark
104  *      v56: Added -l option.                           1/24/86   mark
105  *      v57: Fixed -l to get confirmation before
106  *           overwriting an existing file.              1/31/86   mark
107  *      v58: Added filename globbing.                   8/28/86   mark
108  *      v59: Fixed some bugs with very long filenames.  9/15/86   mark
109  *      v60: Incorporated changes from Leith (Casey)
110  *           Leedom for boldface and -z option.         9/26/86   mark
111  *      v61: Got rid of annoying repaints after ! cmd.  9/26/86   mark
112  *              Posted to USENET.
113  *      -----------------------------------------------------------------
114  *      v62: Added is_directory(); change -z default to
115  *           -1 instead of 24; cat-and-exit if -e and
116  *           file is less than a screenful.             12/23/86  mark
117  *      v63: Fixed bug in cat-and-exit if > 1 file.     1/8/87    mark
118  *      v64: Changed puts/putstr, putc/putchr, 
119  *           getc/getchr to avoid name conflict with 
120  *           stdio functions.                           1/12/87  mark
121  *      v65: Allowed '-' command to change NUMBER
122  *           valued options (thanks to Gary Puckering)  1/26/87  mark
123  *      v66: Fixed bug: prepaint should use force=1.    2/13/87  mark
124  *      v67: Added !! and % expansion to ! command.     2/24/87  mark
125  *      v68: Added SIGWINCH and TIOCGWINSZ support;
126  *           changed is_directory to bad_file.
127  *           (thanks to J. Robert Ward)                 2/25/87  mark
128  *      v69: Added SIGWIND and WIOCGETD (for Unix PC).  2/25/87  mark
129  *      v70: Changed help cmd from 'h' to 'H'; better 
130  *           error msgs in bad_file, errno_message.     3/13/87  mark
131  *      v71: Changed -p to -c, made triple -c/-C
132  *           for clear-eol like more's -c.              5/11/87  mark
133  *      v72: Added -E, -L, use $SHELL in lsystem().     6/26/87  mark
134  *           (thanks to Steve Spearman)
135  *      v73: Allow Examine "#" for previous file.       6/26/87  mark
136  *              Posted to USENET 8/25/87.
137  *      -----------------------------------------------------------------
138  *      v74: Fix conflict in EOF symbol with stdio.h,   9/18/87  mark
139  *           Make os.c more portable to BSD.
140  *      v75: Fix problems in get_term (thanks to        9/23/87  mark
141  *           Paul Eggert); new backwards scrolling in
142  *           jump_loc (thanks to Marion Hakanson).
143  *      v76: Added -i flag; allow single "!" to         9/23/87  mark
144  *           invoke a shell (thanks to Franco Barber).
145  *      v77: Added -n flag and line number support.     9/24/87  mark
146  *      v78: Fixed problem with prompts longer than     9/25/87  mark
147  *           the screen width.  
148  *      v79: Added the _ command.                       9/29/87  mark
149  *      v80: Allow signal to break out of linenum scan. 10/6/87  mark
150  *      v81: Allow -b to be changed from within less.   10/6/87  mark
151  *      v82: Add cmd_decode to use a table for key      10/7/87  mark
152  *           binding (thanks to David Nason).
153  *      v83: Allow .less file for user-defined keys.    10/9/87  mark
154  *      v84: Fix -e/-E problems (thanks to Felix Lee).  10/11/87 mark
155  *      v85: Search now keeps track of line numbers.    10/15/87 mark
156  *      v86: Added -B option and autobuf; fixed         10/20/87 mark
157  *           "pipe error" bug.
158  *      v87: Fix bug re BSD signals while reading file. 3/1/88   mark
159  *      v88: Use new format for -P option (thanks to    3/12/88  mark
160  *           der Mouse), allow "+-c" without message,
161  *           fix bug re BSD hangup.
162  *      v89: Turn off line numbers if linenum scan      3/18/88  mark
163  *           is interrupted.
164  *      v90: Allow -P from within less.                 3/30/88  mark
165  *      v91: Added tags file support (new -t option)    3/30/88  mark
166  *           (thanks to Brian Campbell).
167  *      v92: Added -+option syntax.                     4/4/88   mark
168  *      v93: Add support for slow input (thanks to      4/11/88  mark
169  *           Joe Orost & apologies for taking almost
170  *           3 years to get this in!)
171  *      v94: Redo reading/signal stuff.                 4/11/88  mark
172  *      v95: Repaint screen better after signal.        4/20/88  mark
173  *      v96: Add /! and ?! commands.                    4/21/88  mark
174  *      v97: Allow -l/-L from within less.              5/17/88  mark
175  *           Eliminate some static arrays (use calloc).
176  *              Posted to USENET.
177  *      -----------------------------------------------------------------
178  *      v98: Fix incorrect calloc call; uninitialized   10/14/88 mark
179  *           var in exec_mca; core dump on unknown TERM.
180  *           Make v cmd work if past last line of file.
181  *           Fix some signal bugs.
182  *      v99: Allow space between -X and string,         10/29/88 mark
183  *           when X is a string-valued option.
184  *      v100: Fix globbing bug when $SHELL not set;     1/5/89   mark
185  *            allow spaces after -t command.
186  *      v101: Fix problem with long (truncated) lines   1/6/89   mark
187  *            in tags file (thanks to Neil Dixon).
188  *      v102: Fix bug with E# when no prev file;        1/6/89   mark
189  *            allow spaces after -l command.
190  *      v103: Add -N, -f and -? options.  Add z and w   3/14/89  mark
191  *            commands.  Add %L for prompt strings.
192  *      v104: Added EDITPROTO.                          3/16/89  mark
193  *      v105: Fix bug in find_linenum which cached      3/20/89  mark
194  *            incorrectly on long lines.
195  *      v106: Added -k option and multiple lesskey      3/31/89  mark
196  *            files.
197  *      v107: Add 8-bit char support and -g option.     4/27/89  mark
198  *            Split option code into 3 files.
199  *      v108: Allocate position table dynamically       5/5/89   mark
200  *            (thanks to Paul Eggert); change % command
201  *            from "percent" to vi-style brace finder.
202  *      v109: Added ESC-% command, split prim.c.        5/10/89  mark
203  *      v110: Fixed bug in + option; fixed repaint bug  5/24/89  mark
204  *            under Sun windows (thanks to Paul Eggert).
205  *      v111: Generalized # and % expansion; use        5/25/89  mark
206  *            calloc for some error messages.
207  *      v112: Get rid of ESC-%, add {}()[] commands.    5/30/89  mark
208  *      v113: Optimize lseeks (thanks to Paul Eggert).  5/31/89  mark
209  *      v114: Added ESC-/ and ESC-/! commands.          7/25/89  mark
210  *      v115: Added ESC-n command.                      7/26/89  mark
211  *      v116: Added find_pos to optimize g command.     7/31/89  mark
212  *      v117: Change -f option to -r.                   8/1/89   mark
213  *      v118: Save positions for all previous files,    8/2/89   mark
214  *            not just the immediately previous one.
215  *      v119: Save marks across file boundaries.        8/7/89   mark
216  *            Add file handle stuff.
217  *      v120: Add :ta command.                          8/11/89  mark
218  *      v121: Add -f option.                            8/16/89  mark
219  *      v122: Fix performance with many buffers.        8/30/89  mark
220  *      v123: Verbose prompts for string options.       8/31/89  mark
221  *              Posted beta to USENET.
222  *      -----------------------------------------------------------------
223  *      v124: Reorganize search commands,               9/18/89  mark
224  *            N = rev, ESC-n = span, add ESC-N.
225  *      v125: Fix tab bug (thanks to Alex Liu).         9/18/89  mark
226  *            Fix EOF bug when both -w and -c.
227  *      v126: Add -j option.                            10/25/89 mark
228  *      v127: Fix problems with blank lines before BOF. 10/27/89 mark
229  *      v128: Add %bj, etc. to prompt strings.          10/27/89 mark
230  *      v129: Add -+,-- commands; add set-option and    11/3/89  mark
231  *            unset-option to lesskey.
232  *      v130: Generalize A_EXTRA to string, remove      11/6/89  mark
233  *            set-option, unset-option from lesskey.
234  *      v131: Changed name of EDITPROTO to LESSEDIT.    11/7/89  mark
235  *      v132: Allow editing of command prefix.          11/8/89  mark
236  *      v133: Add -y option (thanks to Jeff Sullivan).  11/16/89 mark
237  *      v134: Glob filenames in the -l command.         12/1/89  mark
238  *      v135: Combined {}()[] commands into one, and    12/5/89  mark
239  *            added ESC-^F and ESC-^B commands.
240  *      v136: Added -S, -R flags.  Added | command.     1/20/90  mark
241  *            Added warning for binary files. (thanks 
242  *            to Richard Brittain and J. Sullivan).
243  *      v137: Rewrote horrible pappend code.            1/21/90  mark
244  *            Added * notation for hi-bit chars.
245  *      v138: Fix magic cookie terminal handling.       1/24/90  mark
246  *            Get rid of "cleanup" loop in ch_get.
247  *      v139: Added MSDOS support.  (many thanks        1/27/90  mark
248  *            to Richard Brittain).
249  *      v140: Editing a new file adds it to the         2/7/90   mark
250  *            command line list.
251  *      v141: Add edit_list for editing >1 file.        2/8/90   mark
252  *      v142: Add :x command.                           2/10/90  mark
253  *      v143: Add * and @ modifies to search cmds.      2/11/90  mark
254  *            Change ESC-/ cmd from /@* to / *.
255  *      v144: Messed around with ch_zero;               3/1/90   mark
256  *            no real change.
257  *      v145: Added -R and -v/-V for MSDOS;             3/2/90   mark
258  *            renamed FILENAME to avoid conflict.
259  *      v146: Pull cmdbuf functions out of command.c    3/5/90   mark
260  *      v147: Implement ?@; fix multi-file edit bugs.   3/7/90   mark
261  *      v148: Fixed bug in :e<file> then :e#.           3/29/90  mark
262  *      v149: Change error,ierror,query to use PARG.    4/3/90   mark
263  *      v150: Add LESS_CHARSET, LESS_CHARDEF.           4/6/90   mark
264  *      v151: Remove -g option; clean up ispipe.        4/13/90  mark
265  *      v152: lsystem() closes input file, for          4/14/90  mark
266  *            editors which require exclusive open.
267  *      v153: Fix bug if SHELL unset;                   4/18/90  mark
268  *            fix bug in overstrike control char.
269  *      v154: Output to fd 2 via buffer.                4/25/90  mark
270  *      v155: Ignore -i if uppercase in pattern         4/30/90  mark
271  *            (thanks to Michael Rendell.)
272  *      v156: Remove scroll limits in forw() & back();  5/3/90   mark
273  *            causes problems with -c.
274  *      v157: Forward search starts at next real line   5/4/90   mark
275  *            (not screen line) after jump target.
276  *      v158: Added F command.                          6/14/90  mark
277  *      v159: Fix bug in exiting: output not flushed.   7/29/90  mark
278  *      v160: Clear screen before initial output w/ -c. 7/29/90  mark
279  *      v161: Add -T flag.                              7/29/90  mark
280  *      v162: Fix bug with +F on command line.          8/14/90  mark
281  *      v163: Added LESSBINFMT variable.                8/21/90  mark
282  *      v164: Added -p, LINES, COLUMNS and              9/5/90   mark
283  *            unset mark ' == BOF, for 1003.2 D5.
284  *      v165: At EOF with -c set, don't display empty   9/6/90   mark
285  *            screen when try to page forward.
286  *      v166: Fix G when final line in file wraps.      9/6/90   mark
287  *      v167: Translate CR/LF -> LF for 1003.2.         9/11/90  mark
288  *      v168: Return to curr file if "tag not found".   9/13/90  mark
289  *      v169: G goes to EOF even if file has grown.     12/12/90 mark
290  *      v170: Add optimization for BSD _setjmp;         1/17/91  mark
291  *            fix #include ioctl.h TERMIO problem.
292  *            (thanks to Paul Eggert)
293  *              Posted to USENET.
294  *      -----------------------------------------------------------------
295  *      v171: Fix -? bug in get_filename.               3/6/91    mark
296  *      v172: Fix G bug in empty file.                  3/15/91   mark
297  *            Fix bug with ?\n and -i and uppercase
298  *            pattern at EOF!
299  *            (thanks to Paul Eggert)
300  *      v173: Change N cmd to not permanently change    3/17/91   mark
301  *            direction. (thanks to Brian Matthews)
302  *      v174: Fix bug with namelogfile not getting      3/18/91   mark
303  *            cleared when change files.
304  *      v175: Fix bug with ++cmd on command line.       3/18/91   mark
305  *            (thanks to Jim Meyering)
306  *      v176: Change | to not force current screen,     4/2/91    mark
307  *            include marked line, start/end from 
308  *            top of screen.  Improve search speed.
309  *            (thanks to Don Mears)
310  *      v177: Add LESSHELP variable.                    4/2/91    mark
311  *            Fix bug with F command with -e.
312  *            Try /dev/tty for input before using fd 2.
313  */
314
315 char version[] = "@(#) less  version 177";